1 <?php rcs_id('$Id: plugincache-config.php,v 1.6 2004-06-16 21:27:33 rurban Exp $');
3 Copyright (C) 2002 Johannes Große (Johannes Große)
5 This file is part of PhpWiki.
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.
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.
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
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']
27 * @author Johannes Große
32 * translate kilobyte and megabyte into bytes and day into seconds
34 define('Kilobyte', 1024);
35 define('Megabyte', 1024*1024);
36 define('Day', 24 * 60 * 60 );
41 * Contains the global cache configuration settings.
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
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
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.)
94 // db settings (database='file' is the fastest)
96 // the webserver must have write access to this dir!
97 'cache_dir' => '/tmp/cache/',
98 'filename_prefix' => 'phpwiki',
100 // When highwater is exceeded, a garbage collection will start.
101 // It will collect garbage till lowwater is reached.
102 'highwater' => 4 * Megabyte,
103 'lowwater' => 3 * Megabyte,
105 // If an image has not been used for maxlifetime remove it from
107 // (Since there is also the highwater/lowwater mechanism
108 // and an image usually requires only 1kb you don't have to
109 // make it very small, I think.)
110 'maxlifetime' => 30 * Day,
112 // name of the imagecache start up file
113 // This file should have been created by hand by copying
114 // phpwiki/index.php and substituting
115 // include "lib/main.php";
117 // include "lib/imagecache.php";
119 //'cacheurl' => '../imagecache/',
120 'cacheurl' => DATA_PATH . '/getimg.php?',
122 // usually send plugin arguments as URL, but when they become
123 // longer than maxarglen store them in session variables
124 // setting it to 3000 worked fine for me, 30000 completely
125 // crashed my linux, 1000 should be safe.
128 // actually use the cache
129 // (should be always true unless you are debugging)
132 // This will prevent image creation for an image
133 // map 'on demand'. It is a good idea to set this
134 // to 'true' because it will also prevent the
135 // html part not to fit to the image of the map.
136 // If you don't use a cache, you have to set it
137 // to 'false', maps will not work otherwise.
138 'force_syncmap' => true,
140 // if ImageTypes() does not exist (PHP < 4.0.2) allow the
141 // following image formats (IMG_PNG | IMG_GIF | IMG_JPG | IMG_WBMP)
142 // in principal all image types which are compiled into php:
143 // libgd, libpng, libjpeg, libungif, libtiff, libgd2, ...
144 'imgtypes' => array('png','gif','gd','gd2','jpeg','wbmp','xbm','xpm')
145 // Todo: swf, pdf, ...
148 if (!file_exists($CacheParams['cache_dir']) and substr(PHP_OS,0,3) == 'WIN') {
149 if (isset($GLOBALS['HTTP_ENV_VARS']['TEMP']))
150 $CacheParams['cache_dir'] = $GLOBALS['HTTP_ENV_VARS']['TEMP'] . "\\cache\\";
152 $CacheParams['cache_dir'] = "\\TEMP\\cache\\";