]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugincache-config.php
* changed stored pref representation as before.
[SourceForge/phpwiki.git] / lib / plugincache-config.php
1 <?php rcs_id('$Id: plugincache-config.php,v 1.3 2004-01-26 09:17:49 rurban Exp $');
2 /*
3  Copyright (C) 2002 Johannes Große (Johannes Gro&szlig;e)
4
5  This file is (not yet) part of PhpWiki.
6
7  PhpWiki is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11
12  PhpWiki is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  GNU General Public License for more details.
16
17  You should have received a copy of the GNU General Public License
18  along with PhpWiki; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */ 
21 /**
22  * Configuration file for the cache usage of WikiPluginCached
23  * Parameters for the cache configuration of WikiPluginCached and
24  * all plugins derived from this class.
25  * Esp. check $CacheParams['cache_dir'] and $CacheParams['cacheurl']
26  *
27  * @author  Johannes Große
28  * @version 0.8
29  */ 
30
31 /**
32  * translate kilobyte and megabyte into bytes and day into seconds
33  */
34 define('Kilobyte', 1024);
35 define('Megabyte', 1024*1024);
36 define('Day', 24 * 60 * 60 );
37
38 global $CacheParams;
39
40 /**
41  * Contains the global cache configuration settings.
42  * 
43  * @param 'database'        string Chooses the database used by the Pear
44  *                          Cache class. Should always be set to 'file' 
45  *                          for this is the fastest.
46  * @param 'cache_dir'       string path to use for a file cache. 
47  *                          This is only used if database is set to file.
48  * @param 'filename_prefix' string Every file name in the cache
49  *                          begins with this prefix. 
50  * @param 'highwater'       int the maximum total space in bytes of
51  *                          all files in the cache. When highwater is 
52  *                          exceeded, a garbage collection will start.
53  *                          It will collect garbage till 'lowwater' is 
54  *                          reached. 
55  * @param 'lowwater'        int Stop garbage collection as soon as less than
56  *                          'lowwater' bytes are used by the cache.
57  * @param 'maxlifetime'     int time in seconds a cache object is allowed
58  *                          not to be touched without beeing garbage collected
59  * @param 'cache_url'       string URL used to call an image from the
60  *                          cache. By default this is 
61  *                          'url/to/wiki/getimg.php?' where 'getimg.php'
62  *                          replaces 'index.php' or 'wiki.php', respectively. 
63  *                          If you do not have a 'getimg.php' you can 
64  *                          create it by copying your 'wiki.php'
65  *                          ('index.php') to 'getimg.php' and replace
66  *                          <code>include "lib/main.php"; </code>
67  *                          (to be found at the end of the file) by 
68  *                          <code>include "lib/imagecache.php"; </code>. 
69  *                          <b>Make sure that there is a trailing
70  *                          question mark in 'cache_url'.</b>
71  * @param 'maxarglen'       int number of characters allowed to be send as 
72  *                          parameters in the url before using sessions
73  *                          vars instead. 
74  * @param 'usecache'        boolean switches the use of the cache on (true)
75  *                          or off (false). If you want to avoid the
76  *                          usage of a cache but need WikiPlugin~s
77  *                          that nevertheless rely on a cache you might set
78  *                          'usecache' to false. You still need to set
79  *                          'cache_dir' appropriately to allow image creation
80  *                          and you should set 'force_syncmap' to false.
81  * @param 'force_syncmap'   boolean Will prevent image creation for an image 
82  *                          map 'on demand'. It is a good idea to set this
83  *                          to 'true' because it will also prevent the 
84  *                          html part not to fit to the image of the map.
85  *                          If you don't use a cache, you have to set it
86  *                          to 'false', maps will not work otherwise but
87  *                          strange  effects may happen if the output of
88  *                          an image map producing WikiPlugin is not 
89  *                          completely determined by its parameters.
90  *                          (As it is the case for a graphical site map.)
91  */   
92 $CacheParams = array(
93     // db settings (database='file' is the fastest)
94         'database'        => 'file',
95     // the webserver muist have write access to this dir!
96         'cache_dir'       => (substr(PHP_OS,0,3) == 'WIN') 
97                                ? ($GLOBALS['HTTP_ENV_VARS']['TEMP'] . "\\cache\\")
98                                : '/tmp/cache/',
99         'filename_prefix' => 'phpwiki',
100
101     // When highwater is exceeded, a garbage collection will start. 
102     // It will collect garbage till lowwater is reached.
103         'highwater'       => 4 * Megabyte,
104         'lowwater'        => 3 * Megabyte,
105
106     // If an image has not been used for maxlifetime remove it from
107     // the cache.
108     // (Since there is also the highwater/lowwater mechanism
109     //  and an image usually requires only 1kb you don't have to
110     //  make it very small, I think.)
111         'maxlifetime'     => 30 * Day,
112
113     // name of the imagecache start up file
114     // This file should have been created by hand by copying
115     // phpwiki/index.php and substituting 
116     //    include "lib/main.php";
117     // by 
118     //    include "lib/imagecache.php";
119     //
120     //'cacheurl'        => '../imagecache/',
121     'cacheurl'        => '/phpwiki-dev-data/getimg.php?',
122
123     // usually send plugin arguments as URL, but when they become
124     // longer than maxarglen store them in session variables    
125     // setting it to 3000 worked fine for me, 30000 completely
126     // crashed my linux, 1000 should be safe.
127         'maxarglen'       => 1000,
128
129     // actually use the cache 
130     // (should be always true unless you are debugging)
131         'usecache'        => true,
132
133     //   This will prevent image creation for an image 
134     // map 'on demand'. It is a good idea to set this
135     // to 'true' because it will also prevent the 
136     // html part not to fit to the image of the map.
137     //   If you don't use a cache, you have to set it
138     // to 'false', maps will not work otherwise.
139         'force_syncmap'   => true,
140
141     // if ImageTypes() does not exist (PHP < 4.0.2) allow the
142     // following image formats (IMG_PNG | IMG_GIF | IMG_JPG | IMG_WBMP)
143         // in principal all image types which are compiled into php: 
144         //   libgd, libpng, libjpeg, libungif, libtiff, libgd2, ...
145         'imgtypes'        =>  array('png','gif','gd','gd2','jpeg','wbmp','xbm','xpm')
146         // Todo: swf, pdf, ...
147
148 );
149 ?>