cvs: docweb /include lib_general.inc.php

From: Date: Mon, 26 May 2008 20:42:23 +0000
Subject: cvs: docweb /include lib_general.inc.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-989@lists.php.net to get a copy of this message
philip Mon May 26 20:42:23 2008 UTC Modified files: /docweb/include lib_general.inc.php Log: fix logic # hopefully the last fix *sigh* http://cvs.php.net/viewvc.cgi/docweb/include/lib_general.inc.php?r1=1.61&r2=1.62&diff_format=u Index: docweb/include/lib_general.inc.php diff -u docweb/include/lib_general.inc.php:1.61 docweb/include/lib_general.inc.php:1.62 --- docweb/include/lib_general.inc.php:1.61 Mon May 26 20:30:49 2008 +++ docweb/include/lib_general.inc.php Mon May 26 20:42:23 2008 @@ -18,7 +18,7 @@ | Gabor Hojtsy <goba@php.net> | | Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$Id: lib_general.inc.php,v 1.61 2008/05/26 20:30:49 philip Exp $ +$Id: lib_general.inc.php,v 1.62 2008/05/26 20:42:23 philip Exp $ */ require_once dirname(__FILE__) . '/lib_auth.inc.php'; @@ -255,14 +255,6 @@ $localFile = FILES_DIR . "bugs_{$project}.count"; - // Cached (CACHE_BUGS_COUNT defined in init.inc.php) - if ((is_readable($localFile) && (filemtime($localFile) > (time() - CACHE_BUGS_COUNT)))) { - $count = file_get_contents($localFile); - if (strlen($count) > 0) { - return (int) $count; - } - } - switch ($project) { case 'php': @@ -290,12 +282,20 @@ return false; } - if (!$count = file_get_contents($link)) { - return false; + // Cached (CACHE_BUGS_COUNT defined in init.inc.php) + if (!(is_readable($localFile) && (filemtime($localFile) > (time() - CACHE_BUGS_COUNT)))) { + if (!$count = file_get_contents($link)) { + return false; + } + file_put_contents($localFile, $count); + } else { + $count = file_get_contents($localFile); } - file_put_contents($localFile, $count); - - return array ('count' => (int) $count, - 'link' => $link, - ); + + if (strlen($count) > 0) { + return array ('count' => (int) $count, + 'link' => $link, + ); + } + return false; }

« previous php.doc.web (#989) next »