24 require_once __DIR__ .
'/Maintenance.php';
34 parent::__construct();
35 $this->
addDescription(
'Populate the fa_sha1 field from fa_storage_key' );
39 return 'populate fa_sha1';
43 return 'fa_sha1 column of filearchive table already populated.';
47 $startTime = microtime(
true );
49 $table =
'filearchive';
50 $conds = [
'fa_sha1' =>
'',
'fa_storage_key IS NOT NULL' ];
52 if ( !$dbw->fieldExists( $table,
'fa_sha1', __METHOD__ ) ) {
53 $this->
output(
"fa_sha1 column does not exist\n\n",
true );
58 $this->
output(
"Populating fa_sha1 field from fa_storage_key\n" );
59 $endId = $dbw->selectField( $table,
'MAX(fa_id)',
false, __METHOD__ );
67 [
'fa_id',
'fa_storage_key' ],
70 [
'LIMIT' => $batchSize ]
75 if ( $row->fa_storage_key ==
'' ) {
81 [
'fa_sha1' => $sha1 ],
82 [
'fa_id' => $row->fa_id ],
85 $lastId = $row->fa_id;
90 if ( $i !== $batchSize ) {
96 "id %d done (up to %d), %5.3f%% \r", $lastId, $endId, $lastId / $endId * 100 ) );
100 $processingTime = microtime(
true ) - $startTime;
101 $this->
output( sprintf(
"\nDone %d files in %.1f seconds\n", $done, $processingTime ) );
wfWaitForSlaves($ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null)
Waits for the replica DBs to catch up to the master position.
getDB($db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
require_once RUN_MAINTENANCE_IF_MAIN
addDescription($text)
Set the description text.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
output($out, $channel=null)
Throw some output to the user.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Class for scripts that perform database maintenance and want to log the update in updatelog so we can...
static getHashFromKey($key)
Gets the SHA1 hash from a storage key.
int $mBatchSize
Batch size.
Maintenance script to populate the fa_sha1 field.