*/
const AS_PARSE_ERROR = 240;
+ /**
+ * Status: when changing the content model is disallowed due to
+ * $wgContentHandlerUseDB being false
+ */
+ const AS_CANNOT_USE_CUSTOM_MODEL = 241;
+
/**
* HTML id and name for the beginning of the edit form.
*/
case self::AS_HOOK_ERROR:
return false;
+ case self::AS_CANNOT_USE_CUSTOM_MODEL:
case self::AS_PARSE_ERROR:
$wgOut->addWikiText( '<div class="error">' . $status->getWikiText() . '</div>' );
return true;
*/
function internalAttemptSave( &$result, $bot = false ) {
global $wgUser, $wgRequest, $wgParser, $wgMaxArticleSize;
+ global $wgContentHandlerUseDB;
$status = Status::newGood();
}
}
- if ( $this->contentModel !== $this->mTitle->getContentModel()
- && !$wgUser->isAllowed( 'editcontentmodel' )
- ) {
- $status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL );
- return $status;
+ if ( $this->contentModel !== $this->mTitle->getContentModel() ) {
+ if ( !$wgContentHandlerUseDB ) {
+ $status->fatal( 'editpage-cannot-use-custom-model' );
+ $status->value = self::AS_CANNOT_USE_CUSTOM_MODEL;
+ return $status;
+ } elseif ( !$wgUser->isAllowed( 'editcontentmodel' ) ) {
+ $status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL );
+ return $status;
+ }
}
if ( $this->changeTags ) {
"copyrightwarning2": "Please note that all contributions to {{SITENAME}} may be edited, altered, or removed by other contributors.\nIf you do not want your writing to be edited mercilessly, then do not submit it here.<br />\nYou are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see $1 for details).\n<strong>Do not submit copyrighted work without permission!</strong>",
"editpage-head-copy-warn": "-",
"editpage-tos-summary": "-",
+ "editpage-cannot-use-custom-model": "The content model of this page cannot be changed.",
"longpage-hint": "-",
"longpageerror": "<strong>Error: The text you have submitted is {{PLURAL:$1|one kilobyte|$1 kilobytes}} long, which is longer than the maximum of {{PLURAL:$2|one kilobyte|$2 kilobytes}}.</strong>\nIt cannot be saved.",
"readonlywarning": "<strong>Warning: The database has been locked for maintenance, so you will not be able to save your edits right now.</strong>\nYou may wish to copy and paste your text into a text file and save it for later.\n\nThe administrator who locked it offered this explanation: $1",
"copyrightwarning2": "Copyright warning displayed under the edit box in editor\n*$1 - license name",
"editpage-head-copy-warn": "{{ignored}}Custom copyright warning in the header of an edit page.",
"editpage-tos-summary": "{{notranslate}}",
+ "editpage-cannot-use-custom-model": "Error message shown if the database does not support changing the content model of a page.",
"longpage-hint": "{{notranslate}}\n* <tt>$1</tt>: Size of the textbox formatted for output, using an appropriate unit ({{msg-mw|size-bytes}}, {{msg-mw|size-kilobytes}}, {{msg-mw|size-megabytes}}, {{msg-mw|size-gigabytes}})\n* <tt>$2</tt>: Size of the textbox in bytes, not formatnum",
"longpageerror": "Warning displayed when trying to save a text larger than the maximum size allowed.\n\nParameters:\n* $1 - submitted size (in kilobytes)\n* $2 - maximum size (in kilobytes)",
"readonlywarning": "Parameters:\n* $1 - reason",