(bug 30410) Remove deprecated $wgFilterCallback. The 'filtered' API error was also...
authorAlex Monk <krenair@gmail.com>
Sun, 8 Apr 2012 20:20:05 +0000 (21:20 +0100)
committerAlex Monk <krenair@gmail.com>
Tue, 24 Apr 2012 21:08:41 +0000 (22:08 +0100)
Change-Id: Ic0b7b2f22ab61c9d760d280e5ab4e24af1160b7a

RELEASE-NOTES-1.20
includes/DefaultSettings.php
includes/EditPage.php
includes/api/ApiBase.php
includes/api/ApiEditPage.php

index ebf30ca..84e4417 100644 (file)
@@ -88,6 +88,7 @@ production.
 * (bug 33564) transwiki import sometimes result in invalid title.
 * (bug 35572) Blocks appear to succeed even if query fails due to wrong DB structure
 * (bug 31757) Add a word-separator between help-messages in HTMLForm
+* (bug 30410) Removed deprecated $wgFilterCallback and the 'filtered' API error.
 
 === API changes in 1.20 ===
 * (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.
index 7c4db0d..d3c24ca 100644 (file)
@@ -3814,21 +3814,6 @@ $wgSpamRegex = array();
 /** Same as the above except for edit summaries */
 $wgSummarySpamRegex = array();
 
-/**
- * Similarly you can get a function to do the job. The function will be given
- * the following args:
- *   - a Title object for the article the edit is made on
- *   - the text submitted in the textarea (wpTextbox1)
- *   - the section number.
- * The return should be boolean indicating whether the edit matched some evilness:
- *  - true : block it
- *  - false : let it through
- *
- * @deprecated since 1.17 Use hooks. See SpamBlacklist extension.
- * @var $wgFilterCallback bool|string|Closure
- */
-$wgFilterCallback = false;
-
 /**
  * Whether to use DNS blacklists in $wgDnsBlacklistUrls to check for open proxies
  * @since 1.16
index 92bca9e..cf17f76 100644 (file)
@@ -36,11 +36,6 @@ class EditPage {
         */
        const AS_HOOK_ERROR                = 210;
 
-       /**
-        * Status: The filter function set in $wgFilterCallback returned true (= block it)
-        */
-       const AS_FILTERING                 = 211;
-
        /**
         * Status: A hook function returned an error
         */
@@ -990,7 +985,6 @@ class EditPage {
                                return true;
 
                        case self::AS_HOOK_ERROR:
-                       case self::AS_FILTERING:
                                return false;
 
                        case self::AS_SUCCESS_NEW_ARTICLE:
@@ -1062,8 +1056,7 @@ class EditPage {
         * AS_CONTENT_TOO_BIG and AS_BLOCKED_PAGE_FOR_USER. All that stuff needs to be cleaned up some time.
         */
        function internalAttemptSave( &$result, $bot = false ) {
-               global $wgFilterCallback, $wgUser, $wgRequest, $wgParser;
-               global $wgMaxArticleSize;
+               global $wgUser, $wgRequest, $wgParser, $wgMaxArticleSize;
 
                $status = Status::newGood();
 
@@ -1109,13 +1102,6 @@ class EditPage {
                        wfProfileOut( __METHOD__ );
                        return $status;
                }
-               if ( $wgFilterCallback && is_callable( $wgFilterCallback ) && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section, $this->hookError, $this->summary ) ) {
-                       # Error messages or other handling should be performed by the filter function
-                       $status->setResult( false, self::AS_FILTERING );
-                       wfProfileOut( __METHOD__ . '-checks' );
-                       wfProfileOut( __METHOD__ );
-                       return $status;
-               }
                if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError, $this->summary ) ) ) {
                        # Error messages etc. could be handled within the hook...
                        $status->fatal( 'hookaborted' );
index edd9aca..458214e 100644 (file)
@@ -1215,7 +1215,6 @@ abstract class ApiBase extends ContextSource {
                'noimageredirect-anon' => array( 'code' => 'noimageredirect-anon', 'info' => "Anonymous users can't create image redirects" ),
                'noimageredirect-logged' => array( 'code' => 'noimageredirect', 'info' => "You don't have permission to create image redirects" ),
                'spamdetected' => array( 'code' => 'spamdetected', 'info' => "Your edit was refused because it contained a spam fragment: \"\$1\"" ),
-               'filtered' => array( 'code' => 'filtered', 'info' => "The filter callback function refused your edit" ),
                'contenttoobig' => array( 'code' => 'contenttoobig', 'info' => "The content you supplied exceeds the article size limit of \$1 kilobytes" ),
                'noedit-anon' => array( 'code' => 'noedit-anon', 'info' => "Anonymous users can't edit pages" ),
                'noedit' => array( 'code' => 'noedit', 'info' => "You don't have permission to edit pages" ),
index 796b049..3153016 100644 (file)
@@ -291,9 +291,6 @@ class ApiEditPage extends ApiBase {
                        case EditPage::AS_SPAM_ERROR:
                                $this->dieUsageMsg( array( 'spamdetected', $result['spam'] ) );
 
-                       case EditPage::AS_FILTERING:
-                               $this->dieUsageMsg( 'filtered' );
-
                        case EditPage::AS_BLOCKED_PAGE_FOR_USER:
                                $this->dieUsageMsg( 'blockedtext' );
 
@@ -398,7 +395,6 @@ class ApiEditPage extends ApiBase {
                                array( 'noimageredirect-logged' ),
                                array( 'spamdetected', 'spam' ),
                                array( 'summaryrequired' ),
-                               array( 'filtered' ),
                                array( 'blockedtext' ),
                                array( 'contenttoobig', $wgMaxArticleSize ),
                                array( 'noedit-anon' ),