* @return String complete HTML table row.
*/
public function getRaw( $value ) {
- list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
+ list( $errors, ) = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
$helptext = $this->getHelpTextHtmlRaw( $this->getHelpText() );
$cellAttributes = array();
// Use always content language to avoid loading hundreds of languages
// to get the link color.
global $wgContLang;
- list( $name, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->getText() ) );
+ list( $name, ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->getText() ) );
$message = wfMessage( $name )->inLanguage( $wgContLang )->useDatabase( false );
return $message->exists();
}
* @return string
*/
public static function detectProtocol() {
- list( $proto, $stdPort ) = self::detectProtocolAndStdPort();
+ list( $proto, ) = self::detectProtocolAndStdPort();
return $proto;
}
$size = 0;
foreach ( $struct as $type ) {
if ( is_array( $type ) ) {
- list( $typeName, $fieldSize ) = $type;
+ list( , $fieldSize ) = $type;
$size += $fieldSize;
} else {
$size += $type;
}
if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
- list( $ext, $mime ) = $file->getHandler()->getThumbType(
+ list( , $mime ) = $file->getHandler()->getThumbType(
$mto->getExtension(), $file->getMimeType(), $thumbParams );
$vals['thumbmime'] = $mime;
}
);
}
} else {
- list( $host, $lag, $index ) = $lb->getMaxLag();
+ list( , $lag, $index ) = $lb->getMaxLag();
$data[] = array(
'host' => $wgShowHostnames
? $lb->getServerName( $index )
wfSuppressWarnings();
foreach ( $handlers as $handler ) {
- $info = '';
-
if ( is_array( $handler ) ) {
if ( is_object( $handler[0] ) ) {
$info = get_class( $handler[0] );
# @todo: could implement this in DifferenceEngine and just delegate here?
- if ( !$lang ) $lang = $wgContLang;
+ if ( !$lang ) {
+ $lang = $wgContLang;
+ }
$otext = $this->getNativeData();
$ntext = $this->getNativeData();
# Note: Use native PHP diff, external engines don't give us abstract output
- $ota = explode( "\n", $wgContLang->segmentForDiff( $otext ) );
- $nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) );
+ $ota = explode( "\n", $lang->segmentForDiff( $otext ) );
+ $nta = explode( "\n", $lang->segmentForDiff( $ntext ) );
$diff = new Diff( $ota, $nta );
return $diff;
'See DefaultSettings.php entry for $wgDBservers.' );
}
- $host = $server['host'];
- $dbname = $server['dbname'];
-
if ( $dbNameOverride !== false ) {
- $server['dbname'] = $dbname = $dbNameOverride;
+ $server['dbname'] = $dbNameOverride;
}
# Create object
if ( $relPath === null ) {
return null; // invalid
}
- list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $storagePath );
+ list( , $shortCont, ) = FileBackend::splitStoragePath( $storagePath );
$fsPath = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
if ( $relPath != '' ) {
$fsPath .= "/{$relPath}";
*/
protected function doPrepareInternal( $fullCont, $dirRel, array $params ) {
$status = Status::newGood();
- list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
$existed = is_dir( $dir ); // already there?
*/
protected function doSecureInternal( $fullCont, $dirRel, array $params ) {
$status = Status::newGood();
- list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
// Seed new directories with a blank index.html, to prevent crawling...
*/
protected function doPublishInternal( $fullCont, $dirRel, array $params ) {
$status = Status::newGood();
- list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
// Unseed new directories with a blank index.html, to allow crawling...
*/
protected function doCleanInternal( $fullCont, $dirRel, array $params ) {
$status = Status::newGood();
- list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
$this->trapWarnings();
* @return bool|null
*/
protected function doDirectoryExists( $fullCont, $dirRel, array $params ) {
- list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
* @return Array|null
*/
public function getDirectoryListInternal( $fullCont, $dirRel, array $params ) {
- list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
$exists = is_dir( $dir );
* @return Array|FSFileBackendFileList|null
*/
public function getFileListInternal( $fullCont, $dirRel, array $params ) {
- list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
$exists = is_dir( $dir );
*/
final public static function parentStoragePath( $storagePath ) {
$storagePath = dirname( $storagePath );
- list( $b, $cont, $rel ) = self::splitStoragePath( $storagePath );
+ list( , , $rel ) = self::splitStoragePath( $storagePath );
return ( $rel === null ) ? null : $storagePath;
}
* @return FileBackend|null Backend or null on failure
*/
public function backendFromPath( $storagePath ) {
- list( $backend, $c, $p ) = FileBackend::splitStoragePath( $storagePath );
+ list( $backend, , ) = FileBackend::splitStoragePath( $storagePath );
if ( $backend !== null && isset( $this->backends[$backend] ) ) {
return $this->get( $backend );
}
* @return bool Path container should have dir changes pushed to all backends
*/
protected function replicateContainerDirChanges( $path ) {
- list( $b, $shortCont, $r ) = self::splitStoragePath( $path );
+ list( , $shortCont, ) = self::splitStoragePath( $path );
return !in_array( $shortCont, $this->noPushDirConts );
}
$status->merge( $this->doPrepareInternal( $fullCont, $dir, $params ) );
} else { // directory is on several shards
wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
- list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = self::splitStoragePath( $params['dir'] );
foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) {
$status->merge( $this->doPrepareInternal( "{$fullCont}{$suffix}", $dir, $params ) );
}
$status->merge( $this->doSecureInternal( $fullCont, $dir, $params ) );
} else { // directory is on several shards
wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
- list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = self::splitStoragePath( $params['dir'] );
foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) {
$status->merge( $this->doSecureInternal( "{$fullCont}{$suffix}", $dir, $params ) );
}
$status->merge( $this->doPublishInternal( $fullCont, $dir, $params ) );
} else { // directory is on several shards
wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
- list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = self::splitStoragePath( $params['dir'] );
foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) {
$status->merge( $this->doPublishInternal( "{$fullCont}{$suffix}", $dir, $params ) );
}
$this->deleteContainerCache( $fullCont ); // purge cache
} else { // directory is on several shards
wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
- list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = self::splitStoragePath( $params['dir'] );
foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) {
$status->merge( $this->doCleanInternal( "{$fullCont}{$suffix}", $dir, $params ) );
$this->deleteContainerCache( "{$fullCont}{$suffix}" ); // purge cache
return $this->doDirectoryExists( $fullCont, $dir, $params );
} else { // directory is on several shards
wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
- list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = self::splitStoragePath( $params['dir'] );
$res = false; // response
foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) {
$exists = $this->doDirectoryExists( "{$fullCont}{$suffix}", $dir, $params );
} else {
wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
// File listing spans multiple containers/shards
- list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = self::splitStoragePath( $params['dir'] );
return new FileBackendStoreShardDirIterator( $this,
$fullCont, $dir, $this->getContainerSuffixes( $shortCont ), $params );
}
} else {
wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
// File listing spans multiple containers/shards
- list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+ list( , $shortCont, ) = self::splitStoragePath( $params['dir'] );
return new FileBackendStoreShardFileIterator( $this,
$fullCont, $dir, $this->getContainerSuffixes( $shortCont ), $params );
}
final public function preloadCache( array $paths ) {
$fullConts = array(); // full container names
foreach ( $paths as $path ) {
- list( $fullCont, $r, $s ) = $this->resolveStoragePath( $path );
+ list( $fullCont, , ) = $this->resolveStoragePath( $path );
$fullConts[] = $fullCont;
}
// Load from the persistent file and container caches
* @return bool
*/
final public function isSingleShardPathInternal( $storagePath ) {
- list( $c, $r, $shard ) = $this->resolveStoragePath( $storagePath );
+ list( , , $shard ) = $this->resolveStoragePath( $storagePath );
return ( $shard !== null );
}
}
// Get all the corresponding cache keys for paths...
foreach ( $paths as $path ) {
- list( $fullCont, $r, $s ) = $this->resolveStoragePath( $path );
+ list( $fullCont, , ) = $this->resolveStoragePath( $path );
if ( $fullCont !== null ) { // valid path for this backend
$contNames[$this->containerCacheKey( $fullCont )] = $fullCont;
}
$paths = array_filter( $paths, 'strlen' ); // remove nulls
// Get all the corresponding cache keys for paths...
foreach ( $paths as $path ) {
- list( $cont, $rel, $s ) = $this->resolveStoragePath( $path );
+ list( , $rel, ) = $this->resolveStoragePath( $path );
if ( $rel !== null ) { // valid path for this backend
$pathNames[$this->fileCacheKey( $path )] = $path;
}
// (a) Check if container already exists
try {
- $contObj = $this->getContainer( $fullCont );
+ $this->getContainer( $fullCont );
// NoSuchContainerException not thrown: container must exist
return $status; // already exists
} catch ( NoSuchContainerException $e ) {
try {
$sContObj = $this->getContainer( $srcCont );
$obj = new CF_Object( $sContObj, $srcRel, false, false ); // skip HEAD
- // Get source file extension
- $ext = FileBackend::extensionFromPath( $path );
// Create a new temporary memory file...
$handle = fopen( 'php://temp', 'wb' );
if ( $handle ) {
$date = gmdate( "YmdHis" );
$hashPath = $this->getHashPath( $originalName );
- $dstRel = "{$hashPath}{$date}!{$originalName}";
$dstUrlRel = $hashPath . $date . '!' . rawurlencode( $originalName );
$virtualUrl = $this->getVirtualUrl( 'temp' ) . '/' . $dstUrlRel;
$operations = array();
$sourceFSFilesToDelete = array(); // cleanup for disk source files
// Validate each triplet and get the store operation...
- foreach ( $ntuples as $i => $ntuple ) {
+ foreach ( $ntuples as $ntuple ) {
list( $srcPath, $dstRel, $archiveRel ) = $ntuple;
$options = isset( $ntuple[3] ) ? $ntuple[3] : array();
// Resolve source to a storage path if virtual
$status->merge( $backend->doOperations( $operations ) );
// Find out which files were archived...
foreach ( $ntuples as $i => $ntuple ) {
- list( $srcPath, $dstRel, $archiveRel ) = $ntuple;
+ list( , , $archiveRel ) = $ntuple;
$archivePath = $this->getZonePath( 'public' ) . "/$archiveRel";
if ( $this->fileExists( $archivePath ) ) {
$status->value[$i] = 'archived';
*/
protected function initDirectory( $dir ) {
$path = $this->resolveToStoragePath( $dir );
- list( $b, $container, $r ) = FileBackend::splitStoragePath( $path );
+ list( , $container, ) = FileBackend::splitStoragePath( $path );
$params = array( 'dir' => $path );
if ( $this->isPrivate || $container === $this->zones['deleted']['container'] ) {
* RTT regression for wikis without 404 handling.
*/
function migrateThumbFile( $thumbName ) {
- $thumbDir = $this->getThumbPath();
-
/* Old code for bug 2532
+ $thumbDir = $this->getThumbPath();
$thumbPath = "$thumbDir/$thumbName";
if ( is_dir( $thumbPath ) ) {
// Directory where file should be
$this->file->lock();
// Leave private files alone
$privateFiles = array();
- list( $oldRels, $deleteCurrent ) = $this->getOldRels();
+ list( $oldRels, ) = $this->getOldRels();
$dbw = $this->file->repo->getMasterDB();
if ( !empty( $oldRels ) ) {
$files = $newBatch = array();
foreach ( $batch as $batchItem ) {
- list( $src, $dest ) = $batchItem;
+ list( $src, ) = $batchItem;
$files[$src] = $this->file->repo->getVirtualUrl( 'public' ) . '/' . rawurlencode( $src );
}
$func = $funcList[0];
$arg = $funcList[1];
$origParams = $funcList[2];
- $ret = call_user_func_array( $func, $arg );
+ call_user_func_array( $func, $arg );
flush();
$this->updatesSkipped[] = $origParams;
}
continue;
}
- list( $all, $lang, $territory, $charset, $modifier ) = $m;
+ list( , $lang, , , ) = $m;
$candidatesByLocale[$m[0]] = $m;
$candidatesByLang[$lang][] = $m;
$formatter->setContext( $this->getContext() );
$formatter->setShowUserToolLinks( !( $this->flags & self::NO_EXTRA_USER_LINKS ) );
- $title = $entry->getTarget();
$time = htmlspecialchars( $this->getLanguage()->userTimeAndDate(
$entry->getTimestamp(), $this->getUser() ) );
// Filter out parameters which are not in format #:foo
foreach ( $entry->getParameters() as $key => $value ) {
- if ( strpos( $key, ':' ) === false ) continue;
- list( $index, $type, $name ) = explode( ':', $key, 3 );
+ if ( strpos( $key, ':' ) === false ) {
+ continue;
+ }
+ list( $index, $type, ) = explode( ':', $key, 3 );
$params[$index - 1] = $this->formatParameterValue( $type, $value );
}
# Insert failed, check to see if it failed due to an expired key
if ( !$ret ) {
- list( $value, $expiry ) = $this->decode( dba_fetch( $key, $handle ) );
+ list( , $expiry ) = $this->decode( dba_fetch( $key, $handle ) );
if ( $expiry && $expiry < time() ) {
# Yes expired, delete and try again
$i = 0;
while ( $i<count( $bits ) ) {
$url = $bits[$i++];
- // @todo FIXME: Unused variable.
- $protocol = $bits[$i++];
+ $i++; // protocol
$text = $bits[$i++];
$trail = $bits[$i++];
$output = call_user_func_array( $this->mTagHooks[$name],
array( $content, $attributes, $this, $frame ) );
} elseif ( isset( $this->mFunctionTagHooks[$name] ) ) {
- list( $callback, $flags ) = $this->mFunctionTagHooks[$name];
+ list( $callback, ) = $this->mFunctionTagHooks[$name];
if ( !is_callable( $callback ) ) {
throw new MWException( "Tag hook for $name is not callable\n" );
}
$result = array();
// loop all results and collect them in an array
- foreach ( $data as $j => $query ) {
+ foreach ( $data as $query ) {
foreach ( $query as $i => $row ) {
// use index column as key, allowing us to easily sort in PHP
$result[$row->{$this->getIndexField()} . "-$i"] = $row;
$makepage = false;
# Page already exists. Import the history, and if necessary
# we'll update the latest revision field in the record.
- $newid = 0;
- $pageId = $page->page_id;
+
$previousRevId = $page->page_latest;
+
# Get the time span of this page
$previousTimestamp = $dbw->selectField( 'revision', 'rev_timestamp',
array( 'rev_id' => $previousRevId ),
$revision = Revision::newFromArchiveRow( $row,
array(
'title' => $article->getTitle(), // used to derive default content model
- ) );
-
- $m = $revision->getContentModel();
-
+ )
+ );
$user = User::newFromName( $revision->getRawUserText(), false );
$content = $revision->getContent( Revision::RAW );
/**
* Default action when we don't have a subpage -- just show links to the uploads we have,
* Also show a button to clear stashed files
- * @param $status [optional] Status: the result of processRequest
* @return bool
*/
- private function showUploads( $status = null ) {
- if ( $status === null ) {
- $status = Status::newGood();
- }
-
+ private function showUploads() {
// sets the title, etc.
$this->setHeaders();
$this->outputHeader();