From: Chad Horohoe Date: Mon, 7 Jul 2008 12:55:42 +0000 (+0000) Subject: Cache the SVN version so we're not doing a filesystem read every time Special:Version... X-Git-Tag: 1.31.0-rc.0~46662 X-Git-Url: http://git.cyclocoop.org/clavettes/images/siteon3.jpg?a=commitdiff_plain;h=ffceb8f5e05e681c2086163114d17f6916a11b09;p=lhc%2Fweb%2Fwiklou.git Cache the SVN version so we're not doing a filesystem read every time Special:Version (or APIQuerySiteInfo) asks for it. --- diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 8c8e386d11..fc7d844850 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -346,6 +346,14 @@ class SpecialVersion { * @return mixed revision number as int, or false if not a SVN checkout */ public static function getSvnRevision( $dir ) { + global $wgMemc; + + $key = wfMemcKey('svn-version'); + if ( $svnver = $wgMemc->get( $key ) ) { + wfDebug("Got SVN version from cache.\n"); + return $svnver; + } + // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html $entries = $dir . '/.svn/entries'; @@ -373,6 +381,7 @@ class SpecialVersion { if( $xml->entry[0]['name'] == '' ) { // The directory entry should always have a revision marker. if( $entry['revision'] ) { + $wgMemc->set($key, intval($entry['revision']), 3600 ); return intval( $entry['revision'] ); } } @@ -381,6 +390,7 @@ class SpecialVersion { return false; } else { // subversion is release 1.4 + $wgMemc->set($key, intval($content[3]), 3600 ); return intval( $content[3] ); } }