* @ingroup FileRepo
*/
class LocalRepo extends FileRepo {
- /** @var array */
+ /** @var callable */
protected $fileFactory = [ 'LocalFile', 'newFromTitle' ];
-
- /** @var array */
+ /** @var callable */
protected $fileFactoryKey = [ 'LocalFile', 'newFromKey' ];
-
- /** @var array */
+ /** @var callable */
protected $fileFromRowFactory = [ 'LocalFile', 'newFromRow' ];
-
- /** @var array */
+ /** @var callable */
protected $oldFileFromRowFactory = [ 'OldLocalFile', 'newFromRow' ];
-
- /** @var array */
+ /** @var callable */
protected $oldFileFactory = [ 'OldLocalFile', 'newFromTitle' ];
-
- /** @var array */
+ /** @var callable */
protected $oldFileFactoryKey = [ 'OldLocalFile', 'newFromKey' ];
function __construct( array $info = null ) {
parent::__construct( $info );
- $this->hasSha1Storage = isset( $info['storageLayout'] ) && $info['storageLayout'] === 'sha1';
+ $this->hasSha1Storage = isset( $info['storageLayout'] )
+ && $info['storageLayout'] === 'sha1';
if ( $this->hasSha1Storage() ) {
$this->backend = new FileBackendDBRepoWrapper( [
*
* @param array $storageKeys
*
- * @return FileRepoStatus
+ * @return Status
*/
function cleanupDeletedBatch( array $storageKeys ) {
if ( $this->hasSha1Storage() ) {
}
/**
- * Get a connection to the slave DB
- * @return DatabaseBase
+ * Get a connection to the replica DB
+ * @return IDatabase
*/
function getSlaveDB() {
- return wfGetDB( DB_SLAVE );
+ return wfGetDB( DB_REPLICA );
}
/**
* Get a connection to the master DB
- * @return DatabaseBase
+ * @return IDatabase
*/
function getMasterDB() {
return wfGetDB( DB_MASTER );
}
/**
- * Get a callback to get a DB handle given an index (DB_SLAVE/DB_MASTER)
+ * Get a callback to get a DB handle given an index (DB_REPLICA/DB_MASTER)
* @return Closure
*/
protected function getDBFactory() {
function invalidateImageRedirect( Title $title ) {
$key = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
if ( $key ) {
- $this->getMasterDB()->onTransactionPreCommitOrIdle( function() use ( $key ) {
- ObjectCache::getMainWANInstance()->delete( $key );
- } );
+ $this->getMasterDB()->onTransactionPreCommitOrIdle(
+ function () use ( $key ) {
+ ObjectCache::getMainWANInstance()->delete( $key );
+ },
+ __METHOD__
+ );
}
}
*
* @param string $function
* @param array $args
- * @return FileRepoStatus
+ * @return Status
*/
protected function skipWriteOperationIfSha1( $function, array $args ) {
$this->assertWritableRepo(); // fail out if read-only