WikiPage: Remove premature Content::isValid check
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 2 Dec 2014 00:35:47 +0000 (00:35 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 2 Dec 2014 00:35:47 +0000 (00:35 +0000)
Content classes that implement the isValid method are causing
an "Internal error" to appear when saving from EditPage because
WikiPage throws an exception that isn't handled anywhere.

Turns out that ContentHandler already has infrastructure for
this in place in Content::prepareSave (which returns a Status
object with a relevant message informing the user), and WikiPage
is actually calling this already right after this.

Content::prepareSave defaults to using Content::isValid, so this
code is simply obsolete and premature as it calls an internal
method directly without handling it accordingly.

Change-Id: I69f18d9e101c2261b0ff7bd1b0459ea7fdd7ae9f

includes/page/WikiPage.php

index 61f0504..b99093c 100644 (file)
@@ -1831,11 +1831,6 @@ class WikiPage implements Page, IDBAccessObject {
                        $changed = !$content->equals( $old_content );
 
                        if ( $changed ) {
-                               if ( !$content->isValid() ) {
-                                       wfProfileOut( __METHOD__ );
-                                       throw new MWException( "New content failed validity check!" );
-                               }
-
                                $dbw->begin( __METHOD__ );
                                try {