public function insertOn( $dbw ) {
global $wgDefaultExternalStore, $wgContentHandlerUseDB;
+ // Not allowed to have rev_page equal to 0, false, etc.
+ if ( !$this->mPage ) {
+ $title = $this->getTitle();
+ if ( $title instanceof Title ) {
+ $titleText = ' for page ' . $title->getPrefixedText();
+ } else {
+ $titleText = '';
+ }
+ throw new MWException( "Cannot insert revision$titleText: page ID must be nonzero" );
+ }
+
$this->checkContentModel();
$data = $this->mText;
array(
'page_id' => $pageId,
'page_latest=rev_id',
- ),
- __METHOD__ );
+ ),
+ __METHOD__,
+ array( 'FOR UPDATE' ) // T51581
+ );
if ( $current ) {
if ( !$user ) {