Move closing parenthesis from multi line if and function to own line
The Line continuation Coding conventions prefers the closing parenthesis on the same line than the beginning curly braces. This is done for ifs and functions. Also move some boolean operator from the end of a line to the beginning and changed some indentation to make the condition hopefully better readable. Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
This commit is contained in:
parent
5ca5672aac
commit
0bc583af2c
50 changed files with 253 additions and 265 deletions
|
|
@ -1552,8 +1552,8 @@ class Article implements Page {
|
|||
}
|
||||
|
||||
if ( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'wpEditToken' ),
|
||||
array( 'delete', $this->getTitle()->getPrefixedText() ) ) )
|
||||
{
|
||||
array( 'delete', $this->getTitle()->getPrefixedText() ) )
|
||||
) {
|
||||
# Flag to hide all contents of the archived revisions
|
||||
$suppress = $request->getVal( 'wpSuppress' ) && $user->isAllowed( 'suppressrevision' );
|
||||
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ class Block {
|
|||
*/
|
||||
function __construct( $address = '', $user = 0, $by = 0, $reason = '',
|
||||
$timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
|
||||
$hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byText = '' )
|
||||
{
|
||||
$hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byText = ''
|
||||
) {
|
||||
if ( $timestamp === 0 ) {
|
||||
$timestamp = wfTimestampNow();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,9 +319,7 @@ class IcuCollation extends Collation {
|
|||
|
||||
// Check for CJK
|
||||
$firstChar = mb_substr( $string, 0, 1, 'UTF-8' );
|
||||
if ( ord( $firstChar ) > 0x7f
|
||||
&& self::isCjk( utf8ToCodepoint( $firstChar ) ) )
|
||||
{
|
||||
if ( ord( $firstChar ) > 0x7f && self::isCjk( utf8ToCodepoint( $firstChar ) ) ) {
|
||||
return $firstChar;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -457,9 +457,9 @@ class EditPage {
|
|||
# Ignore some permissions errors when a user is just previewing/viewing diffs
|
||||
$remove = array();
|
||||
foreach ( $permErrors as $error ) {
|
||||
if ( ( $this->preview || $this->diff ) &&
|
||||
( $error[0] == 'blockedtext' || $error[0] == 'autoblockedtext' ) )
|
||||
{
|
||||
if ( ( $this->preview || $this->diff )
|
||||
&& ( $error[0] == 'blockedtext' || $error[0] == 'autoblockedtext' )
|
||||
) {
|
||||
$remove[] = $error;
|
||||
}
|
||||
}
|
||||
|
|
@ -567,10 +567,10 @@ class EditPage {
|
|||
} elseif ( ( $wgRequest->getVal( 'preload' ) !== null || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) {
|
||||
// Standard preference behavior
|
||||
return true;
|
||||
} elseif ( !$this->mTitle->exists() &&
|
||||
isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) &&
|
||||
$wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] )
|
||||
{
|
||||
} elseif ( !$this->mTitle->exists()
|
||||
&& isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] )
|
||||
&& $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()]
|
||||
) {
|
||||
// Categories are special
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -728,9 +728,9 @@ class EditPage {
|
|||
$this->watchthis = $request->getCheck( 'wpWatchthis' );
|
||||
|
||||
# Don't force edit summaries when a user is editing their own user or talk page
|
||||
if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) &&
|
||||
$this->mTitle->getText() == $wgUser->getName() )
|
||||
{
|
||||
if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK )
|
||||
&& $this->mTitle->getText() == $wgUser->getName()
|
||||
) {
|
||||
$this->allowBlankSummary = true;
|
||||
} else {
|
||||
$this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ) || !$wgUser->getOption( 'forceeditsummary' );
|
||||
|
|
@ -1792,9 +1792,9 @@ class EditPage {
|
|||
// Show the edit conflict page for certain recognized errors from doEdit(),
|
||||
// but don't show it for errors from extension hooks
|
||||
$errors = $doEditStatus->getErrorsArray();
|
||||
if ( in_array( $errors[0][0], array( 'edit-gone-missing', 'edit-conflict',
|
||||
'edit-already-exists' ) ) )
|
||||
{
|
||||
if ( in_array( $errors[0][0],
|
||||
array( 'edit-gone-missing', 'edit-conflict', 'edit-already-exists' ) )
|
||||
) {
|
||||
$this->isConflict = true;
|
||||
// Destroys data doEdit() put in $status->value but who cares
|
||||
$doEditStatus->value = self::AS_END;
|
||||
|
|
|
|||
|
|
@ -965,8 +965,8 @@ function wfIsDebugRawPage() {
|
|||
|| (
|
||||
isset( $_SERVER['SCRIPT_NAME'] )
|
||||
&& substr( $_SERVER['SCRIPT_NAME'], -8 ) == 'load.php'
|
||||
) )
|
||||
{
|
||||
)
|
||||
) {
|
||||
$cache = true;
|
||||
} else {
|
||||
$cache = false;
|
||||
|
|
@ -1463,9 +1463,9 @@ function wfMsgForContent( $key ) {
|
|||
$args = func_get_args();
|
||||
array_shift( $args );
|
||||
$forcontent = true;
|
||||
if ( is_array( $wgForceUIMsgAsContentMsg ) &&
|
||||
in_array( $key, $wgForceUIMsgAsContentMsg ) )
|
||||
{
|
||||
if ( is_array( $wgForceUIMsgAsContentMsg )
|
||||
&& in_array( $key, $wgForceUIMsgAsContentMsg )
|
||||
) {
|
||||
$forcontent = false;
|
||||
}
|
||||
return wfMsgReal( $key, $args, true, $forcontent );
|
||||
|
|
@ -1486,9 +1486,9 @@ function wfMsgForContentNoTrans( $key ) {
|
|||
$args = func_get_args();
|
||||
array_shift( $args );
|
||||
$forcontent = true;
|
||||
if ( is_array( $wgForceUIMsgAsContentMsg ) &&
|
||||
in_array( $key, $wgForceUIMsgAsContentMsg ) )
|
||||
{
|
||||
if ( is_array( $wgForceUIMsgAsContentMsg )
|
||||
&& in_array( $key, $wgForceUIMsgAsContentMsg )
|
||||
) {
|
||||
$forcontent = false;
|
||||
}
|
||||
return wfMsgReal( $key, $args, true, $forcontent, false );
|
||||
|
|
@ -1993,11 +1993,11 @@ function wfClientAcceptsGzip( $force = false ) {
|
|||
# @todo FIXME: We may want to blacklist some broken browsers
|
||||
$m = array();
|
||||
if ( preg_match(
|
||||
'/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
|
||||
$_SERVER['HTTP_ACCEPT_ENCODING'],
|
||||
$m )
|
||||
)
|
||||
{
|
||||
'/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
|
||||
$_SERVER['HTTP_ACCEPT_ENCODING'],
|
||||
$m
|
||||
)
|
||||
) {
|
||||
if ( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) ) {
|
||||
$result = false;
|
||||
return $result;
|
||||
|
|
|
|||
|
|
@ -306,14 +306,10 @@ class HtmlFormatter {
|
|||
} elseif ( strpos( $selector, '#' ) === 0 ) {
|
||||
$type = 'ID';
|
||||
$rawName = substr( $selector, 1 );
|
||||
} elseif ( strpos( $selector, '.' ) !== 0 &&
|
||||
strpos( $selector, '.' ) !== false )
|
||||
{
|
||||
} elseif ( strpos( $selector, '.' ) !== 0 && strpos( $selector, '.' ) !== false ) {
|
||||
$type = 'TAG_CLASS';
|
||||
$rawName = $selector;
|
||||
} elseif ( strpos( $selector, '[' ) === false
|
||||
&& strpos( $selector, ']' ) === false )
|
||||
{
|
||||
} elseif ( strpos( $selector, '[' ) === false && strpos( $selector, ']' ) === false ) {
|
||||
$type = 'TAG';
|
||||
$rawName = $selector;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -377,8 +377,8 @@ class ImagePage extends Article {
|
|||
// since that is added to the message separately, so
|
||||
// it can be denoted as the current size being shown.
|
||||
if ( $size[0] <= $width_orig && $size[1] <= $height_orig
|
||||
&& $size[0] != $width && $size[1] != $height )
|
||||
{
|
||||
&& $size[0] != $width && $size[1] != $height
|
||||
) {
|
||||
$sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] );
|
||||
if ( $sizeLink ) {
|
||||
$otherSizes[] = $sizeLink;
|
||||
|
|
@ -1203,8 +1203,8 @@ class ImageHistoryList extends ContextSource {
|
|||
$lang = $this->getLanguage();
|
||||
$user = $this->getUser();
|
||||
if ( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE, $user )
|
||||
&& !$file->isDeleted( File::DELETED_FILE ) )
|
||||
{
|
||||
&& !$file->isDeleted( File::DELETED_FILE )
|
||||
) {
|
||||
$params = array(
|
||||
'width' => '120',
|
||||
'height' => '120',
|
||||
|
|
|
|||
|
|
@ -264,8 +264,8 @@ class Linker {
|
|||
*/
|
||||
public static function linkKnown(
|
||||
$target, $html = null, $customAttribs = array(),
|
||||
$query = array(), $options = array( 'known', 'noclasses' ) )
|
||||
{
|
||||
$query = array(), $options = array( 'known', 'noclasses' )
|
||||
) {
|
||||
return self::link( $target, $html, $customAttribs, $query, $options );
|
||||
}
|
||||
|
||||
|
|
@ -562,8 +562,8 @@ class Linker {
|
|||
* @return String: HTML for an image, with links, wrappers, etc.
|
||||
*/
|
||||
public static function makeImageLink( /*Parser*/ $parser, Title $title, $file, $frameParams = array(),
|
||||
$handlerParams = array(), $time = false, $query = "", $widthOption = null )
|
||||
{
|
||||
$handlerParams = array(), $time = false, $query = "", $widthOption = null
|
||||
) {
|
||||
$res = null;
|
||||
$dummy = new DummyLinker;
|
||||
if ( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$dummy, &$title,
|
||||
|
|
@ -749,8 +749,8 @@ class Linker {
|
|||
* @return mixed
|
||||
*/
|
||||
public static function makeThumbLinkObj( Title $title, $file, $label = '', $alt,
|
||||
$align = 'right', $params = array(), $framed = false, $manualthumb = "" )
|
||||
{
|
||||
$align = 'right', $params = array(), $framed = false, $manualthumb = ""
|
||||
) {
|
||||
$frameParams = array(
|
||||
'alt' => $alt,
|
||||
'caption' => $label,
|
||||
|
|
@ -775,8 +775,8 @@ class Linker {
|
|||
* @return mixed
|
||||
*/
|
||||
public static function makeThumbLink2( Title $title, $file, $frameParams = array(),
|
||||
$handlerParams = array(), $time = false, $query = "" )
|
||||
{
|
||||
$handlerParams = array(), $time = false, $query = ""
|
||||
) {
|
||||
global $wgStylePath, $wgContLang;
|
||||
$exists = $file && $file->exists();
|
||||
|
||||
|
|
@ -1470,8 +1470,8 @@ class Linker {
|
|||
$target = Title::newFromText( $linkTarget );
|
||||
if ( $target ) {
|
||||
if ( $target->getText() == '' && $target->getInterwiki() === ''
|
||||
&& !self::$commentLocal && self::$commentContextTitle )
|
||||
{
|
||||
&& !self::$commentLocal && self::$commentContextTitle
|
||||
) {
|
||||
$newTarget = clone ( self::$commentContextTitle );
|
||||
$newTarget->setFragment( '#' . $target->getFragment() );
|
||||
$target = $newTarget;
|
||||
|
|
|
|||
|
|
@ -447,8 +447,8 @@ class OutputPage extends ContextSource {
|
|||
if ( $module instanceof ResourceLoaderModule
|
||||
&& $module->getOrigin() <= $this->getAllowedModules( $type )
|
||||
&& ( is_null( $position ) || $module->getPosition() == $position )
|
||||
&& ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) ) )
|
||||
{
|
||||
&& ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) )
|
||||
) {
|
||||
$filteredModules[] = $val;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -682,8 +682,8 @@ class Preferences {
|
|||
$minDiff = $tz[1];
|
||||
$tzSetting = sprintf( '%+03d:%02d', floor( $minDiff / 60 ), abs( $minDiff ) % 60 );
|
||||
} elseif ( count( $tz ) > 1 && $tz[0] == 'ZoneInfo' &&
|
||||
!in_array( $tzOffset, HTMLFormField::flattenOptions( $tzOptions ) ) )
|
||||
{
|
||||
!in_array( $tzOffset, HTMLFormField::flattenOptions( $tzOptions ) )
|
||||
) {
|
||||
# Timezone offset can vary with DST
|
||||
$userTZ = timezone_open( $tz[2] );
|
||||
if ( $userTZ !== false ) {
|
||||
|
|
|
|||
|
|
@ -1311,8 +1311,8 @@ class Revision implements IDBAccessObject {
|
|||
|
||||
global $wgLegacyEncoding;
|
||||
if ( $text !== false && $wgLegacyEncoding
|
||||
&& !in_array( 'utf-8', $flags ) && !in_array( 'utf8', $flags ) )
|
||||
{
|
||||
&& !in_array( 'utf-8', $flags ) && !in_array( 'utf8', $flags )
|
||||
) {
|
||||
# Old revisions kept around in a legacy encoding?
|
||||
# Upconvert on demand.
|
||||
# ("utf8" checked for compatibility with some broken
|
||||
|
|
|
|||
|
|
@ -102,10 +102,10 @@ if ( isset( $wgFileStore['deleted']['directory'] ) ) {
|
|||
$wgDeletedDirectory = $wgFileStore['deleted']['directory'];
|
||||
}
|
||||
|
||||
if ( isset( $wgFooterIcons['copyright'] ) &&
|
||||
isset( $wgFooterIcons['copyright']['copyright'] ) &&
|
||||
$wgFooterIcons['copyright']['copyright'] === array() )
|
||||
{
|
||||
if ( isset( $wgFooterIcons['copyright'] )
|
||||
&& isset( $wgFooterIcons['copyright']['copyright'] )
|
||||
&& $wgFooterIcons['copyright']['copyright'] === array()
|
||||
) {
|
||||
if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) {
|
||||
$wgFooterIcons['copyright']['copyright'] = $wgCopyrightIcon;
|
||||
} elseif ( $wgRightsIcon || $wgRightsText ) {
|
||||
|
|
@ -119,10 +119,10 @@ if ( isset( $wgFooterIcons['copyright'] ) &&
|
|||
}
|
||||
}
|
||||
|
||||
if ( isset( $wgFooterIcons['poweredby'] ) &&
|
||||
isset( $wgFooterIcons['poweredby']['mediawiki'] ) &&
|
||||
$wgFooterIcons['poweredby']['mediawiki']['src'] === null )
|
||||
{
|
||||
if ( isset( $wgFooterIcons['poweredby'] )
|
||||
&& isset( $wgFooterIcons['poweredby']['mediawiki'] )
|
||||
&& $wgFooterIcons['poweredby']['mediawiki']['src'] === null
|
||||
) {
|
||||
$wgFooterIcons['poweredby']['mediawiki']['src'] = "$wgStylePath/common/images/poweredby_mediawiki_88x31.png";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ class StreamFile {
|
|||
return 'unknown/unknown';
|
||||
}
|
||||
if ( $wgCheckFileExtensions && $wgStrictFileExtensions
|
||||
&& !UploadBase::checkFileExtensionList( $extList, $wgFileExtensions ) )
|
||||
{
|
||||
&& !UploadBase::checkFileExtensionList( $extList, $wgFileExtensions )
|
||||
) {
|
||||
return 'unknown/unknown';
|
||||
}
|
||||
if ( $wgVerifyMimeType && in_array( strtolower( $type ), $wgMimeTypeBlacklist ) ) {
|
||||
|
|
|
|||
|
|
@ -1548,9 +1548,9 @@ class Title {
|
|||
$url = false;
|
||||
$matches = array();
|
||||
|
||||
if ( !empty( $wgActionPaths ) &&
|
||||
preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches ) )
|
||||
{
|
||||
if ( !empty( $wgActionPaths )
|
||||
&& preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches )
|
||||
) {
|
||||
$action = urldecode( $matches[2] );
|
||||
if ( isset( $wgActionPaths[$action] ) ) {
|
||||
$query = $matches[1];
|
||||
|
|
@ -1564,12 +1564,12 @@ class Title {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $url === false &&
|
||||
$wgVariantArticlePath &&
|
||||
$wgContLang->getCode() === $this->getPageLanguage()->getCode() &&
|
||||
$this->getPageLanguage()->hasVariants() &&
|
||||
preg_match( '/^variant=([^&]*)$/', $query, $matches ) )
|
||||
{
|
||||
if ( $url === false
|
||||
&& $wgVariantArticlePath
|
||||
&& $wgContLang->getCode() === $this->getPageLanguage()->getCode()
|
||||
&& $this->getPageLanguage()->hasVariants()
|
||||
&& preg_match( '/^variant=([^&]*)$/', $query, $matches )
|
||||
) {
|
||||
$variant = urldecode( $matches[1] );
|
||||
if ( $this->getPageLanguage()->hasVariant( $variant ) ) {
|
||||
// Only do the variant replacement if the given variant is a valid
|
||||
|
|
@ -2125,9 +2125,9 @@ class Title {
|
|||
if ( $title_protection['pt_create_perm'] == 'autoconfirmed' ) {
|
||||
$title_protection['pt_create_perm'] = 'editsemiprotected'; // B/C
|
||||
}
|
||||
if ( $title_protection['pt_create_perm'] == '' ||
|
||||
!$user->isAllowed( $title_protection['pt_create_perm'] ) )
|
||||
{
|
||||
if ( $title_protection['pt_create_perm'] == ''
|
||||
|| !$user->isAllowed( $title_protection['pt_create_perm'] )
|
||||
) {
|
||||
$errors[] = array( 'titleprotected', User::whoIs( $title_protection['pt_user'] ), $title_protection['pt_reason'] );
|
||||
}
|
||||
}
|
||||
|
|
@ -2148,8 +2148,8 @@ class Title {
|
|||
}
|
||||
} elseif ( $action == 'delete' ) {
|
||||
if ( $doExpensiveQueries && $wgDeleteRevisionsLimit
|
||||
&& !$this->userCan( 'bigdelete', $user ) && $this->isBigDeletion() )
|
||||
{
|
||||
&& !$this->userCan( 'bigdelete', $user ) && $this->isBigDeletion()
|
||||
) {
|
||||
$errors[] = array( 'delete-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -3216,8 +3216,8 @@ class Title {
|
|||
|
||||
# Redundant interwiki prefix to the local wiki
|
||||
if ( $wgLocalInterwiki !== false
|
||||
&& 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) )
|
||||
{
|
||||
&& 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki )
|
||||
) {
|
||||
if ( $dbkey == '' ) {
|
||||
# Can't have an empty self-link
|
||||
return false;
|
||||
|
|
@ -3995,9 +3995,9 @@ class Title {
|
|||
// We don't know whether this function was called before
|
||||
// or after moving the root page, so check both
|
||||
// $this and $nt
|
||||
if ( $oldSubpage->getArticleID() == $this->getArticleID() ||
|
||||
$oldSubpage->getArticleID() == $nt->getArticleID() )
|
||||
{
|
||||
if ( $oldSubpage->getArticleID() == $this->getArticleID()
|
||||
|| $oldSubpage->getArticleID() == $nt->getArticleID()
|
||||
) {
|
||||
// When moving a page to a subpage of itself,
|
||||
// don't move it twice
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -1307,8 +1307,8 @@ class User {
|
|||
|
||||
// Proxy blocking
|
||||
if ( !$block instanceof Block && $ip !== null && !$this->isAllowed( 'proxyunbannable' )
|
||||
&& !in_array( $ip, $wgProxyWhitelist ) )
|
||||
{
|
||||
&& !in_array( $ip, $wgProxyWhitelist )
|
||||
) {
|
||||
// Local list
|
||||
if ( self::isLocallyBlockedProxy( $ip ) ) {
|
||||
$block = new Block;
|
||||
|
|
@ -3078,9 +3078,7 @@ class User {
|
|||
// and when it does have to be executed, it can be on a slave
|
||||
// If this is the user's newtalk page, we always update the timestamp
|
||||
$force = '';
|
||||
if ( $title->getNamespace() == NS_USER_TALK &&
|
||||
$title->getText() == $this->getName() )
|
||||
{
|
||||
if ( $title->getNamespace() == NS_USER_TALK && $title->getText() == $this->getName() ) {
|
||||
$force = 'force';
|
||||
}
|
||||
|
||||
|
|
@ -3612,9 +3610,9 @@ class User {
|
|||
// Some wikis were converted from ISO 8859-1 to UTF-8, the passwords can't be converted
|
||||
// Check for this with iconv
|
||||
$cp1252Password = iconv( 'UTF-8', 'WINDOWS-1252//TRANSLIT', $password );
|
||||
if ( $cp1252Password != $password &&
|
||||
self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) )
|
||||
{
|
||||
if ( $cp1252Password != $password
|
||||
&& self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId )
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -630,11 +630,11 @@ class EmailNotification {
|
|||
// Send updates to watchers other than the current editor
|
||||
$userArray = UserArray::newFromIDs( $watchers );
|
||||
foreach ( $userArray as $watchingUser ) {
|
||||
if ( $watchingUser->getOption( 'enotifwatchlistpages' ) &&
|
||||
( !$minorEdit || $watchingUser->getOption( 'enotifminoredits' ) ) &&
|
||||
$watchingUser->isEmailConfirmed() &&
|
||||
$watchingUser->getID() != $userTalkId )
|
||||
{
|
||||
if ( $watchingUser->getOption( 'enotifwatchlistpages' )
|
||||
&& ( !$minorEdit || $watchingUser->getOption( 'enotifminoredits' ) )
|
||||
&& $watchingUser->isEmailConfirmed()
|
||||
&& $watchingUser->getID() != $userTalkId
|
||||
) {
|
||||
$this->compose( $watchingUser );
|
||||
}
|
||||
}
|
||||
|
|
@ -672,9 +672,9 @@ class EmailNotification {
|
|||
wfDebug( __METHOD__ . ": user talk page edited, but user does not exist\n" );
|
||||
} elseif ( $targetUser->getId() == $editor->getId() ) {
|
||||
wfDebug( __METHOD__ . ": user edited their own talk page, no notification sent\n" );
|
||||
} elseif ( $targetUser->getOption( 'enotifusertalkpages' ) &&
|
||||
( !$minorEdit || $targetUser->getOption( 'enotifminoredits' ) ) )
|
||||
{
|
||||
} elseif ( $targetUser->getOption( 'enotifusertalkpages' )
|
||||
&& ( !$minorEdit || $targetUser->getOption( 'enotifminoredits' ) )
|
||||
) {
|
||||
if ( !$targetUser->isEmailConfirmed() ) {
|
||||
wfDebug( __METHOD__ . ": talk page owner doesn't have validated email\n" );
|
||||
} elseif ( !wfRunHooks( 'AbortTalkPageEmailNotification', array( $targetUser, $title ) ) ) {
|
||||
|
|
@ -782,8 +782,8 @@ class EmailNotification {
|
|||
$adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
|
||||
if ( $wgEnotifRevealEditorAddress
|
||||
&& ( $this->editor->getEmail() != '' )
|
||||
&& $this->editor->getOption( 'enotifrevealaddr' ) )
|
||||
{
|
||||
&& $this->editor->getOption( 'enotifrevealaddr' )
|
||||
) {
|
||||
$editorAddress = new MailAddress( $this->editor );
|
||||
if ( $wgEnotifFromEditor ) {
|
||||
$this->from = $editorAddress;
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ class WebRequest {
|
|||
$router->add( "$wgScript/$1" );
|
||||
|
||||
if ( isset( $_SERVER['SCRIPT_NAME'] )
|
||||
&& preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] ) )
|
||||
{
|
||||
&& preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] )
|
||||
) {
|
||||
# Check for SCRIPT_NAME, we handle index.php explicitly
|
||||
# But we do have some other .php files such as img_auth.php
|
||||
# Don't let root article paths clober the parsing for them
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ class MediaWiki {
|
|||
// Check variant links so that interwiki links don't have to worry
|
||||
// about the possible different language variants
|
||||
if ( count( $wgContLang->getVariants() ) > 1
|
||||
&& !is_null( $ret ) && $ret->getArticleID() == 0 )
|
||||
{
|
||||
&& !is_null( $ret ) && $ret->getArticleID() == 0
|
||||
) {
|
||||
$wgContLang->findVariantLink( $title, $ret );
|
||||
}
|
||||
}
|
||||
|
|
@ -197,9 +197,9 @@ class MediaWiki {
|
|||
wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) );
|
||||
|
||||
// Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
|
||||
if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' ) ||
|
||||
$title->isSpecial( 'Badtitle' ) )
|
||||
{
|
||||
if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' )
|
||||
|| $title->isSpecial( 'Badtitle' )
|
||||
) {
|
||||
$this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
|
||||
wfProfileOut( __METHOD__ );
|
||||
throw new BadTitleError();
|
||||
|
|
@ -242,8 +242,8 @@ class MediaWiki {
|
|||
}
|
||||
// Check for a redirect loop
|
||||
if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url )
|
||||
&& $title->isLocal() )
|
||||
{
|
||||
&& $title->isLocal()
|
||||
) {
|
||||
// 301 so google et al report the target as the actual url.
|
||||
$output->redirect( $url, 301 );
|
||||
} else {
|
||||
|
|
@ -253,11 +253,11 @@ class MediaWiki {
|
|||
}
|
||||
// Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
|
||||
} elseif ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted()
|
||||
&& ( $request->getVal( 'title' ) === null ||
|
||||
$title->getPrefixedDBkey() != $request->getVal( 'title' ) )
|
||||
&& ( $request->getVal( 'title' ) === null
|
||||
|| $title->getPrefixedDBkey() != $request->getVal( 'title' ) )
|
||||
&& !count( $request->getValueNames( array( 'action', 'title' ) ) )
|
||||
&& wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) ) )
|
||||
{
|
||||
&& wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) )
|
||||
) {
|
||||
if ( $title->isSpecialPage() ) {
|
||||
list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
|
||||
if ( $name ) {
|
||||
|
|
@ -358,12 +358,12 @@ class MediaWiki {
|
|||
$action = $request->getVal( 'action', 'view' );
|
||||
$file = ( $title->getNamespace() == NS_FILE ) ? $article->getFile() : null;
|
||||
if ( ( $action == 'view' || $action == 'render' ) // ... for actions that show content
|
||||
&& !$request->getVal( 'oldid' ) && // ... and are not old revisions
|
||||
!$request->getVal( 'diff' ) && // ... and not when showing diff
|
||||
$request->getVal( 'redirect' ) != 'no' && // ... unless explicitly told not to
|
||||
&& !$request->getVal( 'oldid' ) // ... and are not old revisions
|
||||
&& !$request->getVal( 'diff' ) // ... and not when showing diff
|
||||
&& $request->getVal( 'redirect' ) != 'no' // ... unless explicitly told not to
|
||||
// ... and the article is not a non-redirect image page with associated file
|
||||
!( is_object( $file ) && $file->exists() && !$file->getRedirected() ) )
|
||||
{
|
||||
&& !( is_object( $file ) && $file->exists() && !$file->getRedirected() )
|
||||
) {
|
||||
// Give extensions a change to ignore/handle redirects as needed
|
||||
$ignoreRedirect = $target = false;
|
||||
|
||||
|
|
@ -420,8 +420,8 @@ class MediaWiki {
|
|||
$user = $this->context->getUser();
|
||||
|
||||
if ( !wfRunHooks( 'MediaWikiPerformAction',
|
||||
array( $output, $page, $title, $user, $request, $this ) ) )
|
||||
{
|
||||
array( $output, $page, $title, $user, $request, $this ) )
|
||||
) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,8 +233,8 @@ class LogPage {
|
|||
* @return HTML string
|
||||
*/
|
||||
public static function actionText( $type, $action, $title = null, $skin = null,
|
||||
$params = array(), $filterWikilinks = false )
|
||||
{
|
||||
$params = array(), $filterWikilinks = false
|
||||
) {
|
||||
global $wgLang, $wgContLang, $wgLogActions;
|
||||
|
||||
if ( is_null( $skin ) ) {
|
||||
|
|
|
|||
|
|
@ -245,8 +245,8 @@ class LogPager extends ReverseChronologicalPager {
|
|||
$index['log_search'] = 'ls_field_val';
|
||||
$index['logging'] = 'PRIMARY';
|
||||
if ( !$this->hasEqualsClause( 'ls_field' )
|
||||
|| !$this->hasEqualsClause( 'ls_value' ) )
|
||||
{
|
||||
|| !$this->hasEqualsClause( 'ls_value' )
|
||||
) {
|
||||
# Since (ls_field,ls_value,ls_logid) is unique, if the condition is
|
||||
# to match a specific (ls_field,ls_value) tuple, then there will be
|
||||
# no duplicate log rows. Otherwise, we need to remove the duplicates.
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ class MoveLogFormatter extends LogFormatter {
|
|||
public function getActionLinks() {
|
||||
if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
|
||||
|| $this->entry->getSubtype() !== 'move'
|
||||
|| !$this->context->getUser()->isAllowed( 'move' ) )
|
||||
{
|
||||
|| !$this->context->getUser()->isAllowed( 'move' )
|
||||
) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,12 +97,12 @@ class ExifBitmapHandler extends BitmapHandler {
|
|||
wfSuppressWarnings();
|
||||
$exif = unserialize( $metadata );
|
||||
wfRestoreWarnings();
|
||||
if ( !isset( $exif['MEDIAWIKI_EXIF_VERSION'] ) ||
|
||||
$exif['MEDIAWIKI_EXIF_VERSION'] != Exif::version() )
|
||||
{
|
||||
if ( isset( $exif['MEDIAWIKI_EXIF_VERSION'] ) &&
|
||||
$exif['MEDIAWIKI_EXIF_VERSION'] == 1 )
|
||||
{
|
||||
if ( !isset( $exif['MEDIAWIKI_EXIF_VERSION'] )
|
||||
|| $exif['MEDIAWIKI_EXIF_VERSION'] != Exif::version()
|
||||
) {
|
||||
if ( isset( $exif['MEDIAWIKI_EXIF_VERSION'] )
|
||||
&& $exif['MEDIAWIKI_EXIF_VERSION'] == 1
|
||||
) {
|
||||
//back-compatible but old
|
||||
wfDebug( __METHOD__ . ": back-compat version\n" );
|
||||
return self::METADATA_COMPATIBLE;
|
||||
|
|
@ -129,10 +129,10 @@ class ExifBitmapHandler extends BitmapHandler {
|
|||
|
||||
public function getCommonMetaArray( File $file ) {
|
||||
$metadata = $file->getMetadata();
|
||||
if ( $metadata === self::OLD_BROKEN_FILE ||
|
||||
$metadata === self::BROKEN_FILE ||
|
||||
$this->isMetadataValid( $file, $metadata ) === self::METADATA_BAD )
|
||||
{
|
||||
if ( $metadata === self::OLD_BROKEN_FILE
|
||||
|| $metadata === self::BROKEN_FILE
|
||||
|| $this->isMetadataValid( $file, $metadata ) === self::METADATA_BAD
|
||||
) {
|
||||
// So we don't try and display metadata from PagedTiffHandler
|
||||
// for example when using InstantCommons.
|
||||
return array();
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ class GIFMetadataExtractor {
|
|||
|
||||
$commentCount = count( $comment );
|
||||
if ( $commentCount === 0
|
||||
|| $comment[$commentCount - 1] !== $data )
|
||||
{
|
||||
|| $comment[$commentCount - 1] !== $data
|
||||
) {
|
||||
// Some applications repeat the same comment on each
|
||||
// frame of an animated GIF image, so if this comment
|
||||
// is identical to the last, only extract once.
|
||||
|
|
@ -217,8 +217,8 @@ class GIFMetadataExtractor {
|
|||
$xmp = self::readBlock( $fh, true );
|
||||
|
||||
if ( substr( $xmp, -257, 3 ) !== "\x01\xFF\xFE"
|
||||
|| substr( $xmp, -4 ) !== "\x03\x02\x01\x00" )
|
||||
{
|
||||
|| substr( $xmp, -4 ) !== "\x03\x02\x01\x00"
|
||||
) {
|
||||
// this is just a sanity check.
|
||||
throw new Exception( "XMP does not have magic trailer!" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,9 +315,7 @@ class IPTC {
|
|||
foreach ( $codes as $ic ) {
|
||||
$fields = explode( ':', $ic, 3 );
|
||||
|
||||
if ( count( $fields ) < 2 ||
|
||||
$fields[0] !== 'IPTC' )
|
||||
{
|
||||
if ( count( $fields ) < 2 || $fields[0] !== 'IPTC' ) {
|
||||
wfDebugLog( 'IPTC', 'IPTC: '
|
||||
. 'Invalid 2:12 - ' . $ic );
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -608,8 +608,8 @@ class XMPReader {
|
|||
function endElement( $parser, $elm ) {
|
||||
if ( $elm === ( self::NS_RDF . ' RDF' )
|
||||
|| $elm === 'adobe:ns:meta/ xmpmeta'
|
||||
|| $elm === 'adobe:ns:meta/ xapmeta' )
|
||||
{
|
||||
|| $elm === 'adobe:ns:meta/ xapmeta'
|
||||
) {
|
||||
// ignore these.
|
||||
return;
|
||||
}
|
||||
|
|
@ -897,8 +897,8 @@ class XMPReader {
|
|||
|
||||
if ( isset( $this->items[$ns][$tag] ) ) {
|
||||
if ( isset( $this->items[$ns][$this->ancestorStruct]['children'] )
|
||||
&& !isset( $this->items[$ns][$this->ancestorStruct]['children'][$tag] ) )
|
||||
{
|
||||
&& !isset( $this->items[$ns][$this->ancestorStruct]['children'][$tag] )
|
||||
) {
|
||||
// This assumes that we don't have inter-namespace nesting
|
||||
// which we don't in all the properties we're interested in.
|
||||
throw new MWException( " <$tag> appeared nested in <" . $this->ancestorStruct
|
||||
|
|
@ -996,8 +996,8 @@ class XMPReader {
|
|||
throw new MWException( __METHOD__ . " <rdf:li> expected but got $elm." );
|
||||
}
|
||||
if ( !isset( $attribs[self::NS_XML . ' lang'] )
|
||||
|| !preg_match( '/^[-A-Za-z0-9]{2,}$/D', $attribs[self::NS_XML . ' lang'] ) )
|
||||
{
|
||||
|| !preg_match( '/^[-A-Za-z0-9]{2,}$/D', $attribs[self::NS_XML . ' lang'] )
|
||||
) {
|
||||
throw new MWException( __METHOD__
|
||||
. " <rdf:li> did not contain, or has invalid xml:lang attribute in lang alternative" );
|
||||
}
|
||||
|
|
@ -1026,8 +1026,8 @@ class XMPReader {
|
|||
|
||||
if ( $elm === self::NS_RDF . ' RDF'
|
||||
|| $elm === 'adobe:ns:meta/ xmpmeta'
|
||||
|| $elm === 'adobe:ns:meta/ xapmeta' )
|
||||
{
|
||||
|| $elm === 'adobe:ns:meta/ xapmeta'
|
||||
) {
|
||||
/* ignore. */
|
||||
return;
|
||||
} elseif ( $elm === self::NS_RDF . ' Description' ) {
|
||||
|
|
@ -1119,8 +1119,8 @@ class XMPReader {
|
|||
|
||||
if ( isset( $attribs[self::NS_RDF . ' parseType'] )
|
||||
&& $attribs[self::NS_RDF . ' parseType'] === 'Resource'
|
||||
&& $this->mode[0] === self::MODE_SIMPLE )
|
||||
{
|
||||
&& $this->mode[0] === self::MODE_SIMPLE
|
||||
) {
|
||||
// this is equivalent to having an inner rdf:Description
|
||||
$this->mode[0] = self::MODE_QDESC;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1026,9 +1026,9 @@ class MWMemcached {
|
|||
|
||||
$len = strlen( $val );
|
||||
|
||||
if ( $this->_have_zlib && $this->_compress_enable &&
|
||||
$this->_compress_threshold && $len >= $this->_compress_threshold )
|
||||
{
|
||||
if ( $this->_have_zlib && $this->_compress_enable
|
||||
&& $this->_compress_threshold && $len >= $this->_compress_threshold
|
||||
) {
|
||||
$c_val = gzcompress( $val, 9 );
|
||||
$c_len = strlen( $c_val );
|
||||
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ class SqlBagOStuff extends BagOStuff {
|
|||
|
||||
# Don't keep timing out trying to connect for each call if the DB is down
|
||||
if ( isset( $this->connFailureErrors[$serverIndex] )
|
||||
&& ( time() - $this->connFailureTimes[$serverIndex] ) < 60 )
|
||||
{
|
||||
&& ( time() - $this->connFailureTimes[$serverIndex] ) < 60
|
||||
) {
|
||||
throw $this->connFailureErrors[$serverIndex];
|
||||
}
|
||||
|
||||
|
|
@ -678,8 +678,8 @@ class SqlBagOStuff extends BagOStuff {
|
|||
for ( $serverIndex = 0; $serverIndex < $this->numServers; $serverIndex++ ) {
|
||||
$db = $this->getDB( $serverIndex );
|
||||
if ( $db->getType() !== 'mysql'
|
||||
|| version_compare( $db->getServerVersion(), '4.1.0', '<' ) )
|
||||
{
|
||||
|| version_compare( $db->getServerVersion(), '4.1.0', '<' )
|
||||
) {
|
||||
throw new MWException( __METHOD__ . ' is not supported on this DB server' );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,8 +160,8 @@ class LinkHolderArray {
|
|||
$pos = 0;
|
||||
while ( $pos < strlen( $text ) ) {
|
||||
if ( !preg_match( '/<!--LINK (\d+):(\d+)-->/',
|
||||
$text, $m, PREG_OFFSET_CAPTURE, $pos ) )
|
||||
{
|
||||
$text, $m, PREG_OFFSET_CAPTURE, $pos )
|
||||
) {
|
||||
break;
|
||||
}
|
||||
$ns = $m[1][0];
|
||||
|
|
|
|||
|
|
@ -420,8 +420,8 @@ class Parser {
|
|||
* d) it is an interface message (which is in the user language)
|
||||
*/
|
||||
if ( !( $options->getDisableContentConversion()
|
||||
|| isset( $this->mDoubleUnderscores['nocontentconvert'] ) ) )
|
||||
{
|
||||
|| isset( $this->mDoubleUnderscores['nocontentconvert'] ) )
|
||||
) {
|
||||
if ( !$this->mOptions->getInterfaceMessage() ) {
|
||||
# The position of the convert() call should not be changed. it
|
||||
# assumes that the links are all replaced and the only thing left
|
||||
|
|
@ -438,10 +438,10 @@ class Parser {
|
|||
* automatic link conversion.
|
||||
*/
|
||||
if ( !( $options->getDisableTitleConversion()
|
||||
|| isset( $this->mDoubleUnderscores['nocontentconvert'] )
|
||||
|| isset( $this->mDoubleUnderscores['notitleconvert'] )
|
||||
|| $this->mOutput->getDisplayTitle() !== false ) )
|
||||
{
|
||||
|| isset( $this->mDoubleUnderscores['nocontentconvert'] )
|
||||
|| isset( $this->mDoubleUnderscores['notitleconvert'] )
|
||||
|| $this->mOutput->getDisplayTitle() !== false )
|
||||
) {
|
||||
$convruletitle = $this->getConverterLanguage()->getConvRuleTitle();
|
||||
if ( $convruletitle ) {
|
||||
$this->mOutput->setTitleText( $convruletitle );
|
||||
|
|
@ -1696,9 +1696,9 @@ class Parser {
|
|||
public static function getExternalLinkRel( $url = false, $title = null ) {
|
||||
global $wgNoFollowLinks, $wgNoFollowNsExceptions, $wgNoFollowDomainExceptions;
|
||||
$ns = $title ? $title->getNamespace() : false;
|
||||
if ( $wgNoFollowLinks && !in_array( $ns, $wgNoFollowNsExceptions ) &&
|
||||
!wfMatchesDomainList( $url, $wgNoFollowDomainExceptions ) )
|
||||
{
|
||||
if ( $wgNoFollowLinks && !in_array( $ns, $wgNoFollowNsExceptions )
|
||||
&& !wfMatchesDomainList( $url, $wgNoFollowDomainExceptions )
|
||||
) {
|
||||
return 'nofollow';
|
||||
}
|
||||
return null;
|
||||
|
|
@ -1928,11 +1928,10 @@ class Parser {
|
|||
# Still some problems for cases where the ] is meant to be outside punctuation,
|
||||
# and no image is in sight. See bug 2095.
|
||||
#
|
||||
if ( $text !== '' &&
|
||||
substr( $m[3], 0, 1 ) === ']' &&
|
||||
strpos( $text, '[' ) !== false
|
||||
)
|
||||
{
|
||||
if ( $text !== ''
|
||||
&& substr( $m[3], 0, 1 ) === ']'
|
||||
&& strpos( $text, '[' ) !== false
|
||||
) {
|
||||
$text .= ']'; # so that replaceExternalLinks($text) works later
|
||||
$m[3] = substr( $m[3], 1 );
|
||||
}
|
||||
|
|
@ -3387,8 +3386,8 @@ class Parser {
|
|||
if ( !$title->isExternal() ) {
|
||||
if ( $title->isSpecialPage()
|
||||
&& $this->mOptions->getAllowSpecialInclusion()
|
||||
&& $this->ot['html'] )
|
||||
{
|
||||
&& $this->ot['html']
|
||||
) {
|
||||
// Pass the template arguments as URL parameters.
|
||||
// "uselang" will have no effect since the Language object
|
||||
// is forced to the one defined in ParserOptions.
|
||||
|
|
@ -3506,8 +3505,8 @@ class Parser {
|
|||
$text = wfEscapeWikiText( $text );
|
||||
} elseif ( is_string( $text )
|
||||
&& !$piece['lineStart']
|
||||
&& preg_match( '/^(?:{\\||:|;|#|\*)/', $text ) )
|
||||
{
|
||||
&& preg_match( '/^(?:{\\||:|;|#|\*)/', $text )
|
||||
) {
|
||||
# Bug 529: if the template begins with a table or block-level
|
||||
# element, it should be treated as beginning a new line.
|
||||
# This behavior is somewhat controversial.
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ class ParserOutput extends CacheTime {
|
|||
const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
|
||||
|
||||
function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(),
|
||||
$containsOldMagic = false, $titletext = '' )
|
||||
{
|
||||
$containsOldMagic = false, $titletext = ''
|
||||
) {
|
||||
$this->mText = $text;
|
||||
$this->mLanguageLinks = $languageLinks;
|
||||
$this->mCategories = $categoryLinks;
|
||||
|
|
|
|||
|
|
@ -399,14 +399,14 @@ class Preprocessor_DOM implements Preprocessor {
|
|||
// the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but
|
||||
// it's a possible beneficial b/c break.
|
||||
if ( $wsStart > 0 && substr( $text, $wsStart - 1, 1 ) == "\n"
|
||||
&& substr( $text, $wsEnd + 1, 1 ) == "\n" )
|
||||
{
|
||||
&& substr( $text, $wsEnd + 1, 1 ) == "\n"
|
||||
) {
|
||||
// Remove leading whitespace from the end of the accumulator
|
||||
// Sanity check first though
|
||||
$wsLength = $i - $wsStart;
|
||||
if ( $wsLength > 0
|
||||
&& strspn( $accum, " \t", -$wsLength ) === $wsLength )
|
||||
{
|
||||
&& strspn( $accum, " \t", -$wsLength ) === $wsLength
|
||||
) {
|
||||
$accum = substr( $accum, 0, -$wsLength );
|
||||
}
|
||||
|
||||
|
|
@ -475,8 +475,8 @@ class Preprocessor_DOM implements Preprocessor {
|
|||
$attrEnd = $tagEndPos;
|
||||
// Find closing tag
|
||||
if ( preg_match( "/<\/" . preg_quote( $name, '/' ) . "\s*>/i",
|
||||
$text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 ) )
|
||||
{
|
||||
$text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 )
|
||||
) {
|
||||
$inner = substr( $text, $tagEndPos + 1, $matches[0][1] - $tagEndPos - 1 );
|
||||
$i = $matches[0][1] + strlen( $matches[0][0] );
|
||||
$close = '<close>' . htmlspecialchars( $matches[0][0] ) . '</close>';
|
||||
|
|
@ -1141,8 +1141,8 @@ class PPFrame_DOM implements PPFrame {
|
|||
# Remove it in HTML, pre+remove and STRIP_COMMENTS modes
|
||||
if ( $this->parser->ot['html']
|
||||
|| ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() )
|
||||
|| ( $flags & PPFrame::STRIP_COMMENTS ) )
|
||||
{
|
||||
|| ( $flags & PPFrame::STRIP_COMMENTS )
|
||||
) {
|
||||
$out .= '';
|
||||
}
|
||||
# Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result
|
||||
|
|
|
|||
|
|
@ -326,15 +326,15 @@ class Preprocessor_Hash implements Preprocessor {
|
|||
// the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but
|
||||
// it's a possible beneficial b/c break.
|
||||
if ( $wsStart > 0 && substr( $text, $wsStart - 1, 1 ) == "\n"
|
||||
&& substr( $text, $wsEnd + 1, 1 ) == "\n" )
|
||||
{
|
||||
&& substr( $text, $wsEnd + 1, 1 ) == "\n"
|
||||
) {
|
||||
// Remove leading whitespace from the end of the accumulator
|
||||
// Sanity check first though
|
||||
$wsLength = $i - $wsStart;
|
||||
if ( $wsLength > 0
|
||||
&& $accum->lastNode instanceof PPNode_Hash_Text
|
||||
&& strspn( $accum->lastNode->value, " \t", -$wsLength ) === $wsLength )
|
||||
{
|
||||
&& strspn( $accum->lastNode->value, " \t", -$wsLength ) === $wsLength
|
||||
) {
|
||||
$accum->lastNode->value = substr( $accum->lastNode->value, 0, -$wsLength );
|
||||
}
|
||||
|
||||
|
|
@ -404,8 +404,8 @@ class Preprocessor_Hash implements Preprocessor {
|
|||
$attrEnd = $tagEndPos;
|
||||
// Find closing tag
|
||||
if ( preg_match( "/<\/" . preg_quote( $name, '/' ) . "\s*>/i",
|
||||
$text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 ) )
|
||||
{
|
||||
$text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 )
|
||||
) {
|
||||
$inner = substr( $text, $tagEndPos + 1, $matches[0][1] - $tagEndPos - 1 );
|
||||
$i = $matches[0][1] + strlen( $matches[0][0] );
|
||||
$close = $matches[0][0];
|
||||
|
|
@ -1062,8 +1062,8 @@ class PPFrame_Hash implements PPFrame {
|
|||
# Remove it in HTML, pre+remove and STRIP_COMMENTS modes
|
||||
if ( $this->parser->ot['html']
|
||||
|| ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() )
|
||||
|| ( $flags & PPFrame::STRIP_COMMENTS ) )
|
||||
{
|
||||
|| ( $flags & PPFrame::STRIP_COMMENTS )
|
||||
) {
|
||||
$out .= '';
|
||||
}
|
||||
# Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result
|
||||
|
|
@ -1654,8 +1654,8 @@ class PPNode_Hash_Tree implements PPNode {
|
|||
if ( $child->name === 'name' ) {
|
||||
$bits['name'] = $child;
|
||||
if ( $child->firstChild instanceof PPNode_Hash_Attr
|
||||
&& $child->firstChild->name === 'index' )
|
||||
{
|
||||
&& $child->firstChild->name === 'index'
|
||||
) {
|
||||
$bits['index'] = $child->firstChild->value;
|
||||
}
|
||||
} elseif ( $child->name === 'value' ) {
|
||||
|
|
|
|||
|
|
@ -283,8 +283,8 @@ class Profiler {
|
|||
return; // short-circuit
|
||||
// @TODO: hardcoded check is a tad janky (what about FOR UPDATE?)
|
||||
} elseif ( !preg_match( '/^query-m: (?!SELECT)/', $method )
|
||||
&& $realtime < $this->mDBLockThreshold )
|
||||
{
|
||||
&& $realtime < $this->mDBLockThreshold
|
||||
) {
|
||||
return; // not a DB master query nor slow enough
|
||||
}
|
||||
$now = microtime( true );
|
||||
|
|
|
|||
|
|
@ -141,9 +141,7 @@ class ResourceLoader {
|
|||
|
||||
// For empty/whitespace-only data or for unknown filters, don't perform
|
||||
// any caching or processing
|
||||
if ( trim( $data ) === ''
|
||||
|| !in_array( $filter, array( 'minify-js', 'minify-css' ) ) )
|
||||
{
|
||||
if ( trim( $data ) === '' || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,8 +538,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
|
|||
return $list[$key];
|
||||
} elseif ( is_string( $fallback )
|
||||
&& isset( $list[$fallback] )
|
||||
&& is_array( $list[$fallback] ) )
|
||||
{
|
||||
&& is_array( $list[$fallback] )
|
||||
) {
|
||||
return $list[$fallback];
|
||||
}
|
||||
return array();
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ class SpecialSearch extends SpecialPage {
|
|||
|
||||
if ( $request->getVal( 'fulltext' )
|
||||
|| !is_null( $request->getVal( 'offset' ) )
|
||||
|| !is_null( $request->getVal( 'searchx' ) ) )
|
||||
{
|
||||
|| !is_null( $request->getVal( 'searchx' ) )
|
||||
) {
|
||||
$this->showResults( $search );
|
||||
} else {
|
||||
$this->goResult( $search );
|
||||
|
|
|
|||
|
|
@ -328,10 +328,10 @@ class SpecialUpload extends SpecialPage {
|
|||
# mDestWarningAck is set when some javascript has shown the warning
|
||||
# to the user. mForReUpload is set when the user clicks the "upload a
|
||||
# new version" link.
|
||||
if ( !$warnings || ( count( $warnings ) == 1 &&
|
||||
isset( $warnings['exists'] ) &&
|
||||
( $this->mDestWarningAck || $this->mForReUpload ) ) )
|
||||
{
|
||||
if ( !$warnings || ( count( $warnings ) == 1
|
||||
&& isset( $warnings['exists'] )
|
||||
&& ( $this->mDestWarningAck || $this->mForReUpload ) )
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,9 +154,9 @@ class SpecialWatchlist extends SpecialPage {
|
|||
wfAppendToArrayIfNotDefault( $name, $values[$name], $defaults, $nondefaults );
|
||||
}
|
||||
|
||||
if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
|
||||
$request->wasPosted() )
|
||||
{
|
||||
if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' )
|
||||
&& $request->wasPosted()
|
||||
) {
|
||||
$user->clearAllNotifications();
|
||||
$output->redirect( $this->getTitle()->getFullURL( $nondefaults ) );
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -319,8 +319,8 @@ abstract class UploadBase {
|
|||
|
||||
$error = '';
|
||||
if ( !wfRunHooks( 'UploadVerification',
|
||||
array( $this->mDestName, $this->mTempPath, &$error ) ) )
|
||||
{
|
||||
array( $this->mDestName, $this->mTempPath, &$error ) )
|
||||
) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return array( 'status' => self::HOOK_ABORTED, 'error' => $error );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,8 +213,8 @@ class Language {
|
|||
protected static function newFromCode( $code ) {
|
||||
// Protect against path traversal below
|
||||
if ( !Language::isValidCode( $code )
|
||||
|| strcspn( $code, ":/\\\000" ) !== strlen( $code ) )
|
||||
{
|
||||
|| strcspn( $code, ":/\\\000" ) !== strlen( $code )
|
||||
) {
|
||||
throw new MWException( "Invalid language code \"$code\"" );
|
||||
}
|
||||
|
||||
|
|
@ -1502,8 +1502,7 @@ class Language {
|
|||
if (
|
||||
( $zy > 1582 ) || ( ( $zy == 1582 ) && ( $zm > 10 ) ) ||
|
||||
( ( $zy == 1582 ) && ( $zm == 10 ) && ( $zd > 14 ) )
|
||||
)
|
||||
{
|
||||
) {
|
||||
$zjd = (int)( ( 1461 * ( $zy + 4800 + (int)( ( $zm - 14 ) / 12 ) ) ) / 4 ) +
|
||||
(int)( ( 367 * ( $zm - 2 - 12 * ( (int)( ( $zm - 14 ) / 12 ) ) ) ) / 12 ) -
|
||||
(int)( ( 3 * (int)( ( ( $zy + 4900 + (int)( ( $zm - 14 ) / 12 ) ) / 100 ) ) ) / 4 ) +
|
||||
|
|
@ -1753,8 +1752,7 @@ class Language {
|
|||
( ( $gy > 1912 ) && ( $gy < 1926 ) ) ||
|
||||
( ( $gy == 1926 ) && ( $gm < 12 ) ) ||
|
||||
( ( $gy == 1926 ) && ( $gm == 12 ) && ( $gd < 26 ) )
|
||||
)
|
||||
{
|
||||
) {
|
||||
# Taishō period
|
||||
$gy_gannen = $gy - 1912 + 1;
|
||||
$gy_offset = $gy_gannen;
|
||||
|
|
@ -1766,8 +1764,7 @@ class Language {
|
|||
( ( $gy == 1926 ) && ( $gm == 12 ) && ( $gd >= 26 ) ) ||
|
||||
( ( $gy > 1926 ) && ( $gy < 1989 ) ) ||
|
||||
( ( $gy == 1989 ) && ( $gm == 1 ) && ( $gd < 8 ) )
|
||||
)
|
||||
{
|
||||
) {
|
||||
# Shōwa period
|
||||
$gy_gannen = $gy - 1926 + 1;
|
||||
$gy_offset = $gy_gannen;
|
||||
|
|
@ -4048,8 +4045,8 @@ class Language {
|
|||
public static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) {
|
||||
// Protect against path traversal
|
||||
if ( !Language::isValidCode( $code )
|
||||
|| strcspn( $code, ":/\\\000" ) !== strlen( $code ) )
|
||||
{
|
||||
|| strcspn( $code, ":/\\\000" ) !== strlen( $code )
|
||||
) {
|
||||
throw new MWException( "Invalid language code \"$code\"" );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -401,9 +401,9 @@ class LanguageConverter {
|
|||
$startPos = $elementPos + strlen( $element );
|
||||
|
||||
// Translate any alt or title attributes inside the matched element
|
||||
if ( $element !== '' && preg_match( '/^(<[^>\s]*)\s([^>]*)(.*)$/', $element,
|
||||
$elementMatches ) )
|
||||
{
|
||||
if ( $element !== ''
|
||||
&& preg_match( '/^(<[^>\s]*)\s([^>]*)(.*)$/', $element, $elementMatches )
|
||||
) {
|
||||
$attrs = Sanitizer::decodeTagAttributes( $elementMatches[2] );
|
||||
$changed = false;
|
||||
foreach ( array( 'title', 'alt' ) as $attrName ) {
|
||||
|
|
@ -1442,8 +1442,8 @@ class ConverterRule {
|
|||
}
|
||||
/* for unidirectional array fill to convert tables */
|
||||
if ( ( $manLevel[$v] == 'bidirectional' || $manLevel[$v] == 'unidirectional' )
|
||||
&& isset( $unidtable[$v] ) )
|
||||
{
|
||||
&& isset( $unidtable[$v] )
|
||||
) {
|
||||
if ( isset( $this->mConvTable[$v] ) ) {
|
||||
$this->mConvTable[$v] = array_merge( $this->mConvTable[$v], $unidtable[$v] );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ class CLDRPluralRuleEvaluator_Range {
|
|||
foreach ( $this->parts as $part ) {
|
||||
if ( is_array( $part ) ) {
|
||||
if ( ( !$integerConstraint || floor( $number ) === (float)$number )
|
||||
&& $number >= $part[0] && $number <= $part[1] )
|
||||
{
|
||||
&& $number >= $part[0] && $number <= $part[1]
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -450,8 +450,8 @@ class CLDRPluralRuleConverter {
|
|||
// Look ahead one word
|
||||
$nextTokenPos += strspn( $this->rule, self::WHITESPACE_CLASS, $nextTokenPos );
|
||||
if ( $nextTokenPos < $this->end
|
||||
&& preg_match( self::WORD_REGEX, $this->rule, $m, 0, $nextTokenPos ) )
|
||||
{
|
||||
&& preg_match( self::WORD_REGEX, $this->rule, $m, 0, $nextTokenPos )
|
||||
) {
|
||||
$word2 = strtolower( $m[0] );
|
||||
$nextTokenPos += strlen( $word2 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1273,9 +1273,9 @@ abstract class LoggedUpdateMaintenance extends Maintenance {
|
|||
$db = $this->getDB( DB_MASTER );
|
||||
$key = $this->getUpdateKey();
|
||||
|
||||
if ( !$this->hasOption( 'force' ) &&
|
||||
$db->selectRow( 'updatelog', '1', array( 'ul_key' => $key ), __METHOD__ ) )
|
||||
{
|
||||
if ( !$this->hasOption( 'force' )
|
||||
&& $db->selectRow( 'updatelog', '1', array( 'ul_key' => $key ), __METHOD__ )
|
||||
) {
|
||||
$this->output( "..." . $this->updateSkippedMessage() . "\n" );
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1284,9 +1284,7 @@ abstract class LoggedUpdateMaintenance extends Maintenance {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
$db->insert( 'updatelog', array( 'ul_key' => $key ), __METHOD__, 'IGNORE' ) )
|
||||
{
|
||||
if ( $db->insert( 'updatelog', array( 'ul_key' => $key ), __METHOD__, 'IGNORE' ) ) {
|
||||
return true;
|
||||
} else {
|
||||
$this->output( $this->updatelogFailedMessage() . "\n" );
|
||||
|
|
|
|||
|
|
@ -239,8 +239,8 @@ class CopyFileBackend extends Maintenance {
|
|||
$this->error( "$wikiId: Detected illegal (non-UTF8) path for $srcPath." );
|
||||
continue;
|
||||
} elseif ( !$this->hasOption( 'missingonly' )
|
||||
&& $this->filesAreSame( $src, $dst, $srcPath, $dstPath ) )
|
||||
{
|
||||
&& $this->filesAreSame( $src, $dst, $srcPath, $dstPath )
|
||||
) {
|
||||
$this->output( "\tAlready have $srcPathRel.\n" );
|
||||
continue; // assume already copied...
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,9 +90,9 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
|
|||
require $maintenance->loadSettings();
|
||||
}
|
||||
|
||||
if ( $maintenance->getDbType() === Maintenance::DB_ADMIN &&
|
||||
is_readable( "$IP/AdminSettings.php" ) )
|
||||
{
|
||||
if ( $maintenance->getDbType() === Maintenance::DB_ADMIN
|
||||
&& is_readable( "$IP/AdminSettings.php" )
|
||||
) {
|
||||
require "$IP/AdminSettings.php";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,8 +103,7 @@ class FindHooks extends Maintenance {
|
|||
$this->printArray( 'Documented and not found', $deprecated );
|
||||
$this->printArray( 'Unclear hook calls', $bad );
|
||||
|
||||
if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 )
|
||||
{
|
||||
if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 ) {
|
||||
$this->output( "Looks good!\n" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ class PruneFileCache extends Maintenance {
|
|||
// Sanity check the file extension against known cache types
|
||||
if ( $mts < $this->minSurviveTimestamp
|
||||
&& preg_match( '/\.(?:html|cache)(?:\.gz)?$/', $file )
|
||||
&& unlink( $path ) )
|
||||
{
|
||||
&& unlink( $path )
|
||||
) {
|
||||
$daysOld = round( ( $tsNow - $mts ) / 86400, 2 );
|
||||
$this->output( "Deleted `$path` [days=$daysOld]\n" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,9 +205,16 @@ class ImageBuilder extends Maintenance {
|
|||
}
|
||||
if ( !$this->dryrun ) {
|
||||
$file = wfLocalFile( $filename );
|
||||
if ( !$file->recordUpload( '', '(recovered file, missing upload log entry)', '', '', '',
|
||||
false, $timestamp ) )
|
||||
{
|
||||
if ( !$file->recordUpload(
|
||||
'',
|
||||
'(recovered file, missing upload log entry)',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$timestamp
|
||||
)
|
||||
) {
|
||||
$this->output( "Error uploading file $fullpath\n" );
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,8 +177,8 @@ class CompressOld extends Maintenance {
|
|||
* @return bool
|
||||
*/
|
||||
private function compressWithConcat( $startId, $maxChunkSize, $beginDate,
|
||||
$endDate, $extdb = "", $maxPageId = false )
|
||||
{
|
||||
$endDate, $extdb = "", $maxPageId = false
|
||||
) {
|
||||
$loadStyle = self::LS_CHUNKED;
|
||||
|
||||
$dbr = wfGetDB( DB_SLAVE );
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ class FixBug20757 extends Maintenance {
|
|||
$totalRevs = $dbr->selectField( 'text', 'MAX(old_id)', false, __METHOD__ );
|
||||
|
||||
if ( $dbr->getType() == 'mysql'
|
||||
&& version_compare( $dbr->getServerVersion(), '4.1.0', '>=' ) )
|
||||
{
|
||||
&& version_compare( $dbr->getServerVersion(), '4.1.0', '>=' )
|
||||
) {
|
||||
// In MySQL 4.1+, the binary field old_text has a non-working LOWER() function
|
||||
$lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING latin1))';
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue