* @ingroup FileAbstraction
*/
+use Wikimedia\AtEase\AtEase;
use MediaWiki\Logger\LoggerFactory;
use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IDatabase;
*
* RepoGroup::singleton()->getLocalRepo()->newFile( $title );
*
- * The convenience functions wfLocalFile() and wfFindFile() should be sufficient
- * in most cases.
+ * Consider the services container below;
+ *
+ * $services = MediaWikiServices::getInstance();
+ *
+ * The convenience services $services->getRepoGroup()->getLocalRepo()->newFile()
+ * and $services->getRepoGroup()->findFile() should be sufficient in most cases.
+ *
+ * @TODO: DI - Instead of using MediaWikiServices::getInstance(), a service should
+ * ideally accept a RepoGroup in its constructor and then, use $this->repoGroup->findFile()
+ * and $this->repoGroup->getLocalRepo()->newFile().
*
* @ingroup FileAbstraction
*/
$options = [];
$handler = MediaHandler::getHandler( $props['mime'] );
if ( $handler ) {
- $metadata = Wikimedia\quietCall( 'unserialize', $props['metadata'] );
+ $metadata = AtEase::quietCall( 'unserialize', $props['metadata'] );
if ( !is_array( $metadata ) ) {
$metadata = [];
'img_sha1' => $this->sha1
] + $commentFields + $actorFields,
__METHOD__,
- 'IGNORE'
+ [ 'IGNORE' ]
);
$reupload = ( $dbw->affectedRows() == 0 );
* @return Status
*/
function move( $target ) {
+ $localRepo = MediaWikiServices::getInstance()->getRepoGroup();
if ( $this->getRepo()->getReadOnlyReason() !== false ) {
return $this->readOnlyFatalStatus();
}
wfDebugLog( 'imagemove', "Finished moving {$this->name}" );
// Purge the source and target files...
- $oldTitleFile = wfLocalFile( $this->title );
- $newTitleFile = wfLocalFile( $target );
+ $oldTitleFile = $localRepo->findFile( $this->title );
+ $newTitleFile = $localRepo->findFile( $target );
// To avoid slow purges in the transaction, move them outside...
DeferredUpdates::addUpdate(
new AutoCommitUpdate(