X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2Ffile%2FLocalFile.php;h=263e45b015aa50ccafe8fa65708b682c46e520e0;hb=0c712ce564e0bd53e28f2581a714ee8cd04b614c;hp=bf1181f74c7ce3be574e145e05f71fc3bd109050;hpb=bbedc2455653706210e370cd3c25a43914dcf1a4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index bf1181f74c..263e45b015 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -24,6 +24,7 @@ use MediaWiki\Logger\LoggerFactory; use Wikimedia\Rdbms\Database; use Wikimedia\Rdbms\IDatabase; +use MediaWiki\MediaWikiServices; /** * Class to represent a local file in the wiki's own database @@ -1275,6 +1276,10 @@ class LocalFile extends File { ) { if ( $this->getRepo()->getReadOnlyReason() !== false ) { return $this->readOnlyFatalStatus(); + } elseif ( MediaWikiServices::getInstance()->getRevisionStore()->isReadOnly() ) { + // Check this in advance to avoid writing to FileBackend and the file tables, + // only to fail on insert the revision due to the text store being unavailable. + return $this->readOnlyFatalStatus(); } $srcPath = ( $src instanceof FSFile ) ? $src->getPath() : $src; @@ -1292,7 +1297,7 @@ class LocalFile extends File { $options = []; $handler = MediaHandler::getHandler( $props['mime'] ); if ( $handler ) { - $metadata = MediaWiki\quietCall( 'unserialize', $props['metadata'] ); + $metadata = Wikimedia\quietCall( 'unserialize', $props['metadata'] ); if ( !is_array( $metadata ) ) { $metadata = []; @@ -2509,7 +2514,7 @@ class LocalFileDeleteBatch { ); $rowsInsert = []; if ( $res->numRows() ) { - $reason = $commentStore->createComment( $dbw, 'fa_deleted_reason', $this->reason ); + $reason = $commentStore->createComment( $dbw, $this->reason ); foreach ( $res as $row ) { $comment = $commentStore->getComment( 'oi_description', $row ); $rowsInsert[] = [