}
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;
}
}
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;
}
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 " .
'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 ) .
} else {
return (int)$commitDate;
}
-
- }
+ }
/**
* Return the name of the current branch, or HEAD if not found
. $this->getBody()
. $this->getHiddenFields()
. $this->getButtons()
- . $this->mFooter
- ;
+ . $this->mFooter;
$html = $this->wrapForm( $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;
}
$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'] );
}
$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 ) !== '.' ) {
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;
}
$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" );
}
}
$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" );
}
$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();
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" );
}
}
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 );
* @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'] )
* @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;
# (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;
$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
$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();
$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
$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' ) );
}
);
}
- if( ( $wgUseTidy && $options->getTidy() ) || $wgAlwaysUseTidy ) {
+ if ( ( $wgUseTidy && $options->getTidy() ) || $wgAlwaysUseTidy ) {
$tmp = MWTidy::tidy( $tmp );
}
*/
private function makeForm( $title, $input ) {
$self = $this->getTitle();
- $form = Xml::openElement(
+ $form = Xml::openElement(
'form',
array( 'method' => 'post', 'action' => $self->getLocalUrl() )
);
$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';
'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 );
$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;
}
$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
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 );
$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;
$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];
// 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 ) ) {
case 'lokatiw': # lokatiw
$word = 'wo ' . $word;
break;
- }
+ }
return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values
}
case 'lokatiw': # lokatiw
$word = 'wo ' . $word;
break;
- }
+ }
return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values
}
$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++;
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";
*/
protected function parse( $wikitext ) {
return $this->parser->parse(
- $wikitext
- , $this->getTitle()
- , new ParserOptions()
+ $wikitext,
+ $this->getTitle(),
+ new ParserOptions()
);
}
}
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__ );
'GPSLatitude' => 88.51805555,
'GPSLongitude' => -21.12356945,
'GPSVersionID' => '2.2.0.0'
- )
+ )
);
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/' ),
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
//
// 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 ),
$matches = 0;
- foreach( $indexes as $index ) {
+ foreach ( $indexes as $index ) {
$matches += preg_match( $regex, $index );
$debugmsg .= "\t'$index'\n";
}
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;
*/
public function testGetErrorMessage() {
$method = new ReflectionMethod( 'Status', 'getErrorMessage' );
- $method->setAccessible(true);
+ $method->setAccessible( true );
$status = new Status();
$key = 'foo';
$params = array( 'bar' );
*/
public function testGetErrorMessageArray() {
$method = new ReflectionMethod( 'Status', 'getErrorMessageArray' );
- $method->setAccessible(true);
+ $method->setAccessible( true );
$status = new Status();
$key = 'foo';
$params = array( 'bar' );
$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() );
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] ) ) . ']';
$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' );
'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' );
'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' );
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(
array( /** Expected: */
'ProfileName' => $expectedProfile,
'Namespaces' => $expectedNS,
- )
- , array( /** Actual: */
+ ),
+ array( /** Actual: */
'ProfileName' => $search->getProfile(),
'Namespaces' => $search->getNamespaces(),
- )
- , $message
+ ),
+ $message
);
}