Merge "Allow putting the app ID in the password for bot passwords"
[lhc/web/wiklou.git] / includes / specials / SpecialChangeContentModel.php
index ee9f665..b37c475 100644 (file)
@@ -84,12 +84,20 @@ class SpecialChangeContentModel extends FormSpecialPage {
                        ],
                ];
                if ( $this->title ) {
+                       $options = $this->getOptionsForTitle( $this->title );
+                       if ( empty( $options ) ) {
+                               throw new ErrorPageError(
+                                       'changecontentmodel-emptymodels-title',
+                                       'changecontentmodel-emptymodels-text',
+                                       $this->title->getPrefixedText()
+                               );
+                       }
                        $fields['pagetitle']['readonly'] = true;
                        $fields += [
                                'model' => [
                                        'type' => 'select',
                                        'name' => 'model',
-                                       'options' => $this->getOptionsForTitle( $this->title ),
+                                       'options' => $options,
                                        'label-message' => 'changecontentmodel-model-label'
                                ],
                                'reason' => [
@@ -183,7 +191,14 @@ class SpecialChangeContentModel extends FormSpecialPage {
                        // Page doesn't exist, create an empty content object
                        $newContent = ContentHandler::getForModelID( $data['model'] )->makeEmptyContent();
                }
+
+               // All other checks have passed, let's check rate limits
+               if ( $user->pingLimiter( 'editcontentmodel' ) ) {
+                       throw new ThrottledError();
+               }
+
                $flags = $this->oldRevision ? EDIT_UPDATE : EDIT_NEW;
+               $flags |= EDIT_INTERNAL;
                if ( $user->isAllowed( 'bot' ) ) {
                        $flags |= EDIT_FORCE_BOT;
                }