Page MenuHomePhabricator

FilterCallbackRemoval.patch

Authored By
bzimport
Nov 21 2014, 11:55 PM
Size
10 KB
Referenced Files
None
Subscribers
None

FilterCallbackRemoval.patch

Index: phase3/includes/EditPage.php
===================================================================
--- phase3/includes/EditPage.php (revision 114115)
+++ phase3/includes/EditPage.php (working copy)
@@ -37,11 +37,6 @@
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
*/
const AS_HOOK_ERROR_EXPECTED = 212;
@@ -985,8 +980,6 @@
return true;
case self::AS_HOOK_ERROR:
- case self::AS_FILTERING:
- return false;
case self::AS_SUCCESS_NEW_ARTICLE:
$query = $resultDetails['redirect'] ? 'redirect=no' : '';
@@ -1057,8 +1050,7 @@
* 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();
@@ -1104,13 +1096,6 @@
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: phase3/includes/api/ApiEditPage.php
===================================================================
--- phase3/includes/api/ApiEditPage.php (revision 114115)
+++ phase3/includes/api/ApiEditPage.php (working copy)
@@ -282,9 +282,6 @@
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' );
@@ -386,7 +383,6 @@
array( 'noimageredirect-logged' ),
array( 'spamdetected', 'spam' ),
array( 'summaryrequired' ),
- array( 'filtered' ),
array( 'blockedtext' ),
array( 'contenttoobig', $wgMaxArticleSize ),
array( 'noedit-anon' ),
Index: phase3/includes/api/ApiBase.php
===================================================================
--- phase3/includes/api/ApiBase.php (revision 114115)
+++ phase3/includes/api/ApiBase.php (working copy)
@@ -1209,7 +1209,6 @@
'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: phase3/includes/DefaultSettings.php
===================================================================
--- phase3/includes/DefaultSettings.php (revision 114115)
+++ phase3/includes/DefaultSettings.php (working copy)
@@ -3779,21 +3779,6 @@
$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: extensions/MirrorTools/APIMirrorTools.php
===================================================================
--- extensions/MirrorTools/APIMirrorTools.php (revision 114024)
+++ extensions/MirrorTools/APIMirrorTools.php (working copy)
@@ -264,9 +264,6 @@
case EditPage::AS_SPAM_ERROR:
$this->dieUsageMsg( array( 'spamdetected', $result['spam'] ) );
- case EditPage::AS_FILTERING:
- $this->dieUsageMsg( array( 'filtered' ) );
-
case EditPage::AS_BLOCKED_PAGE_FOR_USER:
$this->dieUsageMsg( array( 'blockedtext' ) );
@@ -372,4 +369,4 @@
public function getVersion() {
return __CLASS__ . ': $Id: ApiMirrorEditPage.php 68353 2010-06-21 13:13:32Z hartman $';
}
-}
\ No newline at end of file
+}
Index: extensions/MirrorTools/MirrorTools.classes.php
===================================================================
--- extensions/MirrorTools/MirrorTools.classes.php (revision 114024)
+++ extensions/MirrorTools/MirrorTools.classes.php (working copy)
@@ -6,7 +6,7 @@
* @return one of the constants describing the result
*/
function mirrorinternalAttemptSave( &$result, $bot = false, $mirrorUser ) {
- global $wgFilterCallback, $wgUser, $wgOut, $wgParser;
+ global $wgUser, $wgOut, $wgParser;
global $wgMaxArticleSize;
$user = User::newFromName ( $mirrorUser, true );
wfProfileIn( __METHOD__ );
@@ -43,12 +43,6 @@
wfProfileOut( __METHOD__ );
return self::AS_SPAM_ERROR;
}
- if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section, $this->hookError, $this->summary ) ) {
- # Error messages or other handling should be performed by the filter function
- wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
- return self::AS_FILTERING;
- }
if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError, $this->summary ) ) ) {
# Error messages etc. could be handled within the hook...
wfProfileOut( __METHOD__ . '-checks' );
@@ -314,4 +308,4 @@
wfProfileOut( __METHOD__ );
return self::AS_END;
}
-}
\ No newline at end of file
+}
Index: extensions/Configure/scripts/findSettings.php
===================================================================
--- extensions/Configure/scripts/findSettings.php (revision 114024)
+++ extensions/Configure/scripts/findSettings.php (working copy)
@@ -167,7 +167,6 @@
'wgExtensionFunctions', // Extensions only
'wgExtensionMessagesFiles', // Extensions only
'wgFeedClasses', // Needs PHP code
- 'wgFilterCallback', // Needs PHP code
'wgHooks', // Extensions only
'wgInputEncoding', // Deprecated
'wgJobClasses', // Extensions only
Index: extensions/SemanticForms/includes/SF_Utils.php
===================================================================
--- extensions/SemanticForms/includes/SF_Utils.php (revision 114024)
+++ extensions/SemanticForms/includes/SF_Utils.php (working copy)
@@ -689,7 +689,6 @@
case EditPage::AS_TEXTBOX_EMPTY:
case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED:
case EditPage::AS_END:
- case EditPage::AS_FILTERING:
default:
return array( 'internalerror_text', array ( $error ) );
}
Index: extensions/WikiObjectModel/includes/apis/WOM_SetObjectModel.php
===================================================================
--- extensions/WikiObjectModel/includes/apis/WOM_SetObjectModel.php (revision 114024)
+++ extensions/WikiObjectModel/includes/apis/WOM_SetObjectModel.php (working copy)
@@ -212,9 +212,6 @@
case EditPage::AS_SPAM_ERROR:
$this->dieUsageMsg( array( 'spamdetected', $result['spam'] ) );
- case EditPage::AS_FILTERING:
- $this->dieUsageMsg( array( 'filtered' ) );
-
case EditPage::AS_BLOCKED_PAGE_FOR_USER:
$this->dieUsageMsg( array( 'blockedtext' ) );
@@ -316,7 +313,6 @@
array( 'noimageredirect-anon' ),
array( 'noimageredirect-logged' ),
array( 'spamdetected', 'spam' ),
- array( 'filtered' ),
array( 'blockedtext' ),
array( 'contenttoobig', $wgMaxArticleSize ),
array( 'noedit-anon' ),
Index: extensions/Form/Form.body.php
===================================================================
--- extensions/Form/Form.body.php (revision 114024)
+++ extensions/Form/Form.body.php (working copy)
@@ -255,7 +255,7 @@
# Had to crib some checks from EditPage.php, since they're not done in Article.php
function checkSave( $nt, $text ) {
- global $wgSpamRegex, $wgFilterCallback, $wgUser, $wgMaxArticleSize, $wgOut;
+ global $wgSpamRegex, $wgUser, $wgMaxArticleSize, $wgOut;
$matches = array();
$errortext = '';
@@ -266,9 +266,6 @@
if ( $wgSpamRegex && preg_match( $wgSpamRegex, $text, $matches ) ) {
$wgOut->showErrorPage( 'formsaveerror', 'formsaveerrortext' );
return false;
- } elseif ( $wgFilterCallback && $wgFilterCallback( $nt, $text, 0 ) ) {
- $wgOut->showErrorPage( 'formsaveerror', 'formsaveerrortext' );
- return false;
} elseif ( !wfRunHooks( 'EditFilter', array( $editPage, $text, 0, &$errortext ) ) ) {
# Hooks usually print their own error
return false;
Index: extensions/Postcomment/Postcomment.php
===================================================================
--- extensions/Postcomment/Postcomment.php (revision 114024)
+++ extensions/Postcomment/Postcomment.php (working copy)
@@ -37,7 +37,7 @@
function execute( $par ) {
global $wgUser, $wgOut, $wgLang, $wgMemc, $wgDBname;
global $wgRequest, $wgSitename, $wgLanguageCode;
- global $wgFilterCallback, $wgWhitelistEdit;
+ global $wgWhitelistEdit;
//echo "topic: " . $wgRequest->getVal("topic_name") . "<br />";
//echo "title: " . $wgRequest->getVal("title") . "<br />";
@@ -107,7 +107,8 @@
$text .= "\n\n$formattedComment\n\n";
$tmp = "";
- if ( $wgFilterCallback && $wgFilterCallback( $t, $text, $tmp) ) {
+ $errorText = '';
+ if ( !wfRunHooks( 'EditFilter', array( new FakeEditPage( $t ), $text, $tmp, &$errorText ) ) {
# Error messages or other handling should be performed by the filter function
return;
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7745
Default Alt Text
FilterCallbackRemoval.patch (10 KB)

Event Timeline