49 if ( !$this->getDB(
DB_PRIMARY )->tableExists(
'blob_orphans', __METHOD__ ) ) {
50 $this->fatalError(
"blob_orphans doesn't seem to exist, need to run trackBlobs.php first" );
52 $dbr = $this->getReplicaDB();
53 $res = $dbr->newSelectQueryBuilder()
55 ->from(
'blob_orphans' )
56 ->caller( __METHOD__ )->fetchResultSet();
63 foreach ( $res as $row ) {
65 $blobRow = $extDB->newSelectQueryBuilder()
68 ->where( [
'blob_id' => $row->bo_blob_id ] )
69 ->caller( __METHOD__ )->fetchRow();
72 $size = strlen( $blobRow->blob_text );
74 $hashes[sha1( $blobRow->blob_text )] =
true;
75 $maxSize = max( $size, $maxSize );
79 $this->output(
"Number of orphans: $num\n" );
81 $this->output(
"Average size: " . round( $totalSize / $num, 0 ) .
" bytes\n" .
82 "Max size: $maxSize\n" .
83 "Number of unique texts: " . count( $hashes ) .
"\n" );