jenkins-bot has submitted this change and it was merged.
Change subject: Removed some inappropriate global state from FSFile
......................................................................
Removed some inappropriate global state from FSFile
Change-Id: I48bc82eab486c119ed1ac7812d2da97490088cd4
---
M includes/filebackend/FSFile.php
M tests/phpunit/mocks/filebackend/MockFSFile.php
2 files changed, 5 insertions(+), 14 deletions(-)
Approvals:
Demon: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/filebackend/FSFile.php b/includes/filebackend/FSFile.php
index 0ebe696..8f0a133 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 @@
* @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 @@
* 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 31deaf7..e046328 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;
--
To view, visit https://gerrit.wikimedia.org/r/69889
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I48bc82eab486c119ed1ac7812d2da97490088cd4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits