Merge "Add option to expose original sha1 in thumb url"
[lhc/web/wiklou.git] / includes / specials / SpecialChangeContentModel.php
index 7647999..b0def59 100644 (file)
@@ -44,22 +44,10 @@ class SpecialChangeContentModel extends FormSpecialPage {
                        // No form input yet
                        return true;
                }
-               try {
-                       $titleObj = Title::newFromTextThrow( $title );
-               } catch ( MalformedTitleException $e ) {
-                       $msg = $this->msg( $e->getErrorMessage() );
-                       $params = $e->getErrorMessageParameters();
-                       if ( $params ) {
-                               $msg->params( $params );
-                       }
-                       return $msg->parse();
-               }
-               if ( !$titleObj->canExist() ) {
-                       return $this->msg(
-                               'changecontentmodel-title-cantexist',
-                               $titleObj->getPrefixedText()
-                       )->escaped();
-               }
+
+               // Already validated by HTMLForm, but if not, throw
+               // and exception instead of a fatal
+               $titleObj = Title::newFromTextThrow( $title );
 
                $this->oldRevision = Revision::newFromTitle( $titleObj ) ?: false;
 
@@ -79,7 +67,8 @@ class SpecialChangeContentModel extends FormSpecialPage {
                $that = $this;
                $fields = array(
                        'pagetitle' => array(
-                               'type' => 'text',
+                               'type' => 'title',
+                               'creatable' => true,
                                'name' => 'pagetitle',
                                'default' => $this->par,
                                'label-message' => 'changecontentmodel-title-label',
@@ -150,7 +139,7 @@ class SpecialChangeContentModel extends FormSpecialPage {
                        throw new RuntimeException( "Form submission was not POSTed" );
                }
 
-               $this->title = Title::newFromText( $data['pagetitle' ] );
+               $this->title = Title::newFromText( $data['pagetitle'] );
                $user = $this->getUser();
                // Check permissions and make sure the user has permission to edit the specific page
                $errors = $this->title->getUserPermissionsErrors( 'editcontentmodel', $user );