27require_once __DIR__ .
'/../Maintenance.php';
38 parent::__construct();
40 "Show some statistics on the blob_orphans table, created with trackBlobs.php" );
45 $lb = $lbFactory->getExternalLB( $cluster );
47 return $lb->getMaintenanceConnectionRef( $db );
51 if ( !$this->
getDB(
DB_PRIMARY )->tableExists(
'blob_orphans', __METHOD__ ) ) {
52 $this->
fatalError(
"blob_orphans doesn't seem to exist, need to run trackBlobs.php first" );
55 $res = $dbr->newSelectQueryBuilder()
57 ->from(
'blob_orphans' )
58 ->caller( __METHOD__ )->fetchResultSet();
65 foreach ( $res as $row ) {
67 $blobRow = $extDB->newSelectQueryBuilder()
70 ->where( [
'blob_id' => $row->bo_blob_id ] )
71 ->caller( __METHOD__ )->fetchRow();
74 $size = strlen( $blobRow->blob_text );
76 $hashes[sha1( $blobRow->blob_text )] =
true;
77 $maxSize = max( $size, $maxSize );
81 $this->
output(
"Number of orphans: $num\n" );
83 $this->
output(
"Average size: " . round( $totalSize / $num, 0 ) .
" bytes\n" .
84 "Max size: $maxSize\n" .
85 "Number of unique texts: " . count( $hashes ) .
"\n" );
92require_once RUN_MAINTENANCE_IF_MAIN;
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
getDB( $db, $groups=[], $dbDomain=false)
Returns a database to be used by current maintenance script.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.
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.