$cascade = false;
}
- // Update restrictions table
- foreach ( $limit as $action => $restrictions ) {
- if ( $restrictions != '' ) {
- $dbw->replace( 'page_restrictions', array( array( 'pr_page', 'pr_type' ) ),
- array( 'pr_page' => $id,
- 'pr_type' => $action,
- 'pr_level' => $restrictions,
- 'pr_cascade' => ( $cascade && $action == 'edit' ) ? 1 : 0,
- 'pr_expiry' => $encodedExpiry[$action]
- ),
- __METHOD__
- );
- } else {
- $dbw->delete( 'page_restrictions', array( 'pr_page' => $id,
- 'pr_type' => $action ), __METHOD__ );
- }
- }
-
// Prepare a null revision to be added to the history
$editComment = $wgContLang->ucfirst(
wfMessage(
)->inContentLanguage()->text();
}
- // Insert a null revision
$nullRevision = Revision::newNullRevision( $dbw, $id, $editComment, true );
+ if ( $nullRevision === null ) {
+ return Status::newFatal( 'no-null-revision', $this->mTitle->getPrefixedText() );
+ }
+
+ // Update restrictions table
+ foreach ( $limit as $action => $restrictions ) {
+ if ( $restrictions != '' ) {
+ $dbw->replace( 'page_restrictions', array( array( 'pr_page', 'pr_type' ) ),
+ array( 'pr_page' => $id,
+ 'pr_type' => $action,
+ 'pr_level' => $restrictions,
+ 'pr_cascade' => ( $cascade && $action == 'edit' ) ? 1 : 0,
+ 'pr_expiry' => $encodedExpiry[$action]
+ ),
+ __METHOD__
+ );
+ } else {
+ $dbw->delete( 'page_restrictions', array( 'pr_page' => $id,
+ 'pr_type' => $action ), __METHOD__ );
+ }
+ }
+
+ // Insert a null revision
$nullRevId = $nullRevision->insertOn( $dbw );
$latest = $this->getLatest();
'cannotdelete-title' => 'Cannot delete page "$1"',
'delete-hook-aborted' => 'Deletion aborted by hook.
It gave no explanation.',
+'no-null-revision' => 'Could not create new null revision for page "$1"',
'badtitle' => 'Bad title',
'badtitletext' => 'The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title.
It may contain one or more characters that cannot be used in titles.',
'cannotdelete-title' => 'Title of error page when the user cannot delete a page. Parameters:
* $1 - the page name',
'delete-hook-aborted' => 'Error message shown when an extension hook prevents a page deletion, but does not provide an error message.',
+'no-null-revision' => 'Error message shown when no null revision could be created to reflect a protection level change.',
'badtitle' => 'The page title when a user requested a page with invalid page name. The content will be {{msg-mw|badtitletext}}.',
'badtitletext' => 'The message shown when a user requested a page with invalid page name. The page title will be {{msg-mw|badtitle}}.