* @return string
*/
public function getName() {
- if ( !isset( $this->name ) ) {
+ if ( $this->name === null ) {
$this->assertRepoDefined();
$this->name = $this->repo->getNameFromTitle( $this->title );
}
$thumb = false;
} elseif ( $thumb->isError() ) { // transform error
/** @var MediaTransformError $thumb */
+ '@phan-var MediaTransformError $thumb';
$this->lastError = $thumb->toText();
// Ignore errors if requested
if ( $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) {
*/
protected function makeTransformTmpFile( $thumbPath ) {
$thumbExt = FileBackend::extensionFromPath( $thumbPath );
- return TempFSFile::factory( 'transform_', $thumbExt, wfTempDir() );
+ return MediaWikiServices::getInstance()->getTempFSFileFactory()
+ ->newTempFSFile( 'transform_', $thumbExt );
}
/**
// Delete thumbnails and refresh file metadata cache
$this->purgeCache();
$this->purgeDescription();
-
// Purge cache of all pages using this file
$title = $this->getTitle();
if ( $title ) {
- DeferredUpdates::addUpdate(
- new HTMLCacheUpdate( $title, 'imagelinks', 'file-purge' )
+ $job = HTMLCacheUpdateJob::newForBacklinks(
+ $title,
+ 'imagelinks',
+ [ 'causeAction' => 'file-purge' ]
);
+ JobQueueGroup::singleton()->lazyPush( $job );
}
}
* @return string
*/
function getHashPath() {
- if ( !isset( $this->hashPath ) ) {
+ if ( $this->hashPath === null ) {
$this->assertRepoDefined();
$this->hashPath = $this->repo->getHashPath( $this->getName() );
}