24 require_once __DIR__ .
'/../Maintenance.php';
34 parent::__construct();
36 "Show some statistics on the blob_orphans table, created with trackBlobs.php" );
41 $lb = $lbFactory->getExternalLB( $cluster );
43 return $lb->getMaintenanceConnectionRef( $db );
48 if ( !$dbr->tableExists(
'blob_orphans', __METHOD__ ) ) {
49 $this->
fatalError(
"blob_orphans doesn't seem to exist, need to run trackBlobs.php first" );
51 $res = $dbr->newSelectQueryBuilder()
53 ->from(
'blob_orphans' )
54 ->caller( __METHOD__ )->fetchResultSet();
61 foreach ( $res as $row ) {
63 $blobRow = $extDB->newSelectQueryBuilder()
66 ->where( [
'blob_id' => $row->bo_blob_id ] )
67 ->caller( __METHOD__ )->fetchRow();
70 $size = strlen( $blobRow->blob_text );
72 $hashes[sha1( $blobRow->blob_text )] =
true;
73 $maxSize = max( $size, $maxSize );
77 $this->
output(
"Number of orphans: $num\n" );
79 $this->
output(
"Average size: " . round( $totalSize / $num, 0 ) .
" bytes\n" .
80 "Max size: $maxSize\n" .
81 "Number of unique texts: " . count( $hashes ) .
"\n" );
87 require_once RUN_MAINTENANCE_IF_MAIN;
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
getDB( $db, $groups=[], $dbDomain=false)
Returns a database to be used by current maintenance script.
output( $out, $channel=null)
Throw some output to the user.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
Maintenance script that shows some statistics on the blob_orphans table, created with trackBlobs....
getExternalDB( $db, $cluster)
__construct()
Default constructor.
execute()
Do the actual work.