diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2019-10-11 21:07:32 +0200 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2019-11-16 22:54:17 +0000 |
commit | b4fe9c4bcc5e82c100bfd775f26eb6b7cd2968bb (patch) | |
tree | 5a7ef996d9361d3af24925cbcf69ae25ac0a2e86 /maintenance/storage | |
parent | 52d9ddc4f21a56cd08083d8cbf3a2da651906ee6 (diff) | |
download | mediawikicore-b4fe9c4bcc5e82c100bfd775f26eb6b7cd2968bb.tar.gz mediawikicore-b4fe9c4bcc5e82c100bfd775f26eb6b7cd2968bb.zip |
Set method visibility on maintenance scripts
Change-Id: I44c82fbe65e1d002803ce065df6563f06dd39cd4
Diffstat (limited to 'maintenance/storage')
-rw-r--r-- | maintenance/storage/checkStorage.php | 10 | ||||
-rw-r--r-- | maintenance/storage/recompressTracked.php | 50 | ||||
-rw-r--r-- | maintenance/storage/trackBlobs.php | 16 |
3 files changed, 38 insertions, 38 deletions
diff --git a/maintenance/storage/checkStorage.php b/maintenance/storage/checkStorage.php index 3741959d78dd..5b99d7787752 100644 --- a/maintenance/storage/checkStorage.php +++ b/maintenance/storage/checkStorage.php @@ -57,7 +57,7 @@ class CheckStorage { 'fixable' => 'Errors which would already be fixed if --fix was specified', ]; - function check( $fix = false, $xml = '' ) { + public function check( $fix = false, $xml = '' ) { global $wgMultiContentRevisionSchemaMigrationStage; $dbr = wfGetDB( DB_REPLICA ); @@ -398,7 +398,7 @@ class CheckStorage { } } - function addError( $type, $msg, $ids ) { + private function addError( $type, $msg, $ids ) { if ( is_array( $ids ) && count( $ids ) == 1 ) { $ids = reset( $ids ); } @@ -421,7 +421,7 @@ class CheckStorage { $this->errors[$type] = $this->errors[$type] + array_flip( $revIds ); } - function checkExternalConcatBlobs( $externalConcatBlobs ) { + private function checkExternalConcatBlobs( $externalConcatBlobs ) { if ( !count( $externalConcatBlobs ) ) { return; } @@ -463,7 +463,7 @@ class CheckStorage { } } - function restoreText( $revIds, $xml ) { + private function restoreText( $revIds, $xml ) { global $wgDBname; $tmpDir = wfTempDir(); @@ -524,7 +524,7 @@ class CheckStorage { $importer->doImport(); } - function importRevision( &$revision, &$importer ) { + private function importRevision( &$revision, &$importer ) { $id = $revision->getID(); $content = $revision->getContent( RevisionRecord::RAW ); $id = $id ?: ''; diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php index 22c9c2f50d32..8285851df7aa 100644 --- a/maintenance/storage/recompressTracked.php +++ b/maintenance/storage/recompressTracked.php @@ -94,11 +94,11 @@ class RecompressTracked { 'critical-log' => 'criticalLog', ]; - static function getOptionsWithArgs() { + public static function getOptionsWithArgs() { return self::$optionsWithArgs; } - static function newFromCommandLine( $args, $options ) { + public static function newFromCommandLine( $args, $options ) { $jobOptions = [ 'destClusters' => $args ]; foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) { if ( isset( $options[$cmdOption] ) ) { @@ -129,28 +129,28 @@ class RecompressTracked { ->newSqlBlobStore(); } - function debug( $msg ) { + public function debug( $msg ) { wfDebug( "$msg\n" ); if ( $this->debugLog ) { $this->logToFile( $msg, $this->debugLog ); } } - function info( $msg ) { + public function info( $msg ) { echo "$msg\n"; if ( $this->infoLog ) { $this->logToFile( $msg, $this->infoLog ); } } - function critical( $msg ) { + public function critical( $msg ) { echo "$msg\n"; if ( $this->criticalLog ) { $this->logToFile( $msg, $this->criticalLog ); } } - function logToFile( $msg, $file ) { + private function logToFile( $msg, $file ) { $header = '[' . date( 'd\TH:i:s' ) . '] ' . wfHostname() . ' ' . posix_getpid(); if ( $this->childId !== false ) { $header .= "({$this->childId})"; @@ -164,7 +164,7 @@ class RecompressTracked { * This allows us to use the replica DB for things that were committed in a * previous part of this batch process. */ - function syncDBs() { + private function syncDBs() { $dbw = wfGetDB( DB_MASTER ); $dbr = wfGetDB( DB_REPLICA ); $pos = $dbw->getMasterPos(); @@ -201,7 +201,7 @@ class RecompressTracked { * Make sure the tracking table exists and isn't empty * @return bool */ - function checkTrackingTable() { + private function checkTrackingTable() { $dbr = wfGetDB( DB_REPLICA ); if ( !$dbr->tableExists( 'blob_tracking' ) ) { $this->critical( "Error: blob_tracking table does not exist" ); @@ -224,7 +224,7 @@ class RecompressTracked { * This necessary because text recompression is slow: loading, compressing and * writing are all slow. */ - function startChildProcs() { + private function startChildProcs() { $wiki = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() ); $cmd = 'php ' . Shell::escape( __FILE__ ); @@ -265,7 +265,7 @@ class RecompressTracked { /** * Gracefully terminate the child processes */ - function killChildProcs() { + private function killChildProcs() { $this->info( "Waiting for child processes to finish..." ); for ( $i = 0; $i < $this->numProcs; $i++ ) { $this->dispatchToChild( $i, 'quit' ); @@ -284,7 +284,7 @@ class RecompressTracked { * This may block until a child process finishes its work and becomes available. * @param array|string ...$args */ - function dispatch( ...$args ) { + private function dispatch( ...$args ) { $pipes = $this->childPipes; $x = []; $y = []; @@ -311,7 +311,7 @@ class RecompressTracked { * @param int $childId * @param array|string $args */ - function dispatchToChild( $childId, $args ) { + private function dispatchToChild( $childId, $args ) { $args = (array)$args; $cmd = implode( ' ', $args ); fwrite( $this->childPipes[$childId], "$cmd\n" ); @@ -320,7 +320,7 @@ class RecompressTracked { /** * Move all tracked pages to the new clusters */ - function doAllPages() { + private function doAllPages() { $dbr = wfGetDB( DB_REPLICA ); $i = 0; $startId = 0; @@ -377,7 +377,7 @@ class RecompressTracked { * @param int $current * @param int $end */ - function report( $label, $current, $end ) { + private function report( $label, $current, $end ) { $this->numBatches++; if ( $current == $end || $this->numBatches >= $this->reportingInterval ) { $this->numBatches = 0; @@ -389,7 +389,7 @@ class RecompressTracked { /** * Move all orphan text to the new clusters */ - function doAllOrphans() { + private function doAllOrphans() { $dbr = wfGetDB( DB_REPLICA ); $startId = 0; $i = 0; @@ -489,7 +489,7 @@ class RecompressTracked { * * @param int $pageId */ - function doPage( $pageId ) { + private function doPage( $pageId ) { $title = Title::newFromID( $pageId ); if ( $title ) { $titleText = $title->getPrefixedText(); @@ -571,7 +571,7 @@ class RecompressTracked { * @param int $textId * @param string $url */ - function moveTextRow( $textId, $url ) { + public function moveTextRow( $textId, $url ) { if ( $this->copyOnly ) { $this->critical( "Internal error: can't call moveTextRow() in --copy-only mode" ); exit( 1 ); @@ -606,7 +606,7 @@ class RecompressTracked { * * @param array $conds */ - function finishIncompleteMoves( $conds ) { + private function finishIncompleteMoves( $conds ) { $dbr = wfGetDB( DB_REPLICA ); $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); @@ -643,7 +643,7 @@ class RecompressTracked { * Returns the name of the next target cluster * @return string */ - function getTargetCluster() { + public function getTargetCluster() { $cluster = next( $this->destClusters ); if ( $cluster === false ) { $cluster = reset( $this->destClusters ); @@ -657,7 +657,7 @@ class RecompressTracked { * @param string $cluster * @return IMaintainableDatabase */ - function getExtDB( $cluster ) { + private function getExtDB( $cluster ) { $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $lb = $lbFactory->getExternalLB( $cluster ); @@ -669,7 +669,7 @@ class RecompressTracked { * * @param array $textIds */ - function doOrphanList( $textIds ) { + private function doOrphanList( $textIds ) { // Finish incomplete moves if ( !$this->copyOnly ) { $this->finishIncompleteMoves( [ 'bt_text_id' => $textIds ] ); @@ -742,7 +742,7 @@ class CgzCopyTransaction { * @param int $textId * @return bool */ - function addItem( $text, $textId ) { + public function addItem( $text, $textId ) { if ( !$this->cgz ) { $class = $this->blobClass; $this->cgz = new $class; @@ -754,14 +754,14 @@ class CgzCopyTransaction { return $this->cgz->isHappy(); } - function getSize() { + public function getSize() { return count( $this->texts ); } /** * Recompress text after some aberrant modification */ - function recompress() { + public function recompress() { $class = $this->blobClass; $this->cgz = new $class; $this->referrers = []; @@ -776,7 +776,7 @@ class CgzCopyTransaction { * Does nothing if no text items have been added. * May skip the move if --copy-only is set. */ - function commit() { + public function commit() { $originalCount = count( $this->texts ); if ( !$originalCount ) { return; diff --git a/maintenance/storage/trackBlobs.php b/maintenance/storage/trackBlobs.php index 623368c3fc73..4e7b93898006 100644 --- a/maintenance/storage/trackBlobs.php +++ b/maintenance/storage/trackBlobs.php @@ -59,7 +59,7 @@ class TrackBlobs { } } - function run() { + public function run() { $this->checkIntegrity(); $this->initTrackingTable(); $this->trackRevisions(); @@ -69,7 +69,7 @@ class TrackBlobs { } } - function checkIntegrity() { + private function checkIntegrity() { echo "Doing integrity check...\n"; $dbr = wfGetDB( DB_REPLICA ); @@ -91,7 +91,7 @@ class TrackBlobs { echo "Integrity check OK\n"; } - function initTrackingTable() { + private function initTrackingTable() { $dbw = wfGetDB( DB_MASTER ); if ( $dbw->tableExists( 'blob_tracking' ) ) { $dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_tracking' ) ); @@ -100,7 +100,7 @@ class TrackBlobs { $dbw->sourceFile( __DIR__ . '/blob_tracking.sql' ); } - function getTextClause() { + private function getTextClause() { if ( !$this->textClause ) { $dbr = wfGetDB( DB_REPLICA ); $this->textClause = ''; @@ -115,7 +115,7 @@ class TrackBlobs { return $this->textClause; } - function interpretPointer( $text ) { + private function interpretPointer( $text ) { if ( !preg_match( '!^DB://(\w+)/(\d+)(?:/([0-9a-fA-F]+)|)$!', $text, $m ) ) { return false; } @@ -130,7 +130,7 @@ class TrackBlobs { /** * Scan the revision table for rows stored in the specified clusters */ - function trackRevisions() { + private function trackRevisions() { global $wgMultiContentRevisionSchemaMigrationStage; $dbw = wfGetDB( DB_MASTER ); @@ -225,7 +225,7 @@ class TrackBlobs { * Orphan text here does not imply DB corruption -- deleted text tracked by the * archive table counts as orphan for our purposes. */ - function trackOrphanText() { + private function trackOrphanText() { # Wait until the blob_tracking table is available in the replica DB $dbw = wfGetDB( DB_MASTER ); $dbr = wfGetDB( DB_REPLICA ); @@ -311,7 +311,7 @@ class TrackBlobs { * Orphan blobs are indicative of DB corruption. They are inaccessible and * should probably be deleted. */ - function findOrphanBlobs() { + private function findOrphanBlobs() { if ( !extension_loaded( 'gmp' ) ) { echo "Can't find orphan blobs, need bitfield support provided by GMP.\n"; |