http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84605
Revision: 84605
Author: catrope
Date: 2011-03-23 17:00:41 +0000 (Wed, 23 Mar 2011)
Log Message:
-----------
1.17wmf1: MFT r84573, r84575, r84579, r84581, r84602 (upload / blacklist fixes)
Modified Paths:
--------------
branches/wmf/1.17wmf1/extensions/TitleBlacklist/TitleBlacklist.list.php
branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php
branches/wmf/1.17wmf1/includes/upload/UploadBase.php
Property Changed:
----------------
branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php
branches/wmf/1.17wmf1/includes/upload/UploadBase.php
Modified:
branches/wmf/1.17wmf1/extensions/TitleBlacklist/TitleBlacklist.list.php
===================================================================
--- branches/wmf/1.17wmf1/extensions/TitleBlacklist/TitleBlacklist.list.php
2011-03-23 16:45:11 UTC (rev 84604)
+++ branches/wmf/1.17wmf1/extensions/TitleBlacklist/TitleBlacklist.list.php
2011-03-23 17:00:41 UTC (rev 84605)
@@ -28,7 +28,6 @@
//Try to find something in the cache
$cachedBlacklist = $wgMemc->get( wfMemcKey(
"title_blacklist_entries" ) );
if( is_array( $cachedBlacklist ) && count( $cachedBlacklist ) >
0 && ( $cachedBlacklist[0]->getFormatVersion() == self::VERSION ) ) {
-
$this->mBlacklist = $cachedBlacklist;
wfProfileOut( __METHOD__ );
return;
@@ -105,7 +104,7 @@
return '';
}
-
+
/**
* Parse blacklist from a string
*
@@ -116,8 +115,7 @@
wfProfileIn( __METHOD__ );
$lines = preg_split( "/\r?\n/", $list );
$result = array();
- foreach ( $lines as $line )
- {
+ foreach ( $lines as $line ) {
$line = TitleBlacklistEntry :: newFromString( $line );
if ( $line ) {
$result[] = $line;
@@ -147,7 +145,7 @@
}
/**
- * Check whether the blacklist restricts
+ * Check whether the blacklist restricts
* performing a specific action on the given Title
*
* @param $title Title to check
@@ -161,18 +159,18 @@
}
$blacklist = $this->getBlacklist();
foreach ( $blacklist as $item ) {
- if( !$item->matches( $title, $action ) ) {
+ if( $item->matches( $title, $action ) ) {
if( $this->isWhitelisted( $title, $action ) ) {
return false;
}
- return $item;
+ return $item; // "returning true"
}
}
return false;
}
-
+
/**
- * Check whether it has been explicitly whitelisted that the
+ * Check whether it has been explicitly whitelisted that the
* current User may perform a specific action on the given Title
*
* @param $title Title to check
@@ -186,13 +184,13 @@
}
$whitelist = $this->getWhitelist();
foreach( $whitelist as $item ) {
- if( !$item->matches( $title, $action ) ) {
+ if( $item->matches( $title, $action ) ) {
return true;
}
}
return false;
}
-
+
/**
* Get the current blacklist
*
@@ -204,7 +202,7 @@
}
return $this->mBlacklist;
}
-
+
/*
* Get the current whitelist
*
@@ -216,7 +214,7 @@
}
return $this->mWhitelist;
}
-
+
/**
* Get the text of a blacklist source via HTTP
*
@@ -236,7 +234,7 @@
}
return $result;
}
-
+
/**
* Invalidate the blacklist cache
*/
@@ -256,13 +254,14 @@
foreach( $blacklist as $e ) {
wfSuppressWarnings();
$regex = $e->getRegex();
- if( preg_match( "/{$regex}/u", '' ) === false )
+ if( preg_match( "/{$regex}/u", '' ) === false ) {
$badEntries[] = $e->getRaw();
+ }
wfRestoreWarnings();
}
return $badEntries;
}
-
+
/**
* Inidcates whether user can override blacklist on certain action.
*
@@ -306,7 +305,8 @@
*
* @param $title Title to check
* @param $action %Action to check
- * @return TRUE if the user can; otherwise FALSE
+ * @return TRUE if the the regex matches the title, and is not
overridden
+ * else false if it doesn't match (or was overridden)
*/
public function matches( $title, $action ) {
global $wgUser;
@@ -315,24 +315,24 @@
wfRestoreWarnings();
if( $match ) {
if( isset( $this->mParams['autoconfirmed'] ) &&
$wgUser->isAllowed( 'autoconfirmed' ) ) {
- return true;
+ return false;
}
if( isset( $this->mParams['moveonly'] ) && $action !=
'move' ) {
- return true;
+ return false;
}
if( isset( $this->mParams['newaccountonly'] ) &&
$action != 'new-account' ) {
- return true;
+ return false;
}
if( !isset( $this->mParams['noedit'] ) && $action ==
'edit' ) {
- return true;
+ return false;
}
if ( isset( $this->mParams['reupload'] ) && $action ==
'upload' ) {
// Special:Upload also checks 'create'
permissions when not reuploading
- return true;
+ return false;
}
- return false;
+ return true;
}
- return true;
+ return false;
}
/**
Modified: branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php
===================================================================
--- branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php 2011-03-23
16:45:11 UTC (rev 84604)
+++ branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php 2011-03-23
17:00:41 UTC (rev 84605)
@@ -448,8 +448,8 @@
$permErrors = $this->mUpload->verifyPermissions( $wgUser );
if( $permErrors !== true ) {
$code = array_shift( $permErrors[0] );
- $this->showRecoverableUploadError( wfMsgExt( $code[0],
- 'parseinline', $code[1] ) );
+ $this->showRecoverableUploadError( wfMsgExt( $code,
+ 'parseinline', $permErrors[0] ) );
return;
}
Property changes on: branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes/specials/SpecialUpload.php:51646
/branches/sqlite/includes/specials/SpecialUpload.php:58211-58321
/branches/wmf/1.16wmf4/includes/specials/SpecialUpload.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/specials/SpecialUpload.php:53381,56967,60970
/trunk/phase3/includes/specials/SpecialUpload.php:78560,79758,83586-83587,83817,83876,83979,84118,84228
+ /branches/REL1_15/phase3/includes/specials/SpecialUpload.php:51646
/branches/sqlite/includes/specials/SpecialUpload.php:58211-58321
/branches/wmf/1.16wmf4/includes/specials/SpecialUpload.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/specials/SpecialUpload.php:53381,56967,60970
/trunk/phase3/includes/specials/SpecialUpload.php:78560,79758,83586-83587,83817,83876,83979,84118,84228,84579
Modified: branches/wmf/1.17wmf1/includes/upload/UploadBase.php
===================================================================
--- branches/wmf/1.17wmf1/includes/upload/UploadBase.php 2011-03-23
16:45:11 UTC (rev 84604)
+++ branches/wmf/1.17wmf1/includes/upload/UploadBase.php 2011-03-23
17:00:41 UTC (rev 84605)
@@ -402,7 +402,7 @@
}
$permErrors = $nt->getUserPermissionsErrors( 'edit', $user );
$permErrorsUpload = $nt->getUserPermissionsErrors( 'upload',
$user );
- if ( $nt->exists() ) {
+ if ( !$nt->exists() ) {
$permErrorsCreate = $nt->getUserPermissionsErrors(
'createpage', $user );
} else {
$permErrorsCreate = array();
Property changes on: branches/wmf/1.17wmf1/includes/upload/UploadBase.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes/upload/UploadBase.php:51646
/branches/new-installer/phase3/includes/upload/UploadBase.php:43664-66004
/branches/sqlite/includes/upload/UploadBase.php:58211-58321
/branches/uploadwizard/phase3/includes/upload/UploadBase.php:73550-75905
/branches/wmf/1.16wmf4/includes/upload/UploadBase.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/upload/UploadBase.php:53381,60970
/trunk/phase3/includes/upload/UploadBase.php:78078,78285,79246,79358,79480,79655,79693,79706,79710,80576,80583,80656,80842,80900,80913,80918-80920,80973-80974,80979,80993,83586-83587,83817,83876,83979,84118,84228
+ /branches/REL1_15/phase3/includes/upload/UploadBase.php:51646
/branches/new-installer/phase3/includes/upload/UploadBase.php:43664-66004
/branches/sqlite/includes/upload/UploadBase.php:58211-58321
/branches/uploadwizard/phase3/includes/upload/UploadBase.php:73550-75905
/branches/wmf/1.16wmf4/includes/upload/UploadBase.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/upload/UploadBase.php:53381,60970
/trunk/phase3/includes/upload/UploadBase.php:78078,78285,79246,79358,79480,79655,79693,79706,79710,80576,80583,80656,80842,80900,80913,80918-80920,80973-80974,80979,80993,83586-83587,83817,83876,83979,84118,84228,84573
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs