From: Aaron Schulz Date: Fri, 21 Jun 2013 18:20:59 +0000 (-0700) Subject: Removed some inappropriate global state from FSFile X-Git-Tag: 1.31.0-rc.0~19343^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=59878d3bdf16af85e25b6d97f9a7d9c78584bf7c;p=lhc%2Fweb%2Fwiklou.git Removed some inappropriate global state from FSFile Change-Id: I48bc82eab486c119ed1ac7812d2da97490088cd4 --- diff --git a/includes/filebackend/FSFile.php b/includes/filebackend/FSFile.php index 0ebe69613e..8f0a13347e 100644 --- a/includes/filebackend/FSFile.php +++ b/includes/filebackend/FSFile.php @@ -28,7 +28,7 @@ */ class FSFile { protected $path; // path to file - private $sha1Base36 = null; // File Sha1Base36 + protected $sha1Base36; // file SHA-1 in base 36 /** * Sets up the file object @@ -234,7 +234,6 @@ class FSFile { * @param string $path absolute local filesystem path * @param Mixed $ext: the file extension, or true to extract it from the filename. * Set it to false to ignore the extension. - * * @return array */ public static function getPropsFromPath( $path, $ext = true ) { @@ -250,18 +249,10 @@ class FSFile { * fairly neatly. * * @param string $path - * @param bool $recache - * * @return bool|string False on failure */ - public static function getSha1Base36FromPath( $path, $recache = false ) { - static $sha1Base36 = array(); - - if ( !isset( $sha1Base36[$path] ) || $recache ) { - $fsFile = new self( $path ); - $sha1Base36[$path] = $fsFile->getSha1Base36(); - } - - return $sha1Base36[$path]; + public static function getSha1Base36FromPath( $path ) { + $fsFile = new self( $path ); + return $fsFile->getSha1Base36(); } } diff --git a/tests/phpunit/mocks/filebackend/MockFSFile.php b/tests/phpunit/mocks/filebackend/MockFSFile.php index 31deaf7a11..e0463281d7 100644 --- a/tests/phpunit/mocks/filebackend/MockFSFile.php +++ b/tests/phpunit/mocks/filebackend/MockFSFile.php @@ -32,7 +32,7 @@ * @ingroup FileBackend */ class MockFSFile extends FSFile { - private $sha1Base36 = null; // File Sha1Base36 + protected $sha1Base36 = null; // File Sha1Base36 public function exists() { return true;