Revert serie of "EditPage: Use context instead of globals"
[lhc/web/wiklou.git] / includes / EditPage.php
index 44f6d0f..e0080fa 100644 (file)
@@ -2491,8 +2491,7 @@ class EditPage {
                }
 
                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 );
@@ -2523,8 +2522,7 @@ class EditPage {
                        $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;
@@ -4064,11 +4062,14 @@ HTML
        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 = [