Merge "Fixed spacing"
This commit is contained in:
commit
01596b2bbf
33 changed files with 169 additions and 162 deletions
|
|
@ -131,8 +131,14 @@ class Cookie {
|
|||
}
|
||||
|
||||
if ( substr( $domain, 0, 1 ) == '.'
|
||||
&& substr_compare( $originDomain, $domain, -strlen( $domain ),
|
||||
strlen( $domain ), true ) != 0 ) {
|
||||
&& substr_compare(
|
||||
$originDomain,
|
||||
$domain,
|
||||
-strlen( $domain ),
|
||||
strlen( $domain ),
|
||||
true
|
||||
) != 0
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -167,8 +173,15 @@ class Cookie {
|
|||
if ( $domain == $this->domain
|
||||
|| ( strlen( $domain ) > strlen( $this->domain )
|
||||
&& substr( $this->domain, 0, 1 ) == '.'
|
||||
&& substr_compare( $domain, $this->domain, -strlen( $this->domain ),
|
||||
strlen( $this->domain ), true ) == 0 ) ) {
|
||||
&& substr_compare(
|
||||
$domain,
|
||||
$this->domain,
|
||||
-strlen( $this->domain ),
|
||||
strlen( $this->domain ),
|
||||
true
|
||||
) == 0
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -619,9 +619,9 @@ class MWExceptionHandler {
|
|||
|
||||
if ( $wgShowExceptionDetails ) {
|
||||
$message .= 'Original exception: ' . self::getLogMessage( $e ) .
|
||||
"\nBacktrace:\n" . self::getRedactedTraceAsString( $e ) .
|
||||
"\n\nException caught inside exception handler: " . self::getLogMessage( $e2 ) .
|
||||
"\nBacktrace:\n" . self::getRedactedTraceAsString( $e2 );
|
||||
"\nBacktrace:\n" . self::getRedactedTraceAsString( $e ) .
|
||||
"\n\nException caught inside exception handler: " . self::getLogMessage( $e2 ) .
|
||||
"\nBacktrace:\n" . self::getRedactedTraceAsString( $e2 );
|
||||
} else {
|
||||
$message .= "Exception caught inside exception handler.\n\n" .
|
||||
"Set \$wgShowExceptionDetails = true; at the bottom of LocalSettings.php " .
|
||||
|
|
|
|||
|
|
@ -503,7 +503,8 @@ class XmlDumpWriter {
|
|||
'xmlns' => "http://www.mediawiki.org/xml/export-$ver/",
|
||||
'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
|
||||
'xsi:schemaLocation' => "http://www.mediawiki.org/xml/export-$ver/ " .
|
||||
"http://www.mediawiki.org/xml/export-$ver.xsd", #TODO: how do we get a new version up there?
|
||||
#TODO: how do we get a new version up there?
|
||||
"http://www.mediawiki.org/xml/export-$ver.xsd",
|
||||
'version' => $ver,
|
||||
'xml:lang' => $wgLanguageCode ),
|
||||
null ) .
|
||||
|
|
|
|||
|
|
@ -143,8 +143,7 @@ class GitInfo {
|
|||
} else {
|
||||
return (int)$commitDate;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the current branch, or HEAD if not found
|
||||
|
|
|
|||
|
|
@ -655,8 +655,7 @@ class HTMLForm extends ContextSource {
|
|||
. $this->getBody()
|
||||
. $this->getHiddenFields()
|
||||
. $this->getButtons()
|
||||
. $this->mFooter
|
||||
;
|
||||
. $this->mFooter;
|
||||
|
||||
$html = $this->wrapForm( $html );
|
||||
|
||||
|
|
|
|||
|
|
@ -449,8 +449,8 @@ class Html {
|
|||
// numbers to be entered in 'type="number"' fields, allow
|
||||
// the special case 'step="any"'.
|
||||
|
||||
if ( in_array( $key, array( 'max', 'min', 'pattern', 'required' ) ) ||
|
||||
$key === 'step' && $value !== 'any' ) {
|
||||
if ( in_array( $key, array( 'max', 'min', 'pattern', 'required' ) )
|
||||
|| $key === 'step' && $value !== 'any' ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -842,8 +842,8 @@ class PhpHttpRequest extends MWHttpRequest {
|
|||
$this->postData = wfArrayToCgi( $this->postData );
|
||||
}
|
||||
|
||||
if ( $this->parsedUrl['scheme'] != 'http' &&
|
||||
$this->parsedUrl['scheme'] != 'https' ) {
|
||||
if ( $this->parsedUrl['scheme'] != 'http'
|
||||
&& $this->parsedUrl['scheme'] != 'https' ) {
|
||||
$this->status->fatal( 'http-invalid-scheme', $this->parsedUrl['scheme'] );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class LinkFilter {
|
|||
$bits['host'] = $domainpart . '@' . $mailparts[0];
|
||||
} elseif ( $bits['scheme'] === 'mailto' ) {
|
||||
// domainpart of email address only, do not add '.'
|
||||
$bits['host'] = strtolower( implode( '.', array_reverse( explode( '.', $bits['host']) ) ) );
|
||||
$bits['host'] = strtolower( implode( '.', array_reverse( explode( '.', $bits['host'] ) ) ) );
|
||||
} else {
|
||||
$bits['host'] = strtolower( implode( '.', array_reverse( explode( '.', $bits['host'] ) ) ) );
|
||||
if ( substr( $bits['host'], -1, 1 ) !== '.' ) {
|
||||
|
|
|
|||
|
|
@ -849,10 +849,10 @@ class Linker {
|
|||
if ( $page ) {
|
||||
$url = wfAppendQuery( $url, array( 'page' => $page ) );
|
||||
}
|
||||
if ( $manualthumb &&
|
||||
!isset( $fp['link-title'] ) &&
|
||||
!isset( $fp['link-url'] ) &&
|
||||
!isset( $fp['no-link'] ) ) {
|
||||
if ( $manualthumb
|
||||
&& !isset( $fp['link-title'] )
|
||||
&& !isset( $fp['link-url'] )
|
||||
&& !isset( $fp['no-link'] ) ) {
|
||||
$fp['link-url'] = $url;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1453,14 +1453,14 @@ class Revision implements IDBAccessObject {
|
|||
$t = $title->getPrefixedDBkey();
|
||||
|
||||
throw new MWException( "Can't save non-default content model with \$wgContentHandlerUseDB disabled: "
|
||||
. "model is $model , default for $t is $defaultModel" );
|
||||
. "model is $model , default for $t is $defaultModel" );
|
||||
}
|
||||
|
||||
if ( $this->getContentFormat() != $defaultFormat ) {
|
||||
$t = $title->getPrefixedDBkey();
|
||||
|
||||
throw new MWException( "Can't use non-default content format with \$wgContentHandlerUseDB disabled: "
|
||||
. "format is $format, default for $t is $defaultFormat" );
|
||||
. "format is $format, default for $t is $defaultFormat" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1632,8 +1632,8 @@ class User {
|
|||
$blocked = $this->isBlocked( $bFromSlave );
|
||||
$allowUsertalk = ( $wgBlockAllowsUTEdit ? $this->mAllowUsertalk : false );
|
||||
// If a user's name is suppressed, they cannot make edits anywhere
|
||||
if ( !$this->mHideName && $allowUsertalk && $title->getText() === $this->getName() &&
|
||||
$title->getNamespace() == NS_USER_TALK ) {
|
||||
if ( !$this->mHideName && $allowUsertalk && $title->getText() === $this->getName()
|
||||
&& $title->getNamespace() == NS_USER_TALK ) {
|
||||
$blocked = false;
|
||||
wfDebug( __METHOD__ . ": self-talk page, ignoring any blocks\n" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -500,34 +500,34 @@ class Xml {
|
|||
$options = self::option( $other, 'other', $selected === 'other' );
|
||||
|
||||
foreach ( explode( "\n", $list ) as $option ) {
|
||||
$value = trim( $option );
|
||||
if ( $value == '' ) {
|
||||
continue;
|
||||
} elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
|
||||
// A new group is starting ...
|
||||
$value = trim( substr( $value, 1 ) );
|
||||
if ( $optgroup ) {
|
||||
$options .= self::closeElement( 'optgroup' );
|
||||
}
|
||||
$options .= self::openElement( 'optgroup', array( 'label' => $value ) );
|
||||
$optgroup = true;
|
||||
} elseif ( substr( $value, 0, 2 ) == '**' ) {
|
||||
// groupmember
|
||||
$value = trim( substr( $value, 2 ) );
|
||||
$options .= self::option( $value, $value, $selected === $value );
|
||||
} else {
|
||||
// groupless reason list
|
||||
if ( $optgroup ) {
|
||||
$options .= self::closeElement( 'optgroup' );
|
||||
}
|
||||
$options .= self::option( $value, $value, $selected === $value );
|
||||
$optgroup = false;
|
||||
$value = trim( $option );
|
||||
if ( $value == '' ) {
|
||||
continue;
|
||||
} elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
|
||||
// A new group is starting ...
|
||||
$value = trim( substr( $value, 1 ) );
|
||||
if ( $optgroup ) {
|
||||
$options .= self::closeElement( 'optgroup' );
|
||||
}
|
||||
$options .= self::openElement( 'optgroup', array( 'label' => $value ) );
|
||||
$optgroup = true;
|
||||
} elseif ( substr( $value, 0, 2 ) == '**' ) {
|
||||
// groupmember
|
||||
$value = trim( substr( $value, 2 ) );
|
||||
$options .= self::option( $value, $value, $selected === $value );
|
||||
} else {
|
||||
// groupless reason list
|
||||
if ( $optgroup ) {
|
||||
$options .= self::closeElement( 'optgroup' );
|
||||
}
|
||||
$options .= self::option( $value, $value, $selected === $value );
|
||||
$optgroup = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $optgroup ) {
|
||||
$options .= self::closeElement( 'optgroup' );
|
||||
}
|
||||
if ( $optgroup ) {
|
||||
$options .= self::closeElement( 'optgroup' );
|
||||
}
|
||||
|
||||
$attribs = array();
|
||||
|
||||
|
|
|
|||
2
includes/cache/LocalisationCache.php
vendored
2
includes/cache/LocalisationCache.php
vendored
|
|
@ -1197,7 +1197,7 @@ class LCStoreCDB implements LCStore {
|
|||
if ( file_exists( $fileName ) ) {
|
||||
try {
|
||||
$this->readers[$code] = CdbReader::open( $fileName );
|
||||
} catch( CdbException $e ) {
|
||||
} catch ( CdbException $e ) {
|
||||
wfDebug( __METHOD__ . ": unable to open cdb file for reading" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1105,7 +1105,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
|
|||
wfDebug( "SQL ERROR (ignored): $error\n" );
|
||||
$this->ignoreErrors( $ignore );
|
||||
} else {
|
||||
$sql1line = mb_substr( str_replace( "\n", "\\n", $sql ), 0, 5*1024 );
|
||||
$sql1line = mb_substr( str_replace( "\n", "\\n", $sql ), 0, 5 * 1024 );
|
||||
wfLogDBError( "$fname\t{$this->mServer}\t$errno\t$error\t$sql1line\n" );
|
||||
wfDebug( "SQL ERROR: " . $error . "\n" );
|
||||
throw new DBQueryError( $this, $error, $errno, $sql, $fname );
|
||||
|
|
|
|||
|
|
@ -1617,8 +1617,7 @@ class FormatMetadata extends ContextSource {
|
|||
* @return mixed value in best language, null if there were no languages at all
|
||||
* @since 1.23
|
||||
*/
|
||||
protected function resolveMultilangValue( $value )
|
||||
{
|
||||
protected function resolveMultilangValue( $value ) {
|
||||
if (
|
||||
!is_array( $value )
|
||||
|| !isset( $value['_type'] )
|
||||
|
|
@ -1732,8 +1731,7 @@ class FormatMetadata extends ContextSource {
|
|||
* @return array
|
||||
* @since 1.23
|
||||
*/
|
||||
protected function getPriorityLanguages()
|
||||
{
|
||||
protected function getPriorityLanguages() {
|
||||
$priorityLanguages = Language::getFallbacksIncludingSiteLanguage( $this->getLanguage()->getCode() );
|
||||
$priorityLanguages = array_merge( (array) $this->getLanguage()->getCode(), $priorityLanguages[0], $priorityLanguages[1] );
|
||||
return $priorityLanguages;
|
||||
|
|
|
|||
|
|
@ -103,12 +103,12 @@ class XCFHandler extends BitmapHandler {
|
|||
# (enum GimpImageBaseType in libgimpbase/gimpbaseenums.h)
|
||||
try {
|
||||
$header = wfUnpack(
|
||||
"A9magic" # A: space padded
|
||||
. "/a5version" # a: zero padded
|
||||
. "/Nwidth" # \
|
||||
. "/Nheight" # N: unsigned long 32bit big endian
|
||||
. "/Nbase_type" # /
|
||||
, $binaryHeader
|
||||
"A9magic" . # A: space padded
|
||||
"/a5version" . # a: zero padded
|
||||
"/Nwidth" . # \
|
||||
"/Nheight" . # N: unsigned long 32bit big endian
|
||||
"/Nbase_type", # /
|
||||
$binaryHeader
|
||||
);
|
||||
} catch ( MWException $mwe ) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1788,14 +1788,14 @@ class Parser {
|
|||
$imagematch = false;
|
||||
}
|
||||
if ( $this->mOptions->getAllowExternalImages()
|
||||
|| ( $imagesexception && $imagematch ) ) {
|
||||
|| ( $imagesexception && $imagematch ) ) {
|
||||
if ( preg_match( self::EXT_IMAGE_REGEX, $url ) ) {
|
||||
# Image found
|
||||
$text = Linker::makeExternalImage( $url );
|
||||
}
|
||||
}
|
||||
if ( !$text && $this->mOptions->getEnableImageWhitelist()
|
||||
&& preg_match( self::EXT_IMAGE_REGEX, $url ) ) {
|
||||
&& preg_match( self::EXT_IMAGE_REGEX, $url ) ) {
|
||||
$whitelist = explode( "\n", wfMessage( 'external_image_whitelist' )->inContentLanguage()->text() );
|
||||
foreach ( $whitelist as $entry ) {
|
||||
# Sanitize the regex fragment, make it case-insensitive, ignore blank entries/comments
|
||||
|
|
@ -3947,11 +3947,10 @@ class Parser {
|
|||
$object = false;
|
||||
$text = $frame->getArgument( $argName );
|
||||
if ( $text === false && $parts->getLength() > 0
|
||||
&& (
|
||||
$this->ot['html']
|
||||
|| $this->ot['pre']
|
||||
|| ( $this->ot['wiki'] && $frame->isTemplate() )
|
||||
)
|
||||
&& ( $this->ot['html']
|
||||
|| $this->ot['pre']
|
||||
|| ( $this->ot['wiki'] && $frame->isTemplate() )
|
||||
)
|
||||
) {
|
||||
# No match in frame, use the supplied default
|
||||
$object = $parts->item( 0 )->getChildren();
|
||||
|
|
@ -5432,10 +5431,10 @@ class Parser {
|
|||
$params['frame']['caption'] = $caption;
|
||||
|
||||
# Will the image be presented in a frame, with the caption below?
|
||||
$imageIsFramed = isset( $params['frame']['frame'] ) ||
|
||||
isset( $params['frame']['framed'] ) ||
|
||||
isset( $params['frame']['thumbnail'] ) ||
|
||||
isset( $params['frame']['manualthumb'] );
|
||||
$imageIsFramed = isset( $params['frame']['frame'] )
|
||||
|| isset( $params['frame']['framed'] )
|
||||
|| isset( $params['frame']['thumbnail'] )
|
||||
|| isset( $params['frame']['manualthumb'] );
|
||||
|
||||
# In the old days, [[Image:Foo|text...]] would set alt text. Later it
|
||||
# came to also set the caption, ordinary text after the image -- which
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class SpecialExpandTemplates extends SpecialPage {
|
|||
$out->addWikiMsg( 'expand_templates_intro' );
|
||||
$out->addHTML( $this->makeForm( $titleStr, $input ) );
|
||||
|
||||
if( $output !== false ) {
|
||||
if ( $output !== false ) {
|
||||
if ( $this->generateXML && strlen( $output ) > 0 ) {
|
||||
$out->addHTML( $this->makeOutput( $xml, 'expand_templates_xml_output' ) );
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ class SpecialExpandTemplates extends SpecialPage {
|
|||
);
|
||||
}
|
||||
|
||||
if( ( $wgUseTidy && $options->getTidy() ) || $wgAlwaysUseTidy ) {
|
||||
if ( ( $wgUseTidy && $options->getTidy() ) || $wgAlwaysUseTidy ) {
|
||||
$tmp = MWTidy::tidy( $tmp );
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ class SpecialExpandTemplates extends SpecialPage {
|
|||
*/
|
||||
private function makeForm( $title, $input ) {
|
||||
$self = $this->getTitle();
|
||||
$form = Xml::openElement(
|
||||
$form = Xml::openElement(
|
||||
'form',
|
||||
array( 'method' => 'post', 'action' => $self->getLocalUrl() )
|
||||
);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ if ( !isset( $wgVersion ) ) {
|
|||
$matches = array();
|
||||
$ext = 'php';
|
||||
$path = '/';
|
||||
foreach( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) {
|
||||
if( !preg_match( '/\.(php5?)$/', $part, $matches ) ) {
|
||||
foreach ( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) {
|
||||
if ( !preg_match( '/\.(php5?)$/', $part, $matches ) ) {
|
||||
$path .= "$part/";
|
||||
} else {
|
||||
$ext = $matches[1] == 'php5' ? 'php5' : 'php';
|
||||
|
|
|
|||
|
|
@ -102,8 +102,7 @@ class LanguageConverter {
|
|||
'R' => 'R', // raw content
|
||||
'D' => 'D', // convert description (subclass implement)
|
||||
'-' => '-', // remove convert (not implement)
|
||||
'H' => 'H', // add rule for convert code
|
||||
// (but no display in placed code)
|
||||
'H' => 'H', // add rule for convert code (but no display in placed code)
|
||||
'N' => 'N' // current variant name
|
||||
);
|
||||
$this->mFlags = array_merge( $defaultflags, $flags );
|
||||
|
|
@ -778,12 +777,12 @@ class LanguageConverter {
|
|||
$ns = NS_MAIN;
|
||||
|
||||
if ( $disableLinkConversion ||
|
||||
( !$ignoreOtherCond &&
|
||||
( $isredir == 'no'
|
||||
|| $action == 'edit'
|
||||
|| $action == 'submit'
|
||||
|| $linkconvert == 'no'
|
||||
|| $wgUser->getOption( 'noconvertlink' ) == 1 ) ) ) {
|
||||
( !$ignoreOtherCond &&
|
||||
( $isredir == 'no'
|
||||
|| $action == 'edit'
|
||||
|| $action == 'submit'
|
||||
|| $linkconvert == 'no'
|
||||
|| $wgUser->getOption( 'noconvertlink' ) == 1 ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -876,8 +875,7 @@ class LanguageConverter {
|
|||
$this->mTables = $wgLangConvMemc->get( $this->mCacheKey );
|
||||
wfProfileOut( __METHOD__ . '-cache' );
|
||||
}
|
||||
if ( !$this->mTables
|
||||
|| !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) {
|
||||
if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) {
|
||||
wfProfileIn( __METHOD__ . '-recache' );
|
||||
// not in cache, or we need a fresh reload.
|
||||
// We will first load the default tables
|
||||
|
|
@ -1004,8 +1002,7 @@ class LanguageConverter {
|
|||
continue;
|
||||
}
|
||||
$mappings = explode( '}-', $block, 2 );
|
||||
$stripped = str_replace( array( "'", '"', '*', '#' ), '',
|
||||
$mappings[0] );
|
||||
$stripped = str_replace( array( "'", '"', '*', '#' ), '', $mappings[0] );
|
||||
$table = StringUtils::explode( ';', $stripped );
|
||||
foreach ( $table as $t ) {
|
||||
$m = explode( '=>', $t, 3 );
|
||||
|
|
@ -1285,9 +1282,9 @@ class ConverterRule {
|
|||
$from = trim( $u[0] );
|
||||
$v = trim( $u[1] );
|
||||
if ( array_key_exists( $v, $unidtable )
|
||||
&& !is_array( $unidtable[$v] )
|
||||
&& $to
|
||||
&& in_array( $v, $variants ) ) {
|
||||
&& !is_array( $unidtable[$v] )
|
||||
&& $to
|
||||
&& in_array( $v, $variants ) ) {
|
||||
$unidtable[$v] = array( $from => $to );
|
||||
} elseif ( $to && in_array( $v, $variants ) ) {
|
||||
$unidtable[$v][$from] = $to;
|
||||
|
|
@ -1353,8 +1350,7 @@ class ConverterRule {
|
|||
$disp = $disp[0];
|
||||
}
|
||||
// or display frist text under disable manual convert
|
||||
if ( !$disp
|
||||
&& $this->mConverter->mManualLevel[$variant] == 'disable' ) {
|
||||
if ( !$disp && $this->mConverter->mManualLevel[$variant] == 'disable' ) {
|
||||
if ( count( $bidtable ) > 0 ) {
|
||||
$disp = array_values( $bidtable );
|
||||
$disp = $disp[0];
|
||||
|
|
@ -1477,8 +1473,9 @@ class ConverterRule {
|
|||
// then convert <text to convert> to current language
|
||||
$this->mRules = $this->mConverter->autoConvert( $this->mRules,
|
||||
$variant );
|
||||
} else { // if current variant no in flags,
|
||||
// then we check its fallback variants.
|
||||
} else {
|
||||
// if current variant no in flags,
|
||||
// then we check its fallback variants.
|
||||
$variantFallbacks =
|
||||
$this->mConverter->getVariantFallbacks( $variant );
|
||||
if ( is_array( $variantFallbacks ) ) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class LanguageDsb extends Language {
|
|||
case 'lokatiw': # lokatiw
|
||||
$word = 'wo ' . $word;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class LanguageHsb extends Language {
|
|||
case 'lokatiw': # lokatiw
|
||||
$word = 'wo ' . $word;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values
|
||||
}
|
||||
|
|
|
|||
|
|
@ -417,8 +417,8 @@ class TextPassDumper extends BackupDumper {
|
|||
$text = false; // The candidate for a good text. false if no proper value.
|
||||
$failures = 0; // The number of times, this invocation of getText already failed.
|
||||
|
||||
static $consecutiveFailedTextRetrievals = 0; // The number of times getText failed without
|
||||
// yielding a good text in between.
|
||||
// The number of times getText failed without yielding a good text in between.
|
||||
static $consecutiveFailedTextRetrievals = 0;
|
||||
|
||||
$this->fetchCount++;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ do {
|
|||
print "Loading cdb file $file...";
|
||||
try {
|
||||
$fileHandle = CdbReader::open( $file );
|
||||
} catch( CdbException $e ) {}
|
||||
} catch ( CdbException $e ) {}
|
||||
|
||||
if ( !$fileHandle ) {
|
||||
print "not a cdb file or unable to read it\n";
|
||||
|
|
|
|||
|
|
@ -123,9 +123,9 @@ class CLIParser extends Maintenance {
|
|||
*/
|
||||
protected function parse( $wikitext ) {
|
||||
return $this->parser->parse(
|
||||
$wikitext
|
||||
, $this->getTitle()
|
||||
, new ParserOptions()
|
||||
$wikitext,
|
||||
$this->getTitle(),
|
||||
new ParserOptions()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ class UserDupes {
|
|||
function getDupes() {
|
||||
$user = $this->db->tableName( 'user' );
|
||||
$result = $this->db->query(
|
||||
"SELECT user_name,COUNT(*) AS n
|
||||
"SELECT user_name,COUNT(*) AS n
|
||||
FROM $user
|
||||
GROUP BY user_name
|
||||
HAVING n > 1", __METHOD__ );
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ $result = array( 'xmp-exif' =>
|
|||
'GPSLatitude' => 88.51805555,
|
||||
'GPSLongitude' => -21.12356945,
|
||||
'GPSVersionID' => '2.2.0.0'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -70,38 +70,38 @@ class LinkFilterTest extends MediaWikiLangTestCase {
|
|||
|
||||
return array(
|
||||
// Protocol, Search pattern, URL which matches the pattern
|
||||
array( 'http://' , '*.test.com' , 'http://www.test.com' ),
|
||||
array( 'http://' , 'test.com:8080/dir/file' , 'http://name:pass@test.com:8080/dir/file' ),
|
||||
array( 'https://' , '*.com' , 'https://s.s.test..com:88/dir/file?a=1&b=2' ),
|
||||
array( 'https://' , '*.com' , 'https://name:pass@secure.com/index.html' ),
|
||||
array( 'http://' , 'name:pass@test.com' , 'http://test.com' ),
|
||||
array( 'http://' , 'test.com' , 'http://name:pass@test.com' ),
|
||||
array( 'http://' , '*.test.com' , 'http://a.b.c.test.com/dir/dir/file?a=6'),
|
||||
array( null , 'http://*.test.com' , 'http://www.test.com' ),
|
||||
array( 'mailto:' , 'name@mail.test123.com' , 'mailto:name@mail.test123.com' ),
|
||||
array( '' ,
|
||||
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ,
|
||||
array( 'http://', '*.test.com', 'http://www.test.com' ),
|
||||
array( 'http://', 'test.com:8080/dir/file', 'http://name:pass@test.com:8080/dir/file' ),
|
||||
array( 'https://', '*.com', 'https://s.s.test..com:88/dir/file?a=1&b=2' ),
|
||||
array( 'https://', '*.com', 'https://name:pass@secure.com/index.html' ),
|
||||
array( 'http://', 'name:pass@test.com', 'http://test.com' ),
|
||||
array( 'http://', 'test.com', 'http://name:pass@test.com' ),
|
||||
array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6'),
|
||||
array( null, 'http://*.test.com', 'http://www.test.com' ),
|
||||
array( 'mailto:', 'name@mail.test123.com', 'mailto:name@mail.test123.com' ),
|
||||
array( '',
|
||||
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg',
|
||||
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg'
|
||||
),
|
||||
array( '' , 'http://name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ,
|
||||
array( '', 'http://name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg',
|
||||
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ),
|
||||
array( '' , 'http://name:wrongpass@*.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]' ,
|
||||
array( '', 'http://name:wrongpass@*.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]',
|
||||
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ),
|
||||
array( 'http://' , 'name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ,
|
||||
array( 'http://', 'name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg',
|
||||
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ),
|
||||
array( '' , 'http://name:pass@www.test.com:12345' ,
|
||||
array( '', 'http://name:pass@www.test.com:12345',
|
||||
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ),
|
||||
array( 'ftp://', 'user:pass@ftp.test.com:1233/home/user/file;type=efw',
|
||||
'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ),
|
||||
array( null , 'ftp://otheruser:otherpass@ftp.test.com:1233/home/user/file;type=',
|
||||
array( null, 'ftp://otheruser:otherpass@ftp.test.com:1233/home/user/file;type=',
|
||||
'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ),
|
||||
array( null , 'ftp://@ftp.test.com:1233/home/user/file;type=',
|
||||
array( null, 'ftp://@ftp.test.com:1233/home/user/file;type=',
|
||||
'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ),
|
||||
array( null , 'ftp://ftp.test.com/',
|
||||
array( null, 'ftp://ftp.test.com/',
|
||||
'ftp://user:pass@ftp.test.com/home/user/file;type=efw' ),
|
||||
array( null , 'ftp://ftp.test.com/',
|
||||
array( null, 'ftp://ftp.test.com/',
|
||||
'ftp://user:pass@ftp.test.com/home/user/file;type=efw' ),
|
||||
array( null , 'ftp://*.test.com:222/',
|
||||
array( null, 'ftp://*.test.com:222/',
|
||||
'ftp://user:pass@ftp.test.com:222/home' ),
|
||||
array( 'irc://', '*.myserver:6667/', 'irc://test.myserver:6667/' ),
|
||||
array( 'irc://', 'name:pass@*.myserver/', 'irc://test.myserver:6667/' ),
|
||||
|
|
@ -115,15 +115,15 @@ class LinkFilterTest extends MediaWikiLangTestCase {
|
|||
array( 'mailto:', 'test.com', 'mailto:name@test.com' ),
|
||||
array( 'news:', 'test.1234afc@news.test.com', 'news:test.1234afc@news.test.com' ),
|
||||
array( 'news:', '*.test.com', 'news:test.1234afc@news.test.com' ),
|
||||
array( '' , 'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com',
|
||||
array( '', 'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com',
|
||||
'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com' ),
|
||||
array( '' , 'news:*.aol.com',
|
||||
array( '', 'news:*.aol.com',
|
||||
'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com' ),
|
||||
array( '' , 'git://github.com/prwef/abc-def.git' , 'git://github.com/prwef/abc-def.git' ),
|
||||
array( 'git://' , 'github.com/' , 'git://github.com/prwef/abc-def.git' ),
|
||||
array( 'git://' , '*.github.com/' , 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ),
|
||||
array( '' , 'gopher://*.test.com/' , 'gopher://gopher.test.com/0/v2/vstat'),
|
||||
array( 'telnet://' , '*.test.com' , 'telnet://shell.test.com/~home/'),
|
||||
array( '', 'git://github.com/prwef/abc-def.git', 'git://github.com/prwef/abc-def.git' ),
|
||||
array( 'git://', 'github.com/', 'git://github.com/prwef/abc-def.git' ),
|
||||
array( 'git://', '*.github.com/', 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ),
|
||||
array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat'),
|
||||
array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/'),
|
||||
|
||||
//
|
||||
// The following only work in PHP >= 5.3.7, due to a bug in parse_url which eats
|
||||
|
|
@ -140,12 +140,12 @@ class LinkFilterTest extends MediaWikiLangTestCase {
|
|||
//
|
||||
// Tests for false positives
|
||||
//
|
||||
array( 'http://' , 'test.com' , 'http://www.test.com', false ),
|
||||
array( 'http://' , 'www1.test.com' , 'http://www.test.com', false ),
|
||||
array( 'http://' , '*.test.com' , 'http://www.test.t.com', false ),
|
||||
array( '' , 'http://test.com:8080' , 'http://www.test.com:8080', false ),
|
||||
array( '' , 'https://test.com' , 'http://test.com', false ),
|
||||
array( '' , 'http://test.com' , 'https://test.com', false ),
|
||||
array( 'http://', 'test.com', 'http://www.test.com', false ),
|
||||
array( 'http://', 'www1.test.com', 'http://www.test.com', false ),
|
||||
array( 'http://', '*.test.com', 'http://www.test.t.com', false ),
|
||||
array( '', 'http://test.com:8080', 'http://www.test.com:8080', false ),
|
||||
array( '', 'https://test.com', 'http://test.com', false ),
|
||||
array( '', 'http://test.com', 'https://test.com', false ),
|
||||
array( 'http://', 'http://test.com', 'http://test.com', false ),
|
||||
array( null, 'http://www.test.com', 'http://www.test.com:80', false ),
|
||||
array( null, 'http://www.test.com:80', 'http://www.test.com', false ),
|
||||
|
|
@ -205,7 +205,7 @@ class LinkFilterTest extends MediaWikiLangTestCase {
|
|||
|
||||
$matches = 0;
|
||||
|
||||
foreach( $indexes as $index ) {
|
||||
foreach ( $indexes as $index ) {
|
||||
$matches += preg_match( $regex, $index );
|
||||
$debugmsg .= "\t'$index'\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@ class PreferencesTest extends MediaWikiTestCase {
|
|||
protected function prefsFor( $user_key ) {
|
||||
$preferences = array();
|
||||
Preferences::profilePreferences(
|
||||
$this->prefUsers[$user_key]
|
||||
, $this->context
|
||||
, $preferences
|
||||
$this->prefUsers[$user_key],
|
||||
$this->context,
|
||||
$preferences
|
||||
);
|
||||
|
||||
return $preferences;
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ class StatusTest extends MediaWikiLangTestCase {
|
|||
*/
|
||||
public function testGetErrorMessage() {
|
||||
$method = new ReflectionMethod( 'Status', 'getErrorMessage' );
|
||||
$method->setAccessible(true);
|
||||
$method->setAccessible( true );
|
||||
$status = new Status();
|
||||
$key = 'foo';
|
||||
$params = array( 'bar' );
|
||||
|
|
@ -430,7 +430,7 @@ class StatusTest extends MediaWikiLangTestCase {
|
|||
*/
|
||||
public function testGetErrorMessageArray() {
|
||||
$method = new ReflectionMethod( 'Status', 'getErrorMessageArray' );
|
||||
$method->setAccessible(true);
|
||||
$method->setAccessible( true );
|
||||
$status = new Status();
|
||||
$key = 'foo';
|
||||
$params = array( 'bar' );
|
||||
|
|
@ -446,7 +446,7 @@ class StatusTest extends MediaWikiLangTestCase {
|
|||
|
||||
$this->assertInternalType( 'array', $messageArray );
|
||||
$this->assertCount( 2, $messageArray );
|
||||
foreach( $messageArray as $message ) {
|
||||
foreach ( $messageArray as $message ) {
|
||||
$this->assertInstanceOf( 'Message', $message );
|
||||
$this->assertEquals( $key, $message->getKey() );
|
||||
$this->assertEquals( $params, $message->getParams() );
|
||||
|
|
|
|||
|
|
@ -152,7 +152,8 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase {
|
|||
private static function GetItems( $q, $moduleName, $name, &$print ) {
|
||||
if ( isset( $q[$moduleName] ) ) {
|
||||
$print[] = "*$name/[" . implode( ',',
|
||||
array_map( function ( $v ) {
|
||||
array_map(
|
||||
function ( $v ) {
|
||||
return $v['title'];
|
||||
},
|
||||
$q[$moduleName] ) ) . ']';
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ class RefreshLinksPartitionTest extends MediaWikiTestCase {
|
|||
$title->getBacklinkCache()->clear();
|
||||
$this->assertEquals( 20, $title->getBacklinkCache()->getNumLinks( 'pagelinks' ), 'Correct number of backlinks' );
|
||||
|
||||
$job = new RefreshLinksJob( $title, array( 'recursive' => true, 'table' => 'pagelinks' )
|
||||
$job = new RefreshLinksJob( $title, array( 'recursive' => true, 'table' => 'pagelinks' )
|
||||
+ Job::newRootJobParams( "refreshlinks:pagelinks:{$title->getPrefixedText()}" ) );
|
||||
$extraParams = $job->getRootJobParams();
|
||||
$jobs = BacklinkJobUtils::partitionBacklinkJob( $job, 9, 1, array( 'params' => $extraParams ) );
|
||||
|
||||
$this->assertEquals( 10, count( $jobs ), 'Correct number of sub-jobs' );
|
||||
$this->assertEquals( $pages[0], current( $jobs[0]->params['pages'] ),
|
||||
$this->assertEquals( $pages[0], current( $jobs[0]->params['pages'] ),
|
||||
'First job is leaf job with proper title' );
|
||||
$this->assertEquals( $pages[8], current( $jobs[8]->params['pages'] ),
|
||||
'Last leaf job is leaf job with proper title' );
|
||||
|
|
@ -49,19 +49,19 @@ class RefreshLinksPartitionTest extends MediaWikiTestCase {
|
|||
'Last job is recursive sub-job' );
|
||||
$this->assertEquals( true, is_array( $jobs[9]->params['range'] ),
|
||||
'Last job is recursive sub-job' );
|
||||
$this->assertEquals( $title->getPrefixedText(), $jobs[0]->getTitle()->getPrefixedText(),
|
||||
$this->assertEquals( $title->getPrefixedText(), $jobs[0]->getTitle()->getPrefixedText(),
|
||||
'Base job title retainend in leaf job' );
|
||||
$this->assertEquals( $title->getPrefixedText(), $jobs[9]->getTitle()->getPrefixedText(),
|
||||
$this->assertEquals( $title->getPrefixedText(), $jobs[9]->getTitle()->getPrefixedText(),
|
||||
'Base job title retainend recursive sub-job' );
|
||||
$this->assertEquals( $extraParams['rootJobSignature'], $jobs[0]->params['rootJobSignature'],
|
||||
'Leaf job has root params' );
|
||||
$this->assertEquals( $extraParams['rootJobSignature'], $jobs[9]->params['rootJobSignature'],
|
||||
$this->assertEquals( $extraParams['rootJobSignature'], $jobs[9]->params['rootJobSignature'],
|
||||
'Recursive sub-job has root params' );
|
||||
|
||||
$jobs2 = BacklinkJobUtils::partitionBacklinkJob( $jobs[9], 9, 1, array( 'params' => $extraParams ) );
|
||||
|
||||
$this->assertEquals( 10, count( $jobs2 ), 'Correct number of sub-jobs' );
|
||||
$this->assertEquals( $pages[9], current( $jobs2[0]->params['pages'] ),
|
||||
$this->assertEquals( $pages[9], current( $jobs2[0]->params['pages'] ),
|
||||
'First job is leaf job with proper title' );
|
||||
$this->assertEquals( $pages[17], current( $jobs2[8]->params['pages'] ),
|
||||
'Last leaf job is leaf job with proper title' );
|
||||
|
|
@ -73,17 +73,17 @@ class RefreshLinksPartitionTest extends MediaWikiTestCase {
|
|||
'Last job is recursive sub-job' );
|
||||
$this->assertEquals( $extraParams['rootJobSignature'], $jobs2[0]->params['rootJobSignature'],
|
||||
'Leaf job has root params' );
|
||||
$this->assertEquals( $extraParams['rootJobSignature'], $jobs2[9]->params['rootJobSignature'],
|
||||
$this->assertEquals( $extraParams['rootJobSignature'], $jobs2[9]->params['rootJobSignature'],
|
||||
'Recursive sub-job has root params' );
|
||||
|
||||
$jobs3 = BacklinkJobUtils::partitionBacklinkJob( $jobs2[9], 9, 1, array( 'params' => $extraParams ) );
|
||||
|
||||
$this->assertEquals( 2, count( $jobs3 ), 'Correct number of sub-jobs' );
|
||||
$this->assertEquals( $pages[18], current( $jobs3[0]->params['pages'] ),
|
||||
$this->assertEquals( $pages[18], current( $jobs3[0]->params['pages'] ),
|
||||
'First job is leaf job with proper title' );
|
||||
$this->assertEquals( $extraParams['rootJobSignature'], $jobs3[0]->params['rootJobSignature'],
|
||||
'Leaf job has root params' );
|
||||
$this->assertEquals( $pages[19], current( $jobs3[1]->params['pages'] ),
|
||||
$this->assertEquals( $pages[19], current( $jobs3[1]->params['pages'] ),
|
||||
'Last job is leaf job with proper title' );
|
||||
$this->assertEquals( $extraParams['rootJobSignature'], $jobs3[1]->params['rootJobSignature'],
|
||||
'Last leaf job has root params' );
|
||||
|
|
@ -91,7 +91,7 @@ class RefreshLinksPartitionTest extends MediaWikiTestCase {
|
|||
|
||||
public static function provider_backlinks() {
|
||||
$pages = array();
|
||||
for ( $i=0; $i<20; ++$i ) {
|
||||
for ( $i = 0; $i < 20; ++$i ) {
|
||||
$pages[] = array( 0, "Page-$i" );
|
||||
}
|
||||
return array(
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ class SpecialSearchTest extends MediaWikiTestCase {
|
|||
array( /** Expected: */
|
||||
'ProfileName' => $expectedProfile,
|
||||
'Namespaces' => $expectedNS,
|
||||
)
|
||||
, array( /** Actual: */
|
||||
),
|
||||
array( /** Actual: */
|
||||
'ProfileName' => $search->getProfile(),
|
||||
'Namespaces' => $search->getNamespaces(),
|
||||
)
|
||||
, $message
|
||||
),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue