diff options
| -rw-r--r-- | editconfig_gedcom.php | 4 | ||||
| -rw-r--r-- | editnews.php | 1 | ||||
| -rw-r--r-- | help_text.php | 10 | ||||
| -rw-r--r-- | includes/functions/functions_import.php | 4 | ||||
| -rw-r--r-- | includes/index_cache.php | 155 | ||||
| -rw-r--r-- | index.php | 7 | ||||
| -rw-r--r-- | index_edit.php | 11 | ||||
| -rw-r--r-- | modules/gedcom_favorites/module.php | 2 | ||||
| -rw-r--r-- | modules/gedcom_news/module.php | 10 | ||||
| -rw-r--r-- | modules/user_favorites/module.php | 2 |
10 files changed, 0 insertions, 206 deletions
diff --git a/editconfig_gedcom.php b/editconfig_gedcom.php index 6fc896baa8..b7eebd0c1c 100644 --- a/editconfig_gedcom.php +++ b/editconfig_gedcom.php @@ -375,10 +375,6 @@ case 'update': } - //-- delete the cache files for the Home Page blocks - require_once WT_ROOT.'includes/index_cache.php'; - clearCache(); - if (!$errors) { $gednews = getUserNews(WT_GEDCOM); if (count($gednews)==0) { diff --git a/editnews.php b/editnews.php index ffbb54d123..51a1039dda 100644 --- a/editnews.php +++ b/editnews.php @@ -110,7 +110,6 @@ if ($action=="compose") { $message["id"]=$news_id; } $message["username"] = $username; - if ($username==$GEDCOM) $_SESSION['clearcache'] = true; $message["date"]=$date; $message["title"] = $title; $message["text"] = $text; diff --git a/help_text.php b/help_text.php index 84bcfa8200..f4f6f103e1 100644 --- a/help_text.php +++ b/help_text.php @@ -3237,11 +3237,6 @@ case 'box_width': $text=i18n::translate('Here you can change the box width from 50 percent to 300 percent. At 100 percent each box is about 270 pixels wide.'); break; -case 'cache_life': - $title=i18n::translate('Cache file life'); - $text=i18n::translate('To improve performance, this <b>webtrees</b> Home Page block is saved as a cache file. You can control how often this block\'s cache file is refreshed.<br /><br /><ul><li><b>-1</b> means that the cache file is never refreshed automatically. To get a fresh copy, you need to delete all cache files. You can do this on the Customize Home Page screen.</li><li><b>0</b> (Zero) means that this block is never cached, and every time the block is displayed on the webtrees Home Page, you see a fresh copy. This setting is used automatically for blocks that change frequently, such as the Logged In Users and the Random Media blocks.</li><li><b>1</b> (One) means that a fresh copy of this block\'s cache file is created daily, <b>2</b> means that a fresh copy is created every two days, <b>7</b> means that a fresh copy is created weekly, etc.</li></ul>'); - break; - case 'change_indi2id': $title=i18n::translate('Change individual ID to ....'); $text=i18n::translate('This tool was designed for users whose Genealogy programs use a different GEDCOM ID for the individuals every time the GEDCOM is exported. For example, the first time the GEDCOM is exported some person\'s ID might be I100 but the next time the GEDCOM is exported that same person\'s ID is changed to I234. These changing IDs make it difficult to administer <b>webtrees</b> because the ID is how people are referenced.<br /><br />Most genealogy programs also use the RIN or REFN tag to give each person a unique identifier that can be used to reference the individual. This tool will replace all of the individual IDs in the GEDCOM file with the whatever field (RIN or REFN) you specify.'); @@ -3267,11 +3262,6 @@ case 'cleanup_places': $text=i18n::translate('<b>webtrees</b> detected that your GEDCOM file uses places on GEDCOM tags that should not have places.<br /><br />Many genealogy programs, such as Family Tree Maker, will create this type of GEDCOM file. <b>webtrees</b> will work with these GEDCOM files, but some invalid places will show up in your place hierarchy. <br /><br />For example, your GEDCOM might have the following encoding<br />1 SSN<br />2 PLAC 123-45-6789<br />1 OCCU<br />2 PLAC Computer Programmer<br /><br />According to the GEDCOM 5.5.1 Standard this should really be shown as<br />1 SSN 123-45-6789<br />1 OCCU Computer Programmer<br /><br />If you select <b>Yes</b>, <b>webtrees</b> will automatically correct these encoding errors.'); break; -case 'clear_cache': - $title=i18n::translate('Clear cache files'); - $text=i18n::translate('In order to improve performance, several of the blocks on the <b>webtrees</b> Home Page are saved as cache files in the index directory. The cache files for most blocks are refreshed once each day, but there may be times when you want to refresh them manually.<br /><br />This button allows you to refresh the cache files when necessary.'); - break; - case 'clip_download': $title=i18n::translate('Download clippings cart'); $text=i18n::translate('When you click this link you will be taken to the next page. If any of the clippings in your cart refer to multimedia items, these items will also be displayed on that page.<br /><br />Simply follow the instructions.'); diff --git a/includes/functions/functions_import.php b/includes/functions/functions_import.php index 1919b342e9..c6fc1c6984 100644 --- a/includes/functions/functions_import.php +++ b/includes/functions/functions_import.php @@ -37,7 +37,6 @@ if (!defined('WT_WEBTREES')) { define('WT_FUNCTIONS_IMPORT_PHP', ''); -require_once WT_ROOT.'includes/index_cache.php'; require_once WT_ROOT.'includes/classes/class_media.php'; require_once WT_ROOT.'includes/functions/functions_lang.php'; require_once WT_ROOT.'includes/functions/functions_export.php'; @@ -1179,9 +1178,6 @@ function empty_database($ged_id, $keepmedia) { WT_DB::prepare("DELETE FROM `##media` WHERE m_gedfile =?")->execute(array($ged_id)); WT_DB::prepare("DELETE FROM `##media_mapping` WHERE mm_gedfile=?")->execute(array($ged_id)); } - - //-- clear all of the cache files for this gedcom - clearCache(); } // Accept all pending changes for a specified record diff --git a/includes/index_cache.php b/includes/index_cache.php deleted file mode 100644 index 528a3d9979..0000000000 --- a/includes/index_cache.php +++ /dev/null @@ -1,155 +0,0 @@ -<?php -/** - * Index caching functions - * - * webtrees: Web based Family History software - * Copyright (C) 2010 webtrees development team. - * - * Derived from PhpGedView - * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package webtrees - * @subpackage Display - * @version $Id$ - */ - -if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); - exit; -} - -define('WT_INDEX_CACHE_PHP', ''); - -/** - * load a cached block from a file - * @param array $block [0]:name of the block to load, [1]:block's configuration - * @param int $index An id for this block in the case of multiple instances of the same block on the page - * @return boolean returns false if the block could not be loaded from cache - */ -function loadCachedBlock($block, $index) { - global $WT_BLOCKS, $theme_name, $GEDCOM; - $INDEX_DIRECTORY=get_site_setting('INDEX_DIRECTORY'); - - //-- ignore caching when DEBUG is set - //-- ignore caching for logged in users - if (WT_DEBUG || WT_USER_ID) { - return false; - } - - //-- ignore cache when its life is not configured or when its life is zero - $cacheLife = $WT_BLOCKS[$block[0]]['config']['cache']; - if ($cacheLife==0) return false; - - $fname = "{$INDEX_DIRECTORY}/cache/{$theme_name}/".WT_LOCALE."/".WT_GEDCOM."/{$index}_{$block[0]}"; - if (file_exists($fname)) { - // Check for expired cache (<0: no expiry), 0: immediate, >0: expires in x days) Zero already checked - if ($cacheLife > 0) { - $modtime = filemtime($fname); - //-- time should start at the beginning of the day - $modtime = $modtime - (date("G",$modtime)*60*60 + date("i",$modtime)*60 + date("s",$modtime)); - $checktime = ($cacheLife*24*60*60); - $modtime = $modtime+$checktime; - if ($modtime<time()) return false; - } - return @readfile($fname); - } - return false; -} - -/** - * Save a block's content to the cache file - * @param array $block [0]:name of the block to save, [1]:block's configuration - * @param int $index An id for this block in the case of multiple instances of the same block on the page - * @param string $content the actual content to save in the cache - * @return boolean returns false if the block could not be saved to cache - */ -function saveCachedBlock($block, $index, $content) { - global $WT_BLOCKS, $theme_name, $GEDCOM; - $INDEX_DIRECTORY=get_site_setting('INDEX_DIRECTORY'); - - //-- ignore caching when DEBUG is set - //-- ignore caching for logged in users - if (WT_DEBUG || WT_USER_ID) { - return false; - } - - //-- ignore cache when its life is not configured or when its life is zero - $cacheLife=$WT_BLOCKS[$block[0]]['config']['cache']; - if ($cacheLife==0) { - return false; - } - - $fname = $INDEX_DIRECTORY."/cache"; - @mkdir($fname); - - $fname .= "/".$theme_name; - @mkdir($fname); - - $fname .= "/".WT_LOCALE; - @mkdir($fname); - - $fname .= "/".$GEDCOM; - @mkdir($fname); - - $fname .= "/".$index."_".$block[0]; - $fp = @fopen($fname, "wb"); - if (!$fp) return false; - @fwrite($fp, $content); - @fclose($fp); - return true; -} - -/* - * Re-worked copy of a similar function in dir_editor.php - * - * This function, called recursively, deletes all subdirectories and files in those subdirectories - * - * Note: This function should really be in one of the other "includes/functions/..." scripts. - */ -function removeDir($dir) { - if (!is_writable($dir)) { - if (!@chmod($dir, WT_PERM_EXE)) return FALSE; - } - - $d = dir($dir); - while (FALSE !== ($entry = $d->read())) { - if ($entry == '.' || $entry == '..') continue; - $entry = $dir . '/' . $entry; - if (is_dir($entry)) { - if (!removeDir($entry)) return FALSE; - continue; - } - if (!@unlink($entry)) { - $d->close(); - return FALSE; - } - } - - $d->close(); - rmdir($dir); - return TRUE; -} - -/** - * clears the cache files - */ -function clearCache() { - $INDEX_DIRECTORY=get_site_setting('INDEX_DIRECTORY'); - - removeDir("{$INDEX_DIRECTORY}/cache"); -} -?> @@ -30,7 +30,6 @@ define('WT_SCRIPT_NAME', 'index.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/index_cache.php'; if (isset($_REQUEST['action'])) $action = $_REQUEST['action']; if (isset($_REQUEST['ctype'])) $ctype = $_REQUEST['ctype']; @@ -63,12 +62,6 @@ if ($ctype=='user') { $blocks=get_gedcom_blocks(WT_GED_ID); } -//-- clear the GEDCOM cache files -if (!empty($_SESSION['clearcache'])) { - $_SESSION['clearcache'] = false; - clearCache(); -} - // We have finished writing to $_SESSION, so release the lock session_write_close(); diff --git a/index_edit.php b/index_edit.php index 0260eb7b33..cae46f5536 100644 --- a/index_edit.php +++ b/index_edit.php @@ -32,7 +32,6 @@ define('WT_SCRIPT_NAME', 'index_edit.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/index_cache.php'; $ctype=safe_REQUEST($_REQUEST, 'ctype', array('user', 'gedcom')); @@ -136,12 +135,6 @@ if ($action=='update') { exit; } -if ($action=="clearcache") { - clearCache(); - echo "<span class=\"warning\">".i18n::translate('The cache files have been removed.')."</span><br /><br />"; -} - -//var_dump($blocks);die("eek"); if ($action=="configure") { if (array_key_exists($block_id, $blocks['main'])) { $block_name=$blocks['main'][$block_id]; @@ -419,10 +412,6 @@ if ($action=="configure") { } else { echo help_link('block_default_index'); } - if (WT_USER_GEDCOM_ADMIN && $ctype!="user") { - echo "<input type =\"button\" value=\"".i18n::translate('Clear cache files')."\" onclick=\"window.location='index_edit.php?ctype=$ctype&action=clearcache&name=".str_replace("'", "\'", $name)."';\" />"; - echo help_link('clear_cache'); - } echo " "; echo "<input type=\"button\" value=\"".i18n::translate('Save')."\" onclick=\"select_options(); save_form();\" />\n"; echo " "; diff --git a/modules/gedcom_favorites/module.php b/modules/gedcom_favorites/module.php index 5a669063a5..2df574924f 100644 --- a/modules/gedcom_favorites/module.php +++ b/modules/gedcom_favorites/module.php @@ -82,7 +82,6 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block { } if ($favtype=='gedcom') { $favtype = WT_GEDCOM; - $_SESSION['clearcache'] = true; } else $favtype=WT_GEDCOM; $favorite['username'] = $favtype; @@ -105,7 +104,6 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block { } if ($favtype=='gedcom') { $favtype = $GEDCOM; - $_SESSION['clearcache'] = true; } else $favtype=WT_GEDCOM; $favorite['username'] = $favtype; diff --git a/modules/gedcom_news/module.php b/modules/gedcom_news/module.php index 76d994f19b..96d1237a66 100644 --- a/modules/gedcom_news/module.php +++ b/modules/gedcom_news/module.php @@ -173,7 +173,6 @@ class gedcom_news_WT_Module extends WT_Module implements WT_Module_Block { if (empty ($config)) $config = $WT_BLOCKS["print_gedcom_news"]["config"]; if (!isset ($config["limit"])) $config["limit"] = "nolimit"; if (!isset ($config["flag"])) $config["flag"] = 0; - if (!isset($config["cache"])) $config["cache"] = $WT_BLOCKS["print_gedcom_news"]["config"]["cache"]; // Limit Type echo @@ -190,14 +189,5 @@ class gedcom_news_WT_Module extends WT_Module implements WT_Module_Block { echo '<tr><td class="descriptionbox wrap width33">'; echo i18n::translate('Limit:'), help_link('gedcom_news_flag'); echo '</td><td class="optionbox"><input type="text" name="flag" size="4" maxlength="4" value="'.$config['flag'].'" /></td></tr>'; - - // Cache file life - if ($ctype=="gedcom") { - echo '<tr><td class="descriptionbox wrap width33">'; - echo i18n::translate('Cache file life'), help_link('cache_life'); - echo '</td><td class="optionbox">'; - echo '<input type="text" name="cache" size="2" value="', $config['cache'], '" />'; - echo "</td></tr>"; - } } } diff --git a/modules/user_favorites/module.php b/modules/user_favorites/module.php index d7508d3fbe..a9f6b86026 100644 --- a/modules/user_favorites/module.php +++ b/modules/user_favorites/module.php @@ -82,7 +82,6 @@ class user_favorites_WT_Module extends WT_Module implements WT_Module_Block { } if ($favtype=='gedcom') { $favtype = $GEDCOM; - $_SESSION['clearcache'] = true; } else $favtype=WT_USER_NAME; $favorite['username'] = $favtype; @@ -105,7 +104,6 @@ class user_favorites_WT_Module extends WT_Module implements WT_Module_Block { } if ($favtype=='gedcom') { $favtype = $GEDCOM; - $_SESSION['clearcache'] = true; } else $favtype=WT_USER_NAME; $favorite['username'] = $favtype; |
