cvs: docweb / INSTALL.txt /include init.inc.php lib_general.inc.php

From: Date: Mon, 26 May 2008 18:54:38 +0000
Subject: cvs: docweb / INSTALL.txt /include init.inc.php lib_general.inc.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-987@lists.php.net to get a copy of this message
philip Mon May 26 18:54:38 2008 UTC Modified files: /docweb INSTALL.txt /docweb/include init.inc.php lib_general.inc.php Log: implemented new bug count mechanism... rss parsing is no longer required http://cvs.php.net/viewvc.cgi/docweb/INSTALL.txt?r1=1.18&r2=1.19&diff_format=u Index: docweb/INSTALL.txt diff -u docweb/INSTALL.txt:1.18 docweb/INSTALL.txt:1.19 --- docweb/INSTALL.txt:1.18 Sun Feb 3 15:37:01 2008 +++ docweb/INSTALL.txt Mon May 26 18:54:38 2008 @@ -13,7 +13,6 @@ 4. chown the created files (see 3.) to the user and group who apache runs under. (see scripts/set_ownership.sh) 5. The PEAR packages for the RFC System can be found at include/rfc/PACKAGES - You will also need to have: XML_RSS, XML_Parser 6. A cronjob should be setup to run include/rfc/rfc-cron.php at 4am 7. You may want to create a www/robots.txt to allow or disallow bots crawling your local docweb development site. http://cvs.php.net/viewvc.cgi/docweb/include/init.inc.php?r1=1.14&r2=1.15&diff_format=u Index: docweb/include/init.inc.php diff -u docweb/include/init.inc.php:1.14 docweb/include/init.inc.php:1.15 --- docweb/include/init.inc.php:1.14 Sun Feb 11 07:43:32 2007 +++ docweb/include/init.inc.php Mon May 26 18:54:38 2008 @@ -18,7 +18,7 @@ | Gabor Hojtsy <goba@php.net> | | Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$Id: init.inc.php,v 1.14 2007/02/11 07:43:32 rasmus Exp $ +$Id: init.inc.php,v 1.15 2008/05/26 18:54:38 philip Exp $ */ error_reporting(E_ALL); @@ -26,8 +26,8 @@ // get paths require_once(dirname(realpath(__FILE__)) . '/../build-ops.php'); -// RSS cache is considered stale after (seconds): -define('RSS_STALE_CACHE_BUGS', 300); // 300 = 5mins +// Cache is considered stale after (seconds): +define('CACHE_BUGS_COUNT', 300); // 300 = 5mins // project & language config require_once('lib_proj_lang.inc.php'); http://cvs.php.net/viewvc.cgi/docweb/include/lib_general.inc.php?r1=1.58&r2=1.59&diff_format=u Index: docweb/include/lib_general.inc.php diff -u docweb/include/lib_general.inc.php:1.58 docweb/include/lib_general.inc.php:1.59 --- docweb/include/lib_general.inc.php:1.58 Mon May 26 18:41:14 2008 +++ docweb/include/lib_general.inc.php Mon May 26 18:54:38 2008 @@ -18,7 +18,7 @@ | Gabor Hojtsy <goba@php.net> | | Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$Id: lib_general.inc.php,v 1.58 2008/05/26 18:41:14 philip Exp $ +$Id: lib_general.inc.php,v 1.59 2008/05/26 18:54:38 philip Exp $ */ require_once dirname(__FILE__) . '/lib_auth.inc.php'; @@ -67,7 +67,7 @@ header("Content-type: text/html; charset=$encoding"); // bugs for count - if ($bugs = get_bugs_rss()) { + if ($bugs = get_bugs_count()) { $showBugs = true; $bugCount = $bugs['count']; $bugsLink = $bugs['link']; @@ -250,3 +250,45 @@ array('links' => $links, 'Language' => &$GLOBALS['Language']) ); } + +function get_bug_count ($project=SITE) { + + $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': + $link = 'http://bugs.php.net/search.php?boolean=0' + .'&limit=All&order_by=status&direction=ASC&cmd=display' + .'&status=Open&bug_type%5B%5D=Documentation+problem' + .'&bug_age=0&count_only=1'; + break; + + case 'phd': + $link = 'http://bugs.php.net/search.php?boolean=0' + .'&limit=All&order_by=status&direction=ASC&cmd=display' + .'&status=Open&bug_type%5B%5D=Doc+Build+problem' + .'&bug_age=0&count_only=1'; + break; + + default: + return false; + } + + if (!$count = file_get_contents($link)) { + return false; + } + file_put_contents($localFile, $count); + + return array ('count' => (int) $count, + 'link' => $link, + ); +}

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