);
$wgOut->addHTML( "{$label} {$input}" );
}
-
}
/**
function wfHostname() {
static $host;
if ( is_null( $host ) ) {
-
# Hostname overriding
global $wgOverrideHostname;
if ( $wgOverrideHostname !== false ) {
'encoding' => 'JSON',
'cacheTTL' => 10,
'skewTTL' => 1,
- 'timeout' => 10
+ 'timeout' => 2
];
$this->host = $params['host'];
}
// Avoid the server next time if that failed
- $dsd->removeServer( $server, $servers );
+ $servers = $dsd->removeServer( $server, $servers );
} while ( $servers );
return [ $config, $error, $retry ];
* but instead manually called by WikitextHandler.
* This should be fixed in the future.
*/
-class FileContentHandler extends WikitextContentHandler {
+class FileContentHandler extends WikitextContentHandler {
public function getFieldsForSearchIndex( SearchEngine $engine ) {
$fields['file_media_type'] =
],
__METHOD__
);
-
},
__METHOD__
);
// Check QUERY_STRING or REQUEST_URI
if ( isset( $vars['SERVER_SOFTWARE'] )
&& isset( $vars['REQUEST_URI'] )
- && self::haveUndecodedRequestUri( $vars['SERVER_SOFTWARE'] ) )
- {
+ && self::haveUndecodedRequestUri( $vars['SERVER_SOFTWARE'] )
+ ) {
$urlPart = $vars['REQUEST_URI'];
} elseif ( isset( $vars['QUERY_STRING'] ) ) {
$urlPart = $vars['QUERY_STRING'];
// Some servers have PATH_INFO but not REQUEST_URI, so we check both
// to be on the safe side.
if ( isset( $vars['PATH_INFO'] )
- && self::isUrlExtensionBad( $vars['PATH_INFO'], $extWhitelist ) )
- {
+ && self::isUrlExtensionBad( $vars['PATH_INFO'], $extWhitelist )
+ ) {
return true;
}
// If the extension is NOT exe, dll or cgi, return it
$extension = substr( $url, $pos, $nextPos - $pos );
if ( strcasecmp( $extension, 'exe' ) && strcasecmp( $extension, 'dll' ) &&
- strcasecmp( $extension, 'cgi' ) )
- {
+ strcasecmp( $extension, 'cgi' )
+ ) {
return $extension;
}
// Else continue looking
$proposedFormat = $this->getDataFormat( $version, $proposed );
if ( $proposedFormat == 'unknown'
&& $proposed != 'multipart/mixed'
- && $proposed != 'multipart/x-mixed-replace' )
- {
+ && $proposed != 'multipart/x-mixed-replace'
+ ) {
return $proposed;
}
if ( strval( $chunk ) === '' ) {
return 'image/gif';
}
if ( ( $proposed == 'image/pjpeg' || $proposed == 'image/jpeg' )
- && $binaryType == 'image/pjpeg' )
- {
+ && $binaryType == 'image/pjpeg'
+ ) {
return $proposed;
}
// PNG check added in IE 7
if ( $version >= 'ie07'
&& ( $proposed == 'image/x-png' || $proposed == 'image/png' )
- && $binaryType == 'image/x-png' )
- {
+ && $binaryType == 'image/x-png'
+ ) {
return $proposed;
}
}
if ( isset( $sampleFound['rdf-tag'] )
&& isset( $sampleFound['rdf-url'] )
- && isset( $sampleFound['rdf-purl'] ) )
- {
+ && isset( $sampleFound['rdf-purl'] )
+ ) {
return 'application/rss+xml';
}
if ( isset( $sampleFound['atom'] ) ) {
// Freaky heuristics to determine if the data is text or binary
// The heuristic is of course broken for non-ASCII text
if ( $counters['ctrl'] != 0 && ( $counters['ff'] + $counters['low'] )
- < ( $counters['ctrl'] + $counters['high'] ) * 16 )
- {
+ < ( $counters['ctrl'] + $counters['high'] ) * 16
+ ) {
$kindOfBinary = true;
$type = $binaryType ? $binaryType : $textType;
if ( $type === false ) {
if ( $chunk2 == 'BM'
&& substr( $chunk, 6, 2 ) == "\000\000"
- && substr( $chunk, 8, 2 ) == "\000\000" )
- {
+ && substr( $chunk, 8, 2 ) == "\000\000"
+ ) {
return 'image/bmp'; // another non-standard MIME
}
if ( $chunk4 == 'RIFF'
- && substr( $chunk, 8, 4 ) == 'WAVE' )
- {
+ && substr( $chunk, 8, 4 ) == 'WAVE'
+ ) {
return 'audio/wav';
}
// These were integer literals in IE
if ( $chunk4 == ".sd\000"
|| $chunk4 == ".snd"
|| $chunk4 == "\000ds."
- || $chunk4 == "dns." )
- {
+ || $chunk4 == "dns."
+ ) {
return 'audio/basic';
}
if ( $chunk3 == "MM\000" ) {
return 'video/mpeg';
}
if ( $chunk4 == "\001\000\000\000"
- && substr( $chunk, 40, 4 ) == ' EMF' )
- {
+ && substr( $chunk, 40, 4 ) == ' EMF'
+ ) {
return 'image/x-emf';
}
if ( $chunk4 == "\xd7\xcd\xc6\x9a" ) {
if ( !strncasecmp( $remainder, $rdfUrl, strlen( $rdfUrl ) ) ) {
$found['rdf-url'] = true;
if ( isset( $found['rdf-tag'] )
- && isset( $found['rdf-purl'] ) ) // [sic]
- {
+ && isset( $found['rdf-purl'] ) // [sic]
+ ) {
break;
}
continue;
if ( !strncasecmp( $remainder, $rdfPurl, strlen( $rdfPurl ) ) ) {
if ( isset( $found['rdf-tag'] )
- && isset( $found['rdf-url'] ) ) // [sic]
- {
+ && isset( $found['rdf-url'] ) // [sic]
+ ) {
break;
}
continue;
( strpos( $head, "<\x00?\x00 " ) !== false ) ||
( strpos( $head, "<\x00?\x00\n" ) !== false ) ||
( strpos( $head, "<\x00?\x00\t" ) !== false ) ||
- ( strpos( $head, "<\x00?\x00=" ) !== false ) ) {
-
+ ( strpos( $head, "<\x00?\x00=" ) !== false )
+ ) {
$this->logger->info( __METHOD__ . ": recognized $file as application/x-php\n" );
return 'application/x-php';
}
// Special code for ogg - detect if it's video (theora),
// else label it as sound.
if ( $mime == 'application/ogg' && file_exists( $path ) ) {
-
// Read a chunk of the file
$f = fopen( $path, "rt" );
if ( !$f ) {
$sql,
$matches
) ) {
+ $isTemp = isset( $this->mSessionTempTables[$matches[1]] );
unset( $this->mSessionTempTables[$matches[1]] );
- return true;
+ return $isTemp;
} elseif ( preg_match(
'/^(?:INSERT\s+(?:\w+\s+)?INTO|UPDATE|DELETE\s+FROM)\s+[`"\']?(\w+)[`"\']?/i',
$sql,
public function __construct(
ILoadBalancer $lb, BagOStuff $sCache, BagOStuff $cCache, array $options = []
) {
-
}
public function setLogger( LoggerInterface $logger ) {
}
public function scaleLoads( array &$loads, $domain ) {
-
}
public function getLagTimes( array $serverIndexes, $domain ) {
}
public function clearCaches() {
-
}
}
return $data;
}
- /*
+ /**
* Send the metrics over UDP
* Sample the metrics according to their sample rate and send the remaining ones.
*
if ( isset( $data['xmp-exif']['GPSAltitudeRef'] )
&& isset( $data['xmp-exif']['GPSAltitude'] )
) {
-
// Must convert to a real before multiplying by -1
// XMPValidate guarantees there will always be a '/' in this value.
list( $nom, $denom ) = explode( '/', $data['xmp-exif']['GPSAltitude'] );
*/
private function startElementModeInitial( $ns, $tag, $attribs ) {
if ( $ns !== self::NS_RDF ) {
-
if ( isset( $this->items[$ns][$tag] ) ) {
if ( isset( $this->items[$ns][$tag]['structPart'] ) ) {
// If this element is supposed to appear only as
*/
private function startElementModeStruct( $ns, $tag, $attribs ) {
if ( $ns !== self::NS_RDF ) {
-
if ( isset( $this->items[$ns][$tag] ) ) {
if ( isset( $this->items[$ns][$this->ancestorStruct]['children'] )
&& !isset( $this->items[$ns][$this->ancestorStruct]['children'][$tag] )
/**
* @ingroup Parser
*/
-class ParserDiffTest
-{
+class ParserDiffTest {
public $parsers;
public $conf;
public $shortOutput = false;
$title = Title::newFromText( $search . 'Dummy' );
if ( $title && $title->getText() == 'Dummy'
&& $title->getNamespace() != NS_MAIN
- && !$title->isExternal() )
- {
+ && !$title->isExternal()
+ ) {
$ns = [ $title->getNamespace() ];
$search = '';
} else {
$instance = $this->peekService( $name );
- if ( $destroy && $instance instanceof DestructibleService ) {
+ if ( $destroy && $instance instanceof DestructibleService ) {
$instance->destroy();
}
$jsData = $this->getStructuredFilterJsData();
$messages = [];
- foreach ( $jsData['messageKeys'] as $key ){
+ foreach ( $jsData['messageKeys'] as $key ) {
$messages[$key] = $this->msg( $key )->plain();
}
}
return $data;
-
},
[ 'pcTTL' => $cache::TTL_PROC_LONG, 'version' => self::VERSION ]
);
/**
* @param IDatabase $db The database to read from
- * @param string|array $table The name or names of the table to read from
+ * @param string|array $table The name or names of the table to read from
* @param string|array $primaryKey The name or names of the primary key columns
- * @param integer $batchSize The number of rows to fetch per iteration
+ * @param integer $batchSize The number of rows to fetch per iteration
* @throws InvalidArgumentException
*/
public function __construct( IDatabase $db, $table, $primaryKey, $batchSize ) {
* interwiki prefix. Includes a per-wiki header indicating where
* the results are from.
*/
-class SimpleSearchResultSetWidget implements SearchResultSetWidget{
+class SimpleSearchResultSetWidget implements SearchResultSetWidget {
/** @var SpecialSearch */
protected $specialSearch;
/** @var SearchResultWidget */
*/
/**
- * A fake language converter
+ * A fake language variant converter. Languages which do not implement variant
+ * conversion, for example, English, should return a FakeConverter rather than a
+ * LanguageConverter when asked for their converter. The fake converter just
+ * returns text unchanged, i.e. it doesn't do any conversion.
+ *
+ * See https://www.mediawiki.org/wiki/Writing_systems#LanguageConverter.
*
* @ingroup Language
*/
$lines = explode( "\n", shell_exec( 'git log --format="%aN"' ) );
foreach ( $lines as $line ) {
- if ( empty( $line ) ) {
+ if ( empty( $line ) ) {
continue;
}
if ( substr( $line, 0, 5 ) === '[BOT]' ) {
'filters' => [],
]
);
-
}
// @codingStandardsIgnoreStart
}
protected function mysqlRealEscapeString( $s ) {
-
}
function insertId() {
$post = DeferredUpdates::POSTSEND;
$all = DeferredUpdates::ALL;
- $update = $this->getMockBuilder( 'DeferrableUpdate' )
- ->getMock();
+ $update = $this->getMock( DeferrableUpdate::class );
$update->expects( $this->never() )
->method( 'doUpdate' );
$record = $discoverer->pickServer( $params );
$this->assertEquals( $expected, $record );
-
}
public static function provideRecords() {
$expected,
$module->getContent( $titleText )
);
-
}
/**
}
);
$this->assertEquals( "test", $field1->merge( $field2 ) );
-
}
}
'watchlistreloadautomatically' => 0,
]
);
-
}
/**