[Obliquid-cvs] obliquid/common/classes/obliquid core.php, 1.56, 1.57
Status: Beta
Brought to you by:
slocati
|
From: <sl...@sc...> - 2007-03-07 15:06:43
|
Update of /cvsroot/obliquid/obliquid/common/classes/obliquid In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27213/classes/obliquid Modified Files: core.php Log Message: Added calls to clearstatcache(), improved comments Index: core.php =================================================================== RCS file: /cvsroot/obliquid/obliquid/common/classes/obliquid/core.php,v retrieving revision 1.56 retrieving revision 1.57 diff -b -u -d -r1.56 -r1.57 --- core.php 25 Dec 2005 21:22:13 -0000 1.56 +++ core.php 7 Mar 2007 15:06:32 -0000 1.57 @@ -139,6 +139,12 @@ $is_common[$cur_page] = $dir=="common"; /* PARSE XML FILE start */ + + // THIS CALL IS NEEDED BECAUSE "filesize()" CACHE RESULT BETWEEN MULTIPLE CALL + // SO FREAD CAN READ ONLY A PIECE OF THE FILE. + // MORE INFO AT: http://www.php.net/manual/en/function.clearstatcache.php + clearstatcache(); + $fd=fopen($cur_file, "r"); $xmldoc=fread($fd, filesize($cur_file)); $tree =& eZXML::domTree($xmldoc); @@ -153,8 +159,7 @@ if ($attr[$j]->name=="FRAME") $cur_frame=$attr[$j]->content; if ($attr[$j]->name=="TPL") $cur_tpl=$attr[$j]->content; } - //GROUP is now given by the module dir, the attribute could be removed - //if ($fgroup!="" && $cur_group!=$fgroup) continue; + if ($fgroup!="" && $cur_group!=$fgroup) continue; $frame[$cur_page]=$cur_frame; $tpl[$cur_page]=$cur_tpl; // finds the slots for a page @@ -249,7 +254,6 @@ return $page; } - /** getPage returns an associative array with page attributes * Returns: * Array([NAME] => core_configparms @@ -262,8 +266,6 @@ * [SLOT] => Array ( * [0] => Array ( * [NAME] => core/nav - * [NAME_PHP] => - * [NAME_TPL] => * [PHP] => common * [TPL] => common * [FRAME] => frame @@ -279,13 +281,19 @@ $page = $this->pageInfo($name); /* PARSE XML FILE start */ + + // THIS CALL IS NEEDED BECAUSE "filesize()" CACHE RESULT BETWEEN MULTIPLE CALL + // SO FREAD CAN READ ONLY A PIECE OF THE FILE. + // MORE INFO AT: http://www.php.net/manual/en/function.clearstatcache.php + clearstatcache(); + $fd=@fopen($page["path"], "r"); if (!$fd) return false; $xmldoc=fread($fd, filesize($page["path"])); $tree =& eZXML::domTree($xmldoc); $first_lev =& $tree->children; $page_attr=array("NAME", "GROUP", "FRAME", "TPL"); - $slot_attr=array("NAME", "NAME_PHP", "NAME_TPL", "PHP", "TPL", "FRAME", "POSITION", "BLOCK", "FUNCTION"); + $slot_attr=array("NAME", "PHP", "TPL", "FRAME", "POSITION", "BLOCK", "FUNCTION"); for ($i=0; $i<count($first_lev); $i++) { if ($first_lev[$i]->name!="PAGE") continue; //may also have "text" nodes! // finds attributes cur_page and cur_group @@ -369,6 +377,12 @@ if (!is_writable($page["path"])) { $_obweb->addErr(sprintf(_l("%s is not writeable: can't modify"), $page["path"])."\n"); } + + // THIS CALL IS NEEDED BECAUSE "filesize()" CACHE RESULT BETWEEN MULTIPLE CALL + // SO FREAD CAN READ ONLY A PIECE OF THE FILE. + // MORE INFO AT: http://www.php.net/manual/en/function.clearstatcache.php + clearstatcache(); + $fd=fopen($page["path"], "r"); $xmldoc=fread($fd, filesize($page["path"])); $tree =& eZXML::domTree($xmldoc); @@ -540,6 +554,12 @@ $config_tpl="common/configs/".$fname.".tpl"; $fp=fopen($config_tpl, "r"); if (!$fp) return false; + + // THIS CALL IS NEEDED BECAUSE "filesize()" CACHE RESULT BETWEEN MULTIPLE CALL + // SO FREAD CAN READ ONLY A PIECE OF THE FILE. + // MORE INFO AT: http://www.php.net/manual/en/function.clearstatcache.php + clearstatcache(); + $mb_cfg=fread($fp, filesize($config_tpl)); fclose($fp); $newdb=sprintf("%d", $newdb); @@ -568,3 +588,4 @@ } + |