/**
* Attempt submission
- * @param array $resultDetails See docs for $result in internalAttemptSave
+ * @param array|bool $resultDetails See docs for $result in internalAttemptSave
* @throws UserBlockedError|ReadOnlyError|ThrottledError|PermissionsError
* @return Status The resulting status object.
*/
}
if ( !$this->isSupportedContentModel( $content->getModel() ) ) {
- throw new MWException( 'This content model is not supported: '
- . ContentHandler::getLocalizedName( $content->getModel() ) );
+ throw new MWException( 'This content model is not supported: ' . $content->getModel() );
}
return $content->serialize( $this->contentFormat );
* content.
*
* @param string|null|bool $text Text to unserialize
- * @return Content The content object created from $text. If $text was false
+ * @return Content|bool|null The content object created from $text. If $text was false
* or null, false resp. null will be returned instead.
*
* @throws MWException If unserializing the text results in a Content
$this->contentModel, $this->contentFormat );
if ( !$this->isSupportedContentModel( $content->getModel() ) ) {
- throw new MWException( 'This content model is not supported: '
- . ContentHandler::getLocalizedName( $content->getModel() ) );
+ throw new MWException( 'This content model is not supported: ' . $content->getModel() );
}
return $content;
* @return bool|stdClass
*/
protected function getLastDelete() {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$data = $dbr->selectRow(
[ 'logging', 'user' ],
[
* Parse the page for a preview. Subclasses may override this class, in order
* to parse with different options, or to otherwise modify the preview HTML.
*
- * @param Content @content The page content
- * @return Associative array with keys:
+ * @param Content $content The page content
+ * @return array with keys:
* - parserOutput: The ParserOutput object
* - html: The HTML to be displayed
*/
public function getEditButtons( &$tabindex ) {
$buttons = [];
- $labelAsPublish = $this->mArticle->getContext()->getConfig()->get( 'EditButtonPublishNotSave' );
+ $labelAsPublish =
+ $this->mArticle->getContext()->getConfig()->get( 'EditSubmitButtonLabelPublish' );
+
+ // Can't use $this->isNew as that's also true if we're adding a new section to an extant page
if ( $labelAsPublish ) {
- $buttonLabelKey = $this->isNew ? 'publishpage' : 'publishchanges';
+ $buttonLabelKey = !$this->mTitle->exists() ? 'publishpage' : 'publishchanges';
} else {
- $buttonLabelKey = $this->isNew ? 'savearticle' : 'savechanges';
+ $buttonLabelKey = !$this->mTitle->exists() ? 'savearticle' : 'savechanges';
}
$buttonLabel = wfMessage( $buttonLabelKey )->text();
$attribs = [