From de9354fd3a7142be8bb402ce923002d9b3ed646c Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sun, 8 Apr 2012 21:20:05 +0100 Subject: [PATCH] (bug 30410) Remove deprecated $wgFilterCallback. The 'filtered' API error was also removed, along with EditPage::AS_FILTERING. Change-Id: Ic0b7b2f22ab61c9d760d280e5ab4e24af1160b7a --- RELEASE-NOTES-1.20 | 1 + includes/DefaultSettings.php | 15 --------------- includes/EditPage.php | 16 +--------------- includes/api/ApiBase.php | 1 - includes/api/ApiEditPage.php | 4 ---- 5 files changed, 2 insertions(+), 35 deletions(-) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index ebf30ca198..84e4417556 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -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. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 7c4db0df6c..d3c24ca301 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 diff --git a/includes/EditPage.php b/includes/EditPage.php index 92bca9ef58..cf17f76f36 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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' ); diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index edd9aca8b4..458214ec3b 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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" ), diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 796b049746..3153016223 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -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' ), -- 2.20.1