MediaWiki  master
recompressTracked.php
Go to the documentation of this file.
1 <?php
31 use Wikimedia\AtEase\AtEase;
32 
34 require __DIR__ . '/../CommandLineInc.php';
35 
36 if ( count( $args ) < 1 ) {
37  echo "Usage: php recompressTracked.php [options] <cluster> [... <cluster>...]
38 Moves blobs indexed by trackBlobs.php to a specified list of destination clusters,
39 and recompresses them in the process. Restartable.
40 
41 Options:
42  --procs <procs> Set the number of child processes (default 1)
43  --copy-only Copy only, do not update the text table. Restart
44  without this option to complete.
45  --debug-log <file> Log debugging data to the specified file
46  --info-log <file> Log progress messages to the specified file
47  --critical-log <file> Log error messages to the specified file
48 ";
49  exit( 1 );
50 }
51 
53 $job->execute();
54 
62  public $destClusters;
63  public $batchSize = 1000;
64  public $orphanBatchSize = 1000;
65  public $reportingInterval = 10;
66  public $numProcs = 1;
67  public $numBatches = 0;
70  public $copyOnly = false;
71  public $isChild = false;
72  public $childId = false;
73  public $noCount = false;
76  public $store;
78  private $blobStore;
79 
80  private static $optionsWithArgs = [
81  'procs',
82  'child-id',
83  'debug-log',
84  'info-log',
85  'critical-log'
86  ];
87 
88  private static $cmdLineOptionMap = [
89  'no-count' => 'noCount',
90  'procs' => 'numProcs',
91  'copy-only' => 'copyOnly',
92  'child' => 'isChild',
93  'child-id' => 'childId',
94  'debug-log' => 'debugLog',
95  'info-log' => 'infoLog',
96  'critical-log' => 'criticalLog',
97  ];
98 
99  public static function getOptionsWithArgs() {
100  return self::$optionsWithArgs;
101  }
102 
103  public static function newFromCommandLine( $args, $options ) {
104  $jobOptions = [ 'destClusters' => $args ];
105  foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
106  if ( isset( $options[$cmdOption] ) ) {
107  $jobOptions[$classOption] = $options[$cmdOption];
108  }
109  }
110 
111  return new self( $jobOptions );
112  }
113 
114  public function __construct( $options ) {
115  foreach ( $options as $name => $value ) {
116  $this->$name = $value;
117  }
118  $esFactory = MediaWikiServices::getInstance()->getExternalStoreFactory();
119  $this->store = $esFactory->getStore( 'DB' );
120  if ( !$this->isChild ) {
121  $GLOBALS['wgDebugLogPrefix'] = "RCT M: ";
122  } elseif ( $this->childId !== false ) {
123  $GLOBALS['wgDebugLogPrefix'] = "RCT {$this->childId}: ";
124  }
125  $this->pageBlobClass = function_exists( 'xdiff_string_bdiff' ) ?
126  DiffHistoryBlob::class : ConcatenatedGzipHistoryBlob::class;
127  $this->orphanBlobClass = ConcatenatedGzipHistoryBlob::class;
128 
129  $this->blobStore = MediaWikiServices::getInstance()
130  ->getBlobStoreFactory()
131  ->newSqlBlobStore();
132  }
133 
134  public function debug( $msg ) {
135  wfDebug( "$msg" );
136  if ( $this->debugLog ) {
137  $this->logToFile( $msg, $this->debugLog );
138  }
139  }
140 
141  public function info( $msg ) {
142  echo "$msg\n";
143  if ( $this->infoLog ) {
144  $this->logToFile( $msg, $this->infoLog );
145  }
146  }
147 
148  public function critical( $msg ) {
149  echo "$msg\n";
150  if ( $this->criticalLog ) {
151  $this->logToFile( $msg, $this->criticalLog );
152  }
153  }
154 
155  private function logToFile( $msg, $file ) {
156  $header = '[' . date( 'd\TH:i:s' ) . '] ' . wfHostname() . ' ' . posix_getpid();
157  if ( $this->childId !== false ) {
158  $header .= "({$this->childId})";
159  }
160  $header .= ' ' . WikiMap::getCurrentWikiDbDomain()->getId();
161  LegacyLogger::emit( sprintf( "%-50s %s\n", $header, $msg ), $file );
162  }
163 
169  private function syncDBs() {
170  $dbw = wfGetDB( DB_PRIMARY );
171  $dbr = wfGetDB( DB_REPLICA );
172  $pos = $dbw->getPrimaryPos();
173  $dbr->primaryPosWait( $pos, 100000 );
174  }
175 
179  public function execute() {
180  if ( $this->isChild ) {
181  $this->executeChild();
182  } else {
183  $this->executeParent();
184  }
185  }
186 
190  public function executeParent() {
191  if ( !$this->checkTrackingTable() ) {
192  return;
193  }
194 
195  $this->syncDBs();
196  $this->startChildProcs();
197  $this->doAllPages();
198  $this->doAllOrphans();
199  $this->killChildProcs();
200  }
201 
206  private function checkTrackingTable() {
207  $dbr = wfGetDB( DB_REPLICA );
208  if ( !$dbr->tableExists( 'blob_tracking', __METHOD__ ) ) {
209  $this->critical( "Error: blob_tracking table does not exist" );
210 
211  return false;
212  }
213  $row = $dbr->newSelectQueryBuilder()
214  ->select( '*' )
215  ->from( 'blob_tracking' )
216  ->caller( __METHOD__ )->fetchRow();
217  if ( !$row ) {
218  $this->info( "Warning: blob_tracking table contains no rows, skipping this wiki." );
219 
220  return false;
221  }
222 
223  return true;
224  }
225 
232  private function startChildProcs() {
233  $wiki = WikiMap::getCurrentWikiId();
234 
235  $cmd = 'php ' . Shell::escape( __FILE__ );
236  foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
237  if ( $cmdOption == 'child-id' ) {
238  continue;
239  }
240  if ( in_array( $cmdOption, self::$optionsWithArgs ) && isset( $this->$classOption ) ) {
241  // @phan-suppress-next-line PhanTypeMismatchArgument False positive
242  $cmd .= " --$cmdOption " . Shell::escape( $this->$classOption );
243  } elseif ( $this->$classOption ) {
244  $cmd .= " --$cmdOption";
245  }
246  }
247  $cmd .= ' --child' .
248  ' --wiki ' . Shell::escape( $wiki ) .
249  ' ' . Shell::escape( ...$this->destClusters );
250 
251  $this->childPipes = $this->childProcs = [];
252  for ( $i = 0; $i < $this->numProcs; $i++ ) {
253  $pipes = [];
254  $spec = [
255  [ 'pipe', 'r' ],
256  [ 'file', 'php://stdout', 'w' ],
257  [ 'file', 'php://stderr', 'w' ]
258  ];
259  AtEase::suppressWarnings();
260  $proc = proc_open( "$cmd --child-id $i", $spec, $pipes );
261  AtEase::restoreWarnings();
262  if ( !$proc ) {
263  $this->critical( "Error opening child process: $cmd" );
264  exit( 1 );
265  }
266  $this->childProcs[$i] = $proc;
267  $this->childPipes[$i] = $pipes[0];
268  }
269  $this->prevChildId = -1;
270  }
271 
275  private function killChildProcs() {
276  $this->info( "Waiting for child processes to finish..." );
277  for ( $i = 0; $i < $this->numProcs; $i++ ) {
278  $this->dispatchToChild( $i, 'quit' );
279  }
280  for ( $i = 0; $i < $this->numProcs; $i++ ) {
281  $status = proc_close( $this->childProcs[$i] );
282  if ( $status ) {
283  $this->critical( "Warning: child #$i exited with status $status" );
284  }
285  }
286  $this->info( "Done." );
287  }
288 
294  private function dispatch( ...$args ) {
295  $pipes = $this->childPipes;
296  $x = [];
297  $y = [];
298  $numPipes = stream_select( $x, $pipes, $y, 3600 );
299  if ( !$numPipes ) {
300  $this->critical( "Error waiting to write to child process. Aborting" );
301  exit( 1 );
302  }
303  for ( $i = 0; $i < $this->numProcs; $i++ ) {
304  $childId = ( $i + $this->prevChildId + 1 ) % $this->numProcs;
305  if ( isset( $pipes[$childId] ) ) {
306  $this->prevChildId = $childId;
307  $this->dispatchToChild( $childId, $args );
308 
309  return;
310  }
311  }
312  $this->critical( "Unreachable" );
313  exit( 1 );
314  }
315 
321  private function dispatchToChild( $childId, $args ) {
322  $args = (array)$args;
323  $cmd = implode( ' ', $args );
324  fwrite( $this->childPipes[$childId], "$cmd\n" );
325  }
326 
330  private function doAllPages() {
331  $dbr = wfGetDB( DB_REPLICA );
332  $i = 0;
333  $startId = 0;
334  if ( $this->noCount ) {
335  $numPages = '[unknown]';
336  } else {
337  $numPages = $dbr->selectField( 'blob_tracking',
338  'COUNT(DISTINCT bt_page)',
339  # A condition is required so that this query uses the index
340  [ 'bt_moved' => 0 ],
341  __METHOD__
342  );
343  }
344  if ( $this->copyOnly ) {
345  $this->info( "Copying pages..." );
346  } else {
347  $this->info( "Moving pages..." );
348  }
349  while ( true ) {
350  $res = $dbr->newSelectQueryBuilder()
351  ->select( [ 'bt_page' ] )
352  ->distinct()
353  ->from( 'blob_tracking' )
354  ->where( [ 'bt_moved' => 0, 'bt_page > ' . $dbr->addQuotes( $startId ) ] )
355  ->orderBy( 'bt_page' )
356  ->limit( $this->batchSize )
357  ->caller( __METHOD__ )->fetchResultSet();
358  if ( !$res->numRows() ) {
359  break;
360  }
361  foreach ( $res as $row ) {
362  $startId = $row->bt_page;
363  $this->dispatch( 'doPage', $row->bt_page );
364  $i++;
365  }
366  $this->report( 'pages', $i, $numPages );
367  }
368  $this->report( 'pages', $i, $numPages );
369  if ( $this->copyOnly ) {
370  $this->info( "All page copies queued." );
371  } else {
372  $this->info( "All page moves queued." );
373  }
374  }
375 
382  private function report( $label, $current, $end ) {
383  $this->numBatches++;
384  if ( $current == $end || $this->numBatches >= $this->reportingInterval ) {
385  $this->numBatches = 0;
386  $this->info( "$label: $current / $end" );
387  MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->waitForReplication();
388  }
389  }
390 
394  private function doAllOrphans() {
395  $dbr = wfGetDB( DB_REPLICA );
396  $startId = 0;
397  $i = 0;
398  if ( $this->noCount ) {
399  $numOrphans = '[unknown]';
400  } else {
401  $numOrphans = $dbr->newSelectQueryBuilder()
402  ->select( 'COUNT(DISTINCT bt_text_id)' )
403  ->from( 'blob_tracking' )
404  ->where( [ 'bt_moved' => 0, 'bt_page' => 0 ] )
405  ->caller( __METHOD__ )->fetchField();
406  if ( !$numOrphans ) {
407  return;
408  }
409  }
410  if ( $this->copyOnly ) {
411  $this->info( "Copying orphans..." );
412  } else {
413  $this->info( "Moving orphans..." );
414  }
415 
416  while ( true ) {
417  $res = $dbr->newSelectQueryBuilder()
418  ->select( [ 'bt_text_id' ] )
419  ->distinct()
420  ->from( 'blob_tracking' )
421  ->where( [ 'bt_moved' => 0, 'bt_page' => 0, 'bt_text_id > ' . $dbr->addQuotes( $startId ) ] )
422  ->orderBy( 'bt_text_id' )
423  ->limit( $this->batchSize )
424  ->caller( __METHOD__ )->fetchResultSet();
425  if ( !$res->numRows() ) {
426  break;
427  }
428  $ids = [];
429  foreach ( $res as $row ) {
430  $startId = $row->bt_text_id;
431  $ids[] = $row->bt_text_id;
432  $i++;
433  }
434  // Need to send enough orphan IDs to the child at a time to fill a blob,
435  // so orphanBatchSize needs to be at least ~100.
436  // batchSize can be smaller or larger.
437  while ( count( $ids ) > $this->orphanBatchSize ) {
438  $args = array_slice( $ids, 0, $this->orphanBatchSize );
439  $ids = array_slice( $ids, $this->orphanBatchSize );
440  array_unshift( $args, 'doOrphanList' );
441  $this->dispatch( ...$args );
442  }
443  if ( count( $ids ) ) {
444  $args = $ids;
445  array_unshift( $args, 'doOrphanList' );
446  $this->dispatch( ...$args );
447  }
448 
449  $this->report( 'orphans', $i, $numOrphans );
450  }
451  $this->report( 'orphans', $i, $numOrphans );
452  $this->info( "All orphans queued." );
453  }
454 
458  public function executeChild() {
459  $this->debug( 'starting' );
460  $this->syncDBs();
461 
462  while ( !feof( STDIN ) ) {
463  $line = rtrim( fgets( STDIN ) );
464  if ( $line == '' ) {
465  continue;
466  }
467  $this->debug( $line );
468  $args = explode( ' ', $line );
469  $cmd = array_shift( $args );
470  switch ( $cmd ) {
471  case 'doPage':
472  $this->doPage( intval( $args[0] ) );
473  break;
474  case 'doOrphanList':
475  $this->doOrphanList( array_map( 'intval', $args ) );
476  break;
477  case 'quit':
478  return;
479  }
480  MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->waitForReplication();
481  }
482  }
483 
489  private function doPage( $pageId ) {
490  $title = Title::newFromID( $pageId );
491  if ( $title ) {
492  $titleText = $title->getPrefixedText();
493  } else {
494  $titleText = '[deleted]';
495  }
496  $dbr = wfGetDB( DB_REPLICA );
497 
498  // Finish any incomplete transactions
499  if ( !$this->copyOnly ) {
500  $this->finishIncompleteMoves( [ 'bt_page' => $pageId ] );
501  $this->syncDBs();
502  }
503 
504  $startId = 0;
505  $trx = new CgzCopyTransaction( $this, $this->pageBlobClass );
506 
507  $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
508  while ( true ) {
509  $res = $dbr->newSelectQueryBuilder()
510  ->select( '*' )
511  ->from( 'blob_tracking' )
512  ->join( 'text', null, 'bt_text_id=old_id' )
513  ->where( [
514  'bt_page' => $pageId,
515  'bt_text_id > ' . $dbr->addQuotes( $startId ),
516  'bt_moved' => 0,
517  'bt_new_url' => null,
518  ] )
519  ->orderBy( 'bt_text_id' )
520  ->limit( $this->batchSize )
521  ->caller( __METHOD__ )->fetchResultSet();
522  if ( !$res->numRows() ) {
523  break;
524  }
525 
526  $lastTextId = 0;
527  foreach ( $res as $row ) {
528  $startId = $row->bt_text_id;
529  if ( $lastTextId == $row->bt_text_id ) {
530  // Duplicate (null edit)
531  continue;
532  }
533  $lastTextId = $row->bt_text_id;
534  // Load the text
535  $text = $this->blobStore->expandBlob( $row->old_text, $row->old_flags );
536  if ( $text === false ) {
537  $this->critical( "Error loading {$row->bt_rev_id}/{$row->bt_text_id}" );
538  continue;
539  }
540 
541  // Queue it
542  if ( !$trx->addItem( $text, $row->bt_text_id ) ) {
543  $this->debug( "$titleText: committing blob with " . $trx->getSize() . " items" );
544  $trx->commit();
545  $trx = new CgzCopyTransaction( $this, $this->pageBlobClass );
546  $lbFactory->waitForReplication();
547  }
548  }
549  }
550 
551  $this->debug( "$titleText: committing blob with " . $trx->getSize() . " items" );
552  $trx->commit();
553  }
554 
568  public function moveTextRow( $textId, $url ) {
569  if ( $this->copyOnly ) {
570  $this->critical( "Internal error: can't call moveTextRow() in --copy-only mode" );
571  exit( 1 );
572  }
573  $dbw = wfGetDB( DB_PRIMARY );
574  $dbw->begin( __METHOD__ );
575  $dbw->update( 'text',
576  [ // set
577  'old_text' => $url,
578  'old_flags' => 'external,utf-8',
579  ],
580  [ // where
581  'old_id' => $textId
582  ],
583  __METHOD__
584  );
585  $dbw->update( 'blob_tracking',
586  [ 'bt_moved' => 1 ],
587  [ 'bt_text_id' => $textId ],
588  __METHOD__
589  );
590  $dbw->commit( __METHOD__ );
591  }
592 
603  private function finishIncompleteMoves( $conds ) {
604  $dbr = wfGetDB( DB_REPLICA );
605  $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
606 
607  $startId = 0;
608  $conds = array_merge( $conds, [
609  'bt_moved' => 0,
610  'bt_new_url IS NOT NULL'
611  ] );
612  while ( true ) {
613  $res = $dbr->newSelectQueryBuilder()
614  ->select( '*' )
615  ->from( 'blob_tracking' )
616  ->where( $conds )
617  ->andWhere( [ 'bt_text_id > ' . $dbr->addQuotes( $startId ) ] )
618  ->orderBy( 'bt_text_id' )
619  ->limit( $this->batchSize )
620  ->caller( __METHOD__ )->fetchResultSet();
621  if ( !$res->numRows() ) {
622  break;
623  }
624  $this->debug( 'Incomplete: ' . $res->numRows() . ' rows' );
625  foreach ( $res as $row ) {
626  $startId = $row->bt_text_id;
627  $this->moveTextRow( $row->bt_text_id, $row->bt_new_url );
628  if ( $row->bt_text_id % 10 == 0 ) {
629  $lbFactory->waitForReplication();
630  }
631  }
632  }
633  }
634 
639  public function getTargetCluster() {
640  $cluster = next( $this->destClusters );
641  if ( $cluster === false ) {
642  $cluster = reset( $this->destClusters );
643  }
644 
645  return $cluster;
646  }
647 
653  private function doOrphanList( $textIds ) {
654  // Finish incomplete moves
655  if ( !$this->copyOnly ) {
656  $this->finishIncompleteMoves( [ 'bt_text_id' => $textIds ] );
657  $this->syncDBs();
658  }
659 
660  $trx = new CgzCopyTransaction( $this, $this->orphanBlobClass );
661 
662  $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
663  $res = wfGetDB( DB_REPLICA )->newSelectQueryBuilder()
664  ->select( [ 'old_id', 'old_text', 'old_flags' ] )
665  ->distinct()
666  ->from( 'text' )
667  ->join( 'blob_tracking', null, 'bt_text_id=old_id' )
668  ->where( [ 'old_id' => $textIds, 'bt_moved' => 0 ] )
669  ->caller( __METHOD__ )->fetchResultSet();
670 
671  foreach ( $res as $row ) {
672  $text = $this->blobStore->expandBlob( $row->old_text, $row->old_flags );
673  if ( $text === false ) {
674  $this->critical( "Error: cannot load revision text for old_id={$row->old_id}" );
675  continue;
676  }
677 
678  if ( !$trx->addItem( $text, $row->old_id ) ) {
679  $this->debug( "[orphan]: committing blob with " . $trx->getSize() . " rows" );
680  $trx->commit();
681  $trx = new CgzCopyTransaction( $this, $this->orphanBlobClass );
682  $lbFactory->waitForReplication();
683  }
684  }
685  $this->debug( "[orphan]: committing blob with " . $trx->getSize() . " rows" );
686  $trx->commit();
687  }
688 }
689 
695  public $parent;
696  public $blobClass;
698  public $cgz;
699  public $referrers;
701  private $texts;
702 
708  public function __construct( $parent, $blobClass ) {
709  $this->blobClass = $blobClass;
710  $this->cgz = false;
711  $this->texts = [];
712  $this->parent = $parent;
713  }
714 
722  public function addItem( $text, $textId ) {
723  if ( !$this->cgz ) {
724  $class = $this->blobClass;
725  $this->cgz = new $class;
726  }
727  $hash = $this->cgz->addItem( $text );
728  $this->referrers[$textId] = $hash;
729  $this->texts[$textId] = $text;
730 
731  return $this->cgz->isHappy();
732  }
733 
734  public function getSize() {
735  return count( $this->texts );
736  }
737 
741  public function recompress() {
742  $class = $this->blobClass;
743  $this->cgz = new $class;
744  $this->referrers = [];
745  foreach ( $this->texts as $textId => $text ) {
746  $hash = $this->cgz->addItem( $text );
747  $this->referrers[$textId] = $hash;
748  }
749  }
750 
756  public function commit() {
757  $originalCount = count( $this->texts );
758  if ( !$originalCount ) {
759  return;
760  }
761 
762  /* Check to see if the target text_ids have been moved already.
763  *
764  * We originally read from the replica DB, so this can happen when a single
765  * text_id is shared between multiple pages. It's rare, but possible
766  * if a delete/move/undelete cycle splits up a null edit.
767  *
768  * We do a locking read to prevent closer-run race conditions.
769  */
770  $dbw = wfGetDB( DB_PRIMARY );
771  $dbw->begin( __METHOD__ );
772  $res = $dbw->newSelectQueryBuilder()
773  ->select( [ 'bt_text_id', 'bt_moved' ] )
774  ->forUpdate()
775  ->from( 'blob_tracking' )
776  ->where( [ 'bt_text_id' => array_keys( $this->referrers ) ] )
777  ->caller( __METHOD__ )->fetchResultSet();
778  $dirty = false;
779  foreach ( $res as $row ) {
780  if ( $row->bt_moved ) {
781  # This row has already been moved, remove it
782  $this->parent->debug( "TRX: conflict detected in old_id={$row->bt_text_id}" );
783  unset( $this->texts[$row->bt_text_id] );
784  $dirty = true;
785  }
786  }
787 
788  // Recompress the blob if necessary
789  if ( $dirty ) {
790  if ( !count( $this->texts ) ) {
791  // All have been moved already
792  if ( $originalCount > 1 ) {
793  // This is suspcious, make noise
794  $this->parent->critical(
795  "Warning: concurrent operation detected, are there two conflicting " .
796  "processes running, doing the same job?" );
797  }
798 
799  return;
800  }
801  $this->recompress();
802  }
803 
804  // Insert the data into the destination cluster
805  $targetCluster = $this->parent->getTargetCluster();
806  $store = $this->parent->store;
807  $targetDB = $store->getPrimary( $targetCluster );
808  $targetDB->clearFlag( DBO_TRX ); // we manage the transactions
809  $targetDB->begin( __METHOD__ );
810  $baseUrl = $this->parent->store->store( $targetCluster, serialize( $this->cgz ) );
811 
812  // Write the new URLs to the blob_tracking table
813  foreach ( $this->referrers as $textId => $hash ) {
814  $url = $baseUrl . '/' . $hash;
815  $dbw->update( 'blob_tracking',
816  [ 'bt_new_url' => $url ],
817  [
818  'bt_text_id' => $textId,
819  'bt_moved' => 0, # Check for concurrent conflicting update
820  ],
821  __METHOD__
822  );
823  }
824 
825  $targetDB->commit( __METHOD__ );
826  // Critical section here: interruption at this point causes blob duplication
827  // Reversing the order of the commits would cause data loss instead
828  $dbw->commit( __METHOD__ );
829 
830  // Write the new URLs to the text table and set the moved flag
831  if ( !$this->parent->copyOnly ) {
832  foreach ( $this->referrers as $textId => $hash ) {
833  $url = $baseUrl . '/' . $hash;
834  $this->parent->moveTextRow( $textId, $url );
835  }
836  }
837  }
838 }
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfHostname()
Get host name of the current machine, for use in error reporting.
Class to represent a recompression operation for a single CGZ blob.
RecompressTracked $parent
ConcatenatedGzipHistoryBlob false $cgz
addItem( $text, $textId)
Add text.
commit()
Commit the blob.
recompress()
Recompress text after some aberrant modification.
__construct( $parent, $blobClass)
Create a transaction from a RecompressTracked object.
getPrimary( $cluster)
Get a primary database connection for the specified cluster.
store( $location, $data)
Insert a data item into a given location.The location name The data item string|bool The URL of the s...
PSR-3 logger that mimics the historic implementation of MediaWiki's former wfErrorLog logging impleme...
Service locator for MediaWiki core services.
Executes shell commands.
Definition: Shell.php:46
Service for storing and loading Content objects representing revision data blobs.
Represents a title within MediaWiki.
Definition: Title.php:76
Tools for dealing with other locally-hosted wikis.
Definition: WikiMap.php:31
Maintenance script that moves blobs indexed by trackBlobs.php to a specified list of destination clus...
executeChild()
Main entry point for worker processes.
moveTextRow( $textId, $url)
Atomic move operation.
execute()
Execute parent or child depending on the isChild option.
static newFromCommandLine( $args, $options)
getTargetCluster()
Returns the name of the next target cluster.
executeParent()
Execute the parent process.
ExternalStoreDB $store
const DB_REPLICA
Definition: defines.php:26
const DB_PRIMARY
Definition: defines.php:28
const DBO_TRX
Definition: defines.php:12
$optionsWithArgs
if(count( $args)< 1) $job
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition: router.php:42
$header