From: Timo Tijhof Date: Tue, 2 Dec 2014 00:35:47 +0000 (+0000) Subject: WikiPage: Remove premature Content::isValid check X-Git-Tag: 1.31.0-rc.0~13128 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=3d920f00be3f6eb6fa8785b730f53d57a665cbdf;p=lhc%2Fweb%2Fwiklou.git WikiPage: Remove premature Content::isValid check 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 --- diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 61f0504e14..b99093cb27 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -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 {