From: <var...@us...> - 2021-09-30 12:43:53
|
Revision: 10602 http://sourceforge.net/p/phpwiki/code/10602 Author: vargenau Date: 2021-09-30 12:43:51 +0000 (Thu, 30 Sep 2021) Log Message: ----------- Remove function save_dump Modified Paths: -------------- trunk/lib/IniConfig.php Modified: trunk/lib/IniConfig.php =================================================================== --- trunk/lib/IniConfig.php 2021-09-30 11:00:26 UTC (rev 10601) +++ trunk/lib/IniConfig.php 2021-09-30 12:43:51 UTC (rev 10602) @@ -65,48 +65,6 @@ include_once (dirname(__FILE__) . "/config.php"); include_once (dirname(__FILE__) . "/FileFinder.php"); -/** - * Speed-up iniconfig loading. - * - * Dump the static parts of the parsed config/config.ini settings to a fast-loadable config.php file. - * The dynamic parts are then evaluated as before. - * Requires write-permissions to config/config.php - * - * @param string $file - */ -function save_dump($file) -{ - $vars =& $GLOBALS; // copy + unset not possible - $ignore = array(); - foreach (array("SERVER", "ENV", "GET", "POST", "REQUEST", "COOKIE", "FILES") as $key) { - $ignore["HTTP_" . $key . "_VARS"]++; - $ignore["_" . $key]++; - } - foreach (array("HTTP_POST_FILES", "GLOBALS", "RUNTIMER", "ErrorManager", 'LANG', - 'HOME_PAGE', 'request', 'SCRIPT_NAME', 'VIRTUAL_PATH', 'SCRIPT_FILENAME') as $key) - $ignore[$key]++; - $fp = fopen($file, "wb"); - fwrite($fp, "<?php\n"); - fwrite($fp, "function wiki_configrestore(){\n"); - //TODO: optimize this by removing ignore, big serialized array and merge into existing GLOBALS - foreach ($vars as $var => $val) { - if (!$ignore[$var]) - fwrite($fp, "\$GLOBALS['" . $var . "']=unserialize(\"" - . addslashes(serialize($val)) . "\");\n"); - } - // cannot be optimized, maybe leave away predefined consts somehow - foreach (get_defined_constants() as $var => $val) { - if (substr($var, 0, 4) != "PHP_" and substr($var, 0, 2) != "E_" - and substr($var, 0, 2) != "T_" and substr($var, 0, 2) != "M_" - ) - fwrite($fp, "if(!defined('" . $var . "')) define('" . $var . "',unserialize(\"" - . addslashes(serialize($val)) . "\"));\n"); - } - fwrite($fp, "return 'noerr';}"); - fwrite($fp, "?>"); - fclose($fp); -} - function _check_int_constant(&$c) { // if int value == string value, force int type @@ -521,12 +479,6 @@ unset($rsdef); fixup_static_configs($file); //[1ms] - // Dump all globals and constants - // The question is if reading this is faster then doing IniConfig() + fixup_static_configs() - if (is_writable($dump)) { - save_dump($dump); - } - // store locale[] in config.php? This is too problematic. fixup_dynamic_configs(); // [100ms] } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |