dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up get_class() in /includes/filerepo and /includes/resourceloader
[lhc/web/wiklou.git]
/
includes
/
filerepo
/
file
/
LocalFile.php
diff --git
a/includes/filerepo/file/LocalFile.php
b/includes/filerepo/file/LocalFile.php
index
011ba87
..
a633fd2
100644
(file)
--- a/
includes/filerepo/file/LocalFile.php
+++ b/
includes/filerepo/file/LocalFile.php
@@
-240,6
+240,15
@@
class LocalFile extends File {
return $this->repo->getSharedCacheKey( 'file', sha1( $this->getName() ) );
}
return $this->repo->getSharedCacheKey( 'file', sha1( $this->getName() ) );
}
+ /**
+ * @param WANObjectCache $cache
+ * @return string[]
+ * @since 1.28
+ */
+ public function getMutableCacheKeys( WANObjectCache $cache ) {
+ return [ $this->getCacheKey() ];
+ }
+
/**
* Try to load file metadata from memcached, falling back to the database
*/
/**
* Try to load file metadata from memcached, falling back to the database
*/
@@
-382,7
+391,7
@@
class LocalFile extends File {
* @param int $flags
*/
function loadFromDB( $flags = 0 ) {
* @param int $flags
*/
function loadFromDB( $flags = 0 ) {
- $fname =
get_class( $this )
. '::' . __FUNCTION__;
+ $fname =
static::class
. '::' . __FUNCTION__;
# Unconditionally set loaded=true, we don't want the accessors constantly rechecking
$this->dataLoaded = true;
# Unconditionally set loaded=true, we don't want the accessors constantly rechecking
$this->dataLoaded = true;
@@
-407,7
+416,7
@@
class LocalFile extends File {
* This covers fields that are sometimes not cached.
*/
protected function loadExtraFromDB() {
* This covers fields that are sometimes not cached.
*/
protected function loadExtraFromDB() {
- $fname =
get_class( $this )
. '::' . __FUNCTION__;
+ $fname =
static::class
. '::' . __FUNCTION__;
# Unconditionally set loaded=true, we don't want the accessors constantly rechecking
$this->extraDataLoaded = true;
# Unconditionally set loaded=true, we don't want the accessors constantly rechecking
$this->extraDataLoaded = true;
@@
-882,7
+891,7
@@
class LocalFile extends File {
$files[] = $file;
}
} catch ( FileBackendError $e ) {
$files[] = $file;
}
} catch ( FileBackendError $e ) {
- } // suppress (
bug 54
674)
+ } // suppress (
T56
674)
return $files;
}
return $files;
}
@@
-1061,7
+1070,9
@@
class LocalFile extends File {
$opts['ORDER BY'] = "oi_timestamp $order";
$opts['USE INDEX'] = [ 'oldimage' => 'oi_name_timestamp' ];
$opts['ORDER BY'] = "oi_timestamp $order";
$opts['USE INDEX'] = [ 'oldimage' => 'oi_name_timestamp' ];
- Hooks::run( 'LocalFile::getHistory', [ &$this, &$tables, &$fields,
+ // Avoid PHP 7.1 warning from passing $this by reference
+ $localFile = $this;
+ Hooks::run( 'LocalFile::getHistory', [ &$localFile, &$tables, &$fields,
&$conds, &$opts, &$join_conds ] );
$res = $dbr->select( $tables, $fields, $conds, __METHOD__, $opts, $join_conds );
&$conds, &$opts, &$join_conds ] );
$res = $dbr->select( $tables, $fields, $conds, __METHOD__, $opts, $join_conds );
@@
-1089,7
+1100,7
@@
class LocalFile extends File {
*/
public function nextHistoryLine() {
# Polymorphic function name to distinguish foreign and local fetches
*/
public function nextHistoryLine() {
# Polymorphic function name to distinguish foreign and local fetches
- $fname =
get_class( $this )
. '::' . __FUNCTION__;
+ $fname =
static::class
. '::' . __FUNCTION__;
$dbr = $this->repo->getReplicaDB();
$dbr = $this->repo->getReplicaDB();
@@
-1342,7
+1353,7
@@
class LocalFile extends File {
}
}
}
}
- # (
bug 34
993) Note: $oldver can be empty here, if the previous
+ # (
T36
993) Note: $oldver can be empty here, if the previous
# version of the file was broken. Allow registration of the new
# version to continue anyway, because that's better than having
# an image that's not fixable by user operations.
# version of the file was broken. Allow registration of the new
# version to continue anyway, because that's better than having
# an image that's not fixable by user operations.
@@
-1572,7
+1583,7
@@
class LocalFile extends File {
/**
* Move or copy a file to its public location. If a file exists at the
/**
* Move or copy a file to its public location. If a file exists at the
- * destination, move it to an archive. Returns a
FileRepo
Status object with
+ * destination, move it to an archive. Returns a Status object with
* the archive name in the "value" member on success.
*
* The archive name should be passed through to recordUpload for database
* the archive name in the "value" member on success.
*
* The archive name should be passed through to recordUpload for database
@@
-1590,7
+1601,7
@@
class LocalFile extends File {
}
/**
}
/**
- * Move or copy a file to a specified location. Returns a
FileRepo
Status
+ * Move or copy a file to a specified location. Returns a Status
* object with the archive name in the "value" member on success.
*
* The archive name should be passed through to recordUpload for database
* object with the archive name in the "value" member on success.
*
* The archive name should be passed through to recordUpload for database
@@
-1996,7
+2007,7
@@
class LocalFile extends File {
$dbw = $this->repo->getMasterDB();
$makesTransaction = !$dbw->trxLevel();
$dbw->startAtomic( self::ATOMIC_SECTION_LOCK );
$dbw = $this->repo->getMasterDB();
$makesTransaction = !$dbw->trxLevel();
$dbw->startAtomic( self::ATOMIC_SECTION_LOCK );
- //
Bug 54
736: use simple lock to handle when the file does not exist.
+ //
T56
736: use simple lock to handle when the file does not exist.
// SELECT FOR UPDATE prevents changes, not other SELECTs with FOR UPDATE.
// Also, that would cause contention on INSERT of similarly named rows.
$status = $this->acquireFileLock(); // represents all versions of the file
// SELECT FOR UPDATE prevents changes, not other SELECTs with FOR UPDATE.
// Also, that would cause contention on INSERT of similarly named rows.
$status = $this->acquireFileLock(); // represents all versions of the file
@@
-2086,7
+2097,7
@@
class LocalFileDeleteBatch {
/** @var bool Whether to suppress all suppressable fields when deleting */
private $suppress;
/** @var bool Whether to suppress all suppressable fields when deleting */
private $suppress;
- /** @var
FileRepo
Status */
+ /** @var Status */
private $status;
/** @var User */
private $status;
/** @var User */
@@
-2993,7
+3004,7
@@
class LocalFileMoveBatch {
}
/**
}
/**
- * Verify the database updates and return a new
FileRepo
Status indicating how
+ * Verify the database updates and return a new Status indicating how
* many rows would be updated.
*
* @return Status
* many rows would be updated.
*
* @return Status
@@
-3024,7
+3035,7
@@
class LocalFileMoveBatch {
$status->failCount++;
}
$status->successCount += $oldRowCount;
$status->failCount++;
}
$status->successCount += $oldRowCount;
- //
Bug 34
934: oldCount is based on files that actually exist.
+ //
T36
934: oldCount is based on files that actually exist.
// There may be more DB rows than such files, in which case $affected
// can be greater than $total. We use max() to avoid negatives here.
$status->failCount += max( 0, $this->oldCount - $oldRowCount );
// There may be more DB rows than such files, in which case $affected
// can be greater than $total. We use max() to avoid negatives here.
$status->failCount += max( 0, $this->oldCount - $oldRowCount );
@@
-3036,7
+3047,7
@@
class LocalFileMoveBatch {
}
/**
}
/**
- * Do the database updates and return a new
FileRepo
Status indicating how
+ * Do the database updates and return a new Status indicating how
* many rows where updated.
*/
protected function doDBUpdates() {
* many rows where updated.
*/
protected function doDBUpdates() {