*/ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'admin.php'); define('CACHEREVISIONSERASER_VER','1.6.6'); define('CACHEREVISIONSERASER_CONFIGREVISION',2); define('CACHEREVISIONSERASER_DATE','2010-11-22'); /** * All DokuWiki plugins to extend the admin function * need to inherit from this class */ class admin_plugin_cacherevisionserase extends DokuWiki_Admin_Plugin { var $cachedir = null; var $revisdir = null; var $pagesdir = null; var $metadir = null; var $configs = null; var $filedels = 0; var $dirdels = 0; /** * Constructor */ function admin_plugin_cacherevisionserase(){ $this->setupLocale(); @include(dirname(__FILE__).'/configs.php'); } /** * Return plug-in info */ function getInfo(){ return array( 'author' => 'JustBurn', 'email' => 'justburner@armail.pt', 'date' => CACHEREVISIONSERASER_DATE, 'name' => html_entity_decode($this->lang['title']), 'desc' => html_entity_decode($this->lang['desc']), 'url' => 'http://wiki.splitbrain.org/plugin:cacherevisionseraser', ); } /** * Return prompt for admin menu */ function getMenuText($language) { return $this->lang['menu'] . ' (v' . CACHEREVISIONSERASER_VER . ')'; } /** * Return sort order for position in admin menu */ function getMenuSort() { if ($this->configs['menusort'] == null) return 67; else return $this->configs['menusort']; } /** * Handle user request */ function handle() { global $conf; $this->cachedir = $conf['cachedir']; $this->revisdir = $conf['olddir']; $this->pagesdir = $conf['datadir']; if ($this->pagesdir == $null) $this->pagesdir = $conf['savedir']; // Olders versions compability? $this->metadir = $conf['metadir']; if ($this->metadir == $null) $this->metadir = $conf['meta']; // Olders versions compability? $this->locksdir = $conf['lockdir']; if ($this->locksdir == $null) $this->locksdir = $this->pagesdir; // Olders versions compability? $this->lang_id = $conf['lang']; if (!($this->configs['confrevision'] > 0)) $this->configs['confrevision'] = 0; $this->locktime = $conf['locktime']; } /** * Get request variable */ function get_req($reqvar, $defaultval) { if (isset($_REQUEST[$reqvar])) { return $_REQUEST[$reqvar]; } else { return $defaultval; } } /** * Compare request variable */ function cmp_req($reqvar, $strtocmp, $onequal, $ondifferent) { if (isset($_REQUEST[$reqvar])) { return strcmp($_REQUEST[$reqvar], $strtocmp) ? $ondifferent : $onequal; } else { return $ondifferent; } } /** * Output appropriate html */ function html() { global $ID; global $lang; global $cacherevercfg; global $conf; $cmd = $this->get_req('cmd', 'main'); // Plug-in title ptln('

'.$this->lang['title'].' '.$this->lang['version'].' '.CACHEREVISIONSERASER_VER.'

'); // Make sure outputinfo level is valid $theoutputinfo = intval($this->get_req('level_outputinfo', 0)); if ($this->configs['allow_outputinfo']) { if (($theoutputinfo < 0) || ($theoutputinfo > 2)) $theoutputinfo = 0; } else { $theoutputinfo = intval($this->configs['level_outputinfo']); } // Debugging only if ($this->configs['debuglist']) { ptln(''); ptln(''); ptln('
Debugging information
'); ptln('config revision: '.$this->configs['confrevision'].' (require '.CACHEREVISIONSERASER_CONFIGREVISION.')
'); ptln('admin menu position: '.$this->configs['menusort'].'
'); ptln('language (C/R E.): '.$this->lang['language'].'
'); ptln('cachedir: '.$this->cachedir.'
'); ptln('revisdir: '.$this->revisdir.'
'); ptln('pagesdir: '.$this->pagesdir.'
'); ptln('metadir: '.$this->metadir.'
'); ptln('locksdir: '.$this->locksdir.'
'); ptln('language id (Doku): '.$this->lang_id.'
'); ptln('

'); } // Plug-in processing... $this->filedels = 0; $this->dirdels = 0; if ($this->analyzecrpt($cmd)) if ((strcmp($cmd, 'erasecache') == 0) && ($this->configs['allow_allcachedel'])) { // Erase cache... ptln(''); ptln(''); if ($succop) ptln(''); else ptln(''); ptln('
'); clearstatcache(); $succop = true; $params = $this->cmp_req('delfl_UNK', 'yes', 0x01, 0) + $this->cmp_req('del_indexing', 'yes', 0x02, 0) + $this->cmp_req('delfl_i', 'yes', 0x04, 0) + $this->cmp_req('delfl_xhtml', 'yes', 0x08, 0) + $this->cmp_req('delfl_js', 'yes', 0x10, 0) + $this->cmp_req('delfl_css', 'yes', 0x20, 0) + $this->cmp_req('delfl_mediaP', 'yes', 0x40, 0); $prmask = ($this->configs['cache_delext_UNK']==0 ? 0 : 0x01) + ($this->configs['cache_del_indexing']==0 ? 0 : 0x02) + ($this->configs['cache_delext_i']==0 ? 0 : 0x04) + ($this->configs['cache_delext_xhtml']==0 ? 0 : 0x08) + ($this->configs['cache_delext_js']==0 ? 0 : 0x10) + ($this->configs['cache_delext_css']==0 ? 0 : 0x20) + ($this->configs['cache_delext_mediaP']==0 ? 0 : 0x40); if ($this->cmp_req('del_oldpagelocks', 'yes', true, false) && ($this->configs['cache_del_oldlocks'])) { if ($this->rmeverything_oldlockpages($this->locksdir, $this->locksdir, $theoutputinfo) == false) $succop = false; } if ($this->rmeverything_cache($this->cachedir, $this->cachedir, $params & $prmask, $theoutputinfo) == false) $succop = false; ptln(''.$this->lang['numfilesdel'].' '.$this->filedels.'
'.$this->lang['numdirsdel'].' '.$this->dirdels.'

'); ptln('
'.$this->lang['successcache'].'
'.$this->lang['failedcache'].'
'); ptln(''); ptln('
'); ptln('
'); ptln(''); ptln(''); ptln(''); ptln(''); ptln('
'); } else if ((strcmp($cmd, 'eraseallrevisions') == 0) && ($this->configs['allow_allrevisdel'])) { // Erase old revisions... ptln(''); ptln(''); if ($succop) ptln(''); else ptln(''); ptln('
'); clearstatcache(); $succop = true; if ($this->cmp_req('del_metafiles', 'yes', true, false) && ($this->configs['cache_del_metafiles'])) { if ($this->rmeverything_meta($this->metadir, $this->metadir, $theoutputinfo) == false) $succop = false; } if ($this->cmp_req('del_revisfiles', 'yes', true, false) && ($this->configs['cache_del_revisfiles'])) { if ($this->rmeverything_revis($this->revisdir, $this->revisdir, $theoutputinfo) == false) $succop == false; } ptln(''.$this->lang['numfilesdel'].' '.$this->filedels.'
'.$this->lang['numdirsdel'].' '.$this->dirdels.'

'); ptln('
'.$this->lang['successrevisions'].'
'.$this->lang['failedrevisions'].'
'); ptln(''); ptln('
'); ptln('
'); ptln(''); ptln(''); ptln(''); ptln(''); ptln('
'); } else { // Controls ptln(''); ptln(''); ptln('
'); if ($this->configs['allow_allcachedel']) { ptln($this->lang['cachedesc'].'

'); ptln('
'); ptln(''); ptln(''); ptln(''); if ($this->configs['cache_delext_i'] < 0) ptln('configs['cache_delext_i']+2) ? 'checked="checked"' : '').' /> '.$this->lang['extdesc_i'].'
'); else ptln('configs['cache_delext_i'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['extdesc_i'].'
'); if ($this->configs['cache_delext_xhtml'] < 0) ptln('configs['cache_delext_xhtml']+2) ? 'checked="checked"' : '').' /> '.$this->lang['extdesc_xhtml'].'
'); else ptln('configs['cache_delext_xhtml'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['extdesc_xhtml'].'
'); if ($this->configs['cache_delext_js'] < 0) ptln('configs['cache_delext_js']+2) ? 'checked="checked"' : '').' /> '.$this->lang['extdesc_js'].'
'); else ptln('configs['cache_delext_js'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['extdesc_js'].'
'); if ($this->configs['cache_delext_css'] < 0) ptln('configs['cache_delext_css']+2) ? 'checked="checked"' : '').' /> '.$this->lang['extdesc_css'].'
'); else ptln('configs['cache_delext_css'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['extdesc_css'].'
'); if ($this->configs['cache_delext_mediaP'] < 0) ptln('configs['cache_delext_mediaP']+2) ? 'checked="checked"' : '').' /> '.$this->lang['extdesc_mediaP'].'
'); else ptln('configs['cache_delext_mediaP'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['extdesc_mediaP'].'
'); if ($this->configs['cache_delext_UNK'] < 0) ptln('configs['cache_delext_UNK']+2) ? 'checked="checked"' : '').' /> '.$this->lang['extdesc_UNK'].'
'); else ptln('configs['cache_delext_UNK'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['extdesc_UNK'].'
'); if ($this->configs['cache_del_oldlocks'] < 0) ptln('configs['cache_del_oldlocks']+2) ? 'checked="checked"' : '').' /> '.$this->lang['deloldlockdesc'].'
'); else ptln('configs['cache_del_oldlocks'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['deloldlockdesc'].'
'); if ($this->configs['cache_del_indexing'] < 0) ptln('configs['cache_del_indexing']+2) ? 'checked="checked"' : '').' /> '.$this->lang['delindexingdesc'].'
'); else ptln('configs['cache_del_indexing'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['delindexingdesc'].'
'); ptln('
'); if ($this->configs['allow_outputinfo']) { ptln($this->lang['outputinfo_text'].' configs['level_outputinfo']==0 ? 'checked="checked"' : '').' />'.$this->lang['outputinfo_lvl0']); ptln('configs['level_outputinfo']==1 ? 'checked="checked"' : '').' />'.$this->lang['outputinfo_lvl1']); ptln('configs['level_outputinfo']==2 ? 'checked="checked"' : '').' />'.$this->lang['outputinfo_lvl2']); } else { if ($this->configs['level_outputinfo'] == 0) { ptln(''.$this->lang['outputinfo_text'].' '.$this->lang['outputinfo_lvl0']); } else if ($this->configs['level_outputinfo'] == 1) { ptln(''.$this->lang['outputinfo_text'].' '.$this->lang['outputinfo_lvl1']); } else if ($this->configs['level_outputinfo'] == 2) { ptln(''.$this->lang['outputinfo_text'].' '.$this->lang['outputinfo_lvl2']); } } ptln('

'); ptln('
'); } else { ptln($this->lang['cachedisabled'].'
'); } ptln('
 
'); if ($this->configs['allow_allrevisdel']) { ptln($this->lang['revisionsdesc'].'

'); ptln('
'); ptln(''); ptln(''); ptln(''); if ($this->configs['cache_del_metafiles'] < 0) ptln('configs['cache_del_metafiles']+2) ? 'checked="checked"' : '').' /> '.$this->lang['delmetadesc'].'
'); else ptln('configs['cache_del_metafiles'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['delmetadesc'].'
'); if ($this->configs['cache_del_revisfiles'] < 0) ptln('configs['cache_del_revisfiles']+2) ? 'checked="checked"' : '').' /> '.$this->lang['delrevisdesc'].'
'); else ptln('configs['cache_del_revisfiles'] ? 'checked="checked"' : '').' disabled /> '.$this->lang['delrevisdesc'].'
'); ptln('
'); if ($this->configs['allow_outputinfo']) { ptln($this->lang['outputinfo_text'].' configs['level_outputinfo']==0 ? 'checked="checked"' : '').' />'.$this->lang['outputinfo_lvl0']); ptln('configs['level_outputinfo']==1 ? 'checked="checked"' : '').' />'.$this->lang['outputinfo_lvl1']); ptln('configs['level_outputinfo']==2 ? 'checked="checked"' : '').' />'.$this->lang['outputinfo_lvl2']); } else { if ($this->configs['level_outputinfo'] == 0) { ptln(''.$this->lang['outputinfo_text'].' '.$this->lang['outputinfo_lvl0']); } else if ($this->configs['level_outputinfo'] == 1) { ptln(''.$this->lang['outputinfo_text'].' '.$this->lang['outputinfo_lvl1']); } else if ($this->configs['level_outputinfo'] == 2) { ptln(''.$this->lang['outputinfo_text'].' '.$this->lang['outputinfo_lvl2']); } } ptln('

'); ptln('
'.$this->lang['revisionswarn'].'
'); ptln('
'); } else { ptln($this->lang['revisdisabled'].'
'); } ptln('
'); } ptln('
'.$this->lang['searchyounewversionurl'].' [English only]
'); } /** * Delete all files into cache directory */ function rmeverything_cache($fileglob, $basedir, $params, $outputinfo) { $fileglob2 = substr($fileglob, strlen($basedir)); if (strpos($fileglob, '*') !== false) { foreach (glob($fileglob) as $filename) { $this->rmeverything_cache($filename, $basedir, $params, $outputinfo); } } else if (is_file($fileglob)) { if (strcmp($fileglob2, '/_dummy') == 0) return true; $pathinfor = pathinfo($fileglob2); if (strcmp($basedir, dirname($fileglob)) == 0) { if (!($params & 0x02)) return true; } else { if (substr_count(strtolower($pathinfor['basename']), '.media.') > 0) { if (!($params & 0x40)) return true; } else if (strcmp(strtolower($pathinfor['extension']), 'i') == 0) { if (!($params & 0x04)) return true; } else if (strcmp(strtolower($pathinfor['extension']), 'xhtml') == 0) { if (!($params & 0x08)) return true; } else if (strcmp(strtolower($pathinfor['extension']), 'js') == 0) { if (!($params & 0x10)) return true; } else if (strcmp(strtolower($pathinfor['extension']), 'css') == 0) { if (!($params & 0x20)) return true; } else { if (!($params & 0x01)) return true; } } if (@unlink($fileglob)) { if ($outputinfo > 0) ptln(''.$this->lang['deletefile'].''.(($outputinfo==2) ? ' ('.$this->lang['cache_word'].') ' : ' ').'"'.$fileglob2.'".
'); $this->filedels++; return true; } else { if ($outputinfo > 0) ptln(''.$this->lang['deletefileerr'].''.(($outputinfo==2) ? ' ('.$this->lang['cache_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } } else if (is_dir($fileglob)) { $ok = $this->rmeverything_cache($fileglob.'/*', $basedir, $params, $outputinfo); if (!$ok) return false; if (strcmp($fileglob, $basedir) == 0) return true; if (@rmdir($fileglob)) { if ($outputinfo > 0) ptln(''.$this->lang['deletedir'].''.(($outputinfo==2) ? ' ('.$this->lang['cache_word'].') ' : ' ').'"'.$fileglob2.'".
'); $this->dirdels++; return true; } else { return true; } } else { // Woha, this shouldn't never happen... if ($outputinfo > 0) ptln(''.$this->lang['pathclasserror'].''.(($outputinfo==2) ? ' ('.$this->lang['cache_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } return true; } /** * Delete all old lost locks into "data/pages" or "data/locks" directory */ function rmeverything_oldlockpages($fileglob, $basedir, $outputinfo) { $fileglob2 = substr($fileglob, strlen($basedir)); if (strpos($fileglob, '*') !== false) { foreach (glob($fileglob) as $filename) { $this->rmeverything_oldlockpages($filename, $basedir, $outputinfo); } } else if (is_file($fileglob)) { if (strcmp($fileglob2, '/_dummy') == 0) return true; $pathinfor = pathinfo($fileglob2); if (strcmp(strtolower($pathinfor['extension']), 'lock') != 0) return true; if (time()-@filemtime($fileglob) < $this->locktime) { if ($outputinfo > 0) ptln(''.$this->lang['lockexpirein'].' '.($this->locktime-(time()-@filemtime($fileglob))).' '.$this->lang['seconds'].' -> "'.$fileglob2.'".
'); return true; } if (@unlink($fileglob)) { if ($outputinfo > 0) ptln(''.$this->lang['deletefile'].''.(($outputinfo==2) ? ' ('.$this->lang['lock_word'].') ' : ' ').'"'.$fileglob2.'".
'); $this->filedels++; return true; } else { if ($outputinfo > 0) ptln(''.$this->lang['deletefileerr'].''.(($outputinfo==2) ? ' ('.$this->lang['lock_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } } else if (is_dir($fileglob)) { $ok = $this->rmeverything_oldlockpages($fileglob.'/*', $basedir, $outputinfo); if (!$ok) return false; if (strcmp($fileglob, $basedir) == 0) return true; if (@rmdir($fileglob)) { if ($outputinfo > 0) ptln(''.$this->lang['deletedir'].''.(($outputinfo==2) ? ' ('.$this->lang['lock_word'].') ' : ' ').'"'.$fileglob2.'".
'); $this->dirdels++; return true; } else { return true; } } else { // Woha, this shouldn't never happen... if ($outputinfo > 0) ptln(''.$this->lang['pathclasserror'].''.(($outputinfo==2) ? ' ('.$this->lang['lock_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } return true; } /** * Delete all files into meta directory */ function rmeverything_meta($fileglob, $basedir, $outputinfo) { $fileglob2 = substr($fileglob, strlen($basedir)); if (strpos($fileglob, '*') !== false) { foreach (glob($fileglob) as $filename) { $this->rmeverything_meta($filename, $basedir, $outputinfo); } } else if (is_file($fileglob)) { if (strcmp($fileglob2, '/_dummy') == 0) return true; $pathinfor = pathinfo($fileglob2); // For compatibility with the following: if (strcmp(strtolower($pathinfor['extension']), 'comments') == 0) return true; // Discussion Plugin if (strcmp(strtolower($pathinfor['extension']), 'doodle') == 0) return true; // Doodle & Doodle2 Plugins if (@unlink($fileglob)) { if ($outputinfo > 0) ptln(''.$this->lang['deletefile'].''.(($outputinfo==2) ? ' ('.$this->lang['meta_word'].') ' : ' ').'"'.$fileglob2.'".
'); $this->filedels++; return true; } else { if ($outputinfo > 0) ptln(''.$this->lang['deletefileerr'].''.(($outputinfo==2) ? ' ('.$this->lang['meta_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } } else if (is_dir($fileglob)) { $ok = $this->rmeverything_meta($fileglob.'/*', $basedir, $outputinfo); if (!$ok) return false; if (strcmp($fileglob, $basedir) == 0) return true; if (@rmdir($fileglob)) { if ($outputinfo > 0) ptln(''.$this->lang['deletedir'].''.(($outputinfo==2) ? ' ('.$this->lang['meta_word'].') ' : ' ').'"'.$fileglob2.'".
'); $this->dirdels++; return true; } else { if ($outputinfo > 0) ptln(''.$this->lang['deletedirerr'].''.(($outputinfo==2) ? ' ('.$this->lang['meta_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } } else { // Woha, this shouldn't never happen... if ($outputinfo > 0) ptln(''.$this->lang['pathclasserror'].''.(($outputinfo==2) ? ' ('.$this->lang['meta_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } return true; } /** * Delete all files into old revisions directory */ function rmeverything_revis($fileglob, $basedir, $outputinfo) { $fileglob2 = substr($fileglob, strlen($basedir)); if (strpos($fileglob, '*') !== false) { foreach (glob($fileglob) as $filename) { $this->rmeverything_revis($filename, $basedir, $outputinfo); } } else if (is_file($fileglob)) { if (strcmp($fileglob2, '/_dummy') == 0) return true; if (@unlink($fileglob)) { if ($outputinfo > 0) ptln(''.$this->lang['deletefile'].''.(($outputinfo==2) ? ' ('.$this->lang['revis_word'].') ' : ' ').'"'.$fileglob2.'".
'); $this->filedels++; return true; } else { if ($outputinfo > 0) ptln(''.$this->lang['deletefileerr'].''.(($outputinfo==2) ? ' ('.$this->lang['revis_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } } else if (is_dir($fileglob)) { $ok = $this->rmeverything_revis($fileglob.'/*', $basedir, $outputinfo); if (!$ok) return false; if (strcmp($fileglob, $basedir) == 0) return true; if (@rmdir($fileglob)) { if ($outputinfo > 0) ptln(''.$this->lang['deletedir'].''.(($outputinfo==2) ? ' ('.$this->lang['revis_word'].') ' : ' ').'"'.$fileglob2.'".
'); $this->dirdels++; return true; } else { if ($outputinfo > 0) ptln(''.$this->lang['deletedirerr'].''.(($outputinfo==2) ? ' ('.$this->lang['revis_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } } else { // Woha, this shouldn't never happen... if ($outputinfo > 0) ptln(''.$this->lang['pathclasserror'].''.(($outputinfo==2) ? ' ('.$this->lang['revis_word'].') ' : ' ').'"'.$fileglob2.'".
'); return false; } return true; } /** * Routine to analyze configurations and directories */ function analyzecrpt($cmd) { global $ID; $analizysucessy = true; if ($this->configs['confrevision'] == 0) { ptln(''.$this->lang['analyze_confmissingfailed'].' (ERR: 1)
'); $analizysucessy = false; } if (($this->configs['confrevision'] != CACHEREVISIONSERASER_CONFIGREVISION) && ($analizysucessy)) { ptln(''.$this->lang['analyze_confrevisionfailed'].' (ERR: 2)
'); $analizysucessy = false; } if ($analizysucessy == false) { if (strcmp($cmd, 'createconf') == 0) { $this->writeconfigs(); ptln(''.$this->lang['analyze_creatingdefconfs']); if (file_exists(dirname(__FILE__).'/configs.php')) { ptln($this->lang['analyze_creatingdefconfs_o']); } else ptln($this->lang['analyze_creatingdefconfs_x']); ptln('

'); ptln(''); ptln(''); ptln(''); ptln(''); ptln('

'); } else { ptln('
'); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln('
 '.$this->lang['wordb_option'].''.$this->lang['wordb_optiondesc'].'
'); ptln(''.$this->lang['cfgdesc_menusort'].'
'); ptln(''.$this->lang['wordb_enable'].''.$this->lang['wordb_optiondesc'].'
'); ptln(''.$this->lang['delxcacheclass'].'
'); ptln(''.$this->lang['delxrevisclass'].'
'); ptln(''.$this->lang['delxdebugmode'].'
'.$this->lang['wordb_allowuserchag'].''.$this->lang['wordb_checkedasdef'].''.$this->lang['wordb_optiondesc'].'
' . $this->lang['extdesc_i'] . '
' . $this->lang['extdesc_xhtml'] . '
' . $this->lang['extdesc_js'] . '
' . $this->lang['extdesc_css'] . '
' . $this->lang['extdesc_mediaP'] . '
' . $this->lang['extdesc_UNK'] . '
' . $this->lang['deloldlockdesc'] . '
' . $this->lang['delindexingdesc'] . '
' . $this->lang['delmetadesc'] . '
' . $this->lang['delrevisdesc'] . '
'.$this->lang['outputinfo_lvl0'].'
'); ptln(''.$this->lang['outputinfo_lvl1'].'
'); ptln(''.$this->lang['outputinfo_lvl2']); ptln('
'.$this->lang['delxverbose'].'
'); ptln('
'); } } if (!is_dir($this->cachedir)) { ptln(''.$this->lang['analyze_cachedirfailed'].' (ERR: 3)
'); $analizysucessy = false; } if (!is_dir($this->revisdir)) { ptln(''.$this->lang['analyze_revisdirfailed'].' (ERR: 4)
'); $analizysucessy = false; } if (!is_dir($this->pagesdir)) { ptln(''.$this->lang['analyze_pagesdirfailed'].' (ERR: 5)
'); $analizysucessy = false; } if (!is_dir($this->metadir)) { ptln(''.$this->lang['analyze_metadirfailed'].' (ERR: 6)
'); $analizysucessy = false; } if (!is_dir($this->locksdir)) { ptln(''.$this->lang['analyze_locksdirfailed'].' (ERR: 7)
'); $analizysucessy = false; } if ($analizysucessy == false) { ptln('
'.$this->lang['analyze_checkreadme'].'
'); } return $analizysucessy; } /** * Routine to create "configs.php" */ function writeconfigs() { global $lang; $cahdelext_i = -2 + $this->cmp_req('delext_i_A', 'yes', 0, 2) + $this->cmp_req('delext_i_C', 'yes', 1, 0); $cahdelext_xhtml = -2 + $this->cmp_req('delext_xhtml_A', 'yes', 0, 2) + $this->cmp_req('delext_xhtml_C', 'yes', 1, 0); $cahdelext_js = -2 + $this->cmp_req('delext_js_A', 'yes', 0, 2) + $this->cmp_req('delext_js_C', 'yes', 1, 0); $cahdelext_css = -2 + $this->cmp_req('delext_css_A', 'yes', 0, 2) + $this->cmp_req('delext_css_C', 'yes', 1, 0); $cahdelext_mediaP = -2 + $this->cmp_req('delext_mediaP_A', 'yes', 0, 2) + $this->cmp_req('delext_mediaP_C', 'yes', 1, 0); $cahdelext_UNK = -2 + $this->cmp_req('delext_UNK_A', 'yes', 0, 2) + $this->cmp_req('delext_UNK_C', 'yes', 1, 0); $cahdel_oldlocks = -2 + $this->cmp_req('del_oldlock_A', 'yes', 0, 2) + $this->cmp_req('del_oldlock_C', 'yes', 1, 0); $cahdel_indexing = -2 + $this->cmp_req('del_indexing_A', 'yes', 0, 2) + $this->cmp_req('del_indexing_C', 'yes', 1, 0); $cahdel_metafiles = -2 + $this->cmp_req('del_meta_A', 'yes', 0, 2) + $this->cmp_req('del_meta_C', 'yes', 1, 0); $cahdel_revisfiles = -2 + $this->cmp_req('del_revis_A', 'yes', 0, 2) + $this->cmp_req('del_revis_C', 'yes', 1, 0); $wcnf = fopen(dirname(__FILE__).'/configs.php', 'w'); fwrite($wcnf, "\n *\n *\n"); fwrite($wcnf, " * Generated automatically by the plug-in, Cache/Revisions Eraser v" . CACHEREVISIONSERASER_VER . "\n *\n */\n\n"); fwrite($wcnf, '$this->configs[\'confrevision\'] = 2;' . "\n"); if ((intval($this->get_req('menusort','67')) >= 0) && (intval($this->get_req('menusort','67')) <= 99)) fwrite($wcnf, '$this->configs[\'menusort\'] = ' . intval($this->get_req('menusort','67')) . ";\n"); else fwrite($wcnf, '$this->configs[\'menusort\'] = 67' . ";\n"); fwrite($wcnf, '$this->configs[\'allow_allcachedel\'] = ' . $this->cmp_req('allow_allcachedel_E', 'yes', 'true', 'false') . ";\n"); fwrite($wcnf, '$this->configs[\'allow_allrevisdel\'] = ' . $this->cmp_req('allow_allrevisdel_E', 'yes', 'true', 'false') . ";\n"); fwrite($wcnf, '$this->configs[\'debuglist\'] = ' . $this->cmp_req('allow_debug_E', 'yes', 'true', 'false') . ";\n"); fwrite($wcnf, '$this->configs[\'cache_delext_i\'] = ' . $cahdelext_i . ";\n"); fwrite($wcnf, '$this->configs[\'cache_delext_xhtml\'] = ' . $cahdelext_xhtml . ";\n"); fwrite($wcnf, '$this->configs[\'cache_delext_js\'] = ' . $cahdelext_js . ";\n"); fwrite($wcnf, '$this->configs[\'cache_delext_css\'] = ' . $cahdelext_css . ";\n"); fwrite($wcnf, '$this->configs[\'cache_delext_mediaP\'] = ' . $cahdelext_mediaP . ";\n"); fwrite($wcnf, '$this->configs[\'cache_delext_UNK\'] = ' . $cahdelext_UNK . ";\n"); fwrite($wcnf, '$this->configs[\'cache_del_oldlocks\'] = ' . $cahdel_oldlocks . ";\n"); fwrite($wcnf, '$this->configs[\'cache_del_indexing\'] = ' . $cahdel_indexing . ";\n"); fwrite($wcnf, '$this->configs[\'cache_del_metafiles\'] = ' . $cahdel_metafiles . ";\n"); fwrite($wcnf, '$this->configs[\'cache_del_revisfiles\'] = ' . $cahdel_revisfiles . ";\n"); fwrite($wcnf, '$this->configs[\'allow_outputinfo\'] = ' . $this->cmp_req('allow_outputinfo', 'yes', 'true', 'false') . ";\n"); if ((intval($this->get_req('level_outputinfo','0')) >= 0) && (intval($this->get_req('level_outputinfo','0')) <= 2)) fwrite($wcnf, '$this->configs[\'level_outputinfo\'] = ' . intval($this->get_req('level_outputinfo','0')) . ";\n"); else fwrite($wcnf, '$this->configs[\'level_outputinfo\'] = 0'.";\n"); fwrite($wcnf, "\n\n?>"); fclose($wcnf); } } ?>