* @param Language|null $lang What language to get description in (Optional)
* @return string|false
*/
- function getDescriptionText( $lang = null ) {
- $revision = Revision::newFromTitle( $this->title, false, Revision::READ_NORMAL );
+ function getDescriptionText( Language $lang = null ) {
+ $store = MediaWikiServices::getInstance()->getRevisionStore();
+ $revision = $store->getRevisionByTitle( $this->title, 0, Revision::READ_NORMAL );
if ( !$revision ) {
return false;
}
- $content = $revision->getContent();
- if ( !$content ) {
+
+ $renderer = MediaWikiServices::getInstance()->getRevisionRenderer();
+ $rendered = $renderer->getRenderedRevision( $revision, new ParserOptions( null, $lang ) );
+
+ if ( !$rendered ) {
+ // audience check failed
return false;
}
- $pout = $content->getParserOutput( $this->title, null, new ParserOptions( null, $lang ) );
+ $pout = $rendered->getRevisionParserOutput();
return $pout->getText();
}
/**
* Cleanup a failed batch. The batch was only partially successful, so
- * rollback by removing all items that were succesfully copied.
+ * rollback by removing all items that were successfully copied.
*
* @param Status $storeStatus
* @param array[] $storeBatch
$status = $repo->newGood();
$dbw = $this->db;
- $hasCurrent = $dbw->selectField(
+ $hasCurrent = $dbw->lockForUpdate(
'image',
- '1',
[ 'img_name' => $this->oldName ],
- __METHOD__,
- [ 'FOR UPDATE' ]
+ __METHOD__
);
- $oldRowCount = $dbw->selectRowCount(
+ $oldRowCount = $dbw->lockForUpdate(
'oldimage',
- '*',
[ 'oi_name' => $this->oldName ],
- __METHOD__,
- [ 'FOR UPDATE' ]
+ __METHOD__
);
if ( $hasCurrent ) {