From 214e9d037803aa662f7973fc298d81cbd2c4de6a Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 1 Nov 2021 15:30:17 +1100 Subject: [PATCH] Remove FileOp batch ID Left over from FileJournal. Change-Id: Ic214d97e900995c067ba2d45935d0fb66e95d2df --- includes/libs/filebackend/FileOpBatch.php | 15 --------------- includes/libs/filebackend/fileop/FileOp.php | 13 +------------ 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/includes/libs/filebackend/FileOpBatch.php b/includes/libs/filebackend/FileOpBatch.php index 6764e8c61c2..b04aaa2c0dd 100644 --- a/includes/libs/filebackend/FileOpBatch.php +++ b/includes/libs/filebackend/FileOpBatch.php @@ -21,8 +21,6 @@ * @ingroup FileBackend */ -use Wikimedia\Timestamp\ConvertibleTimestamp; - /** * Helper class for representing batch file operations. * Do not use this class from places outside FileBackend. @@ -63,7 +61,6 @@ class FileOpBatch { return $status; } - $batchId = self::getTimestampedUUID(); $ignoreErrors = !empty( $opts['force'] ); $maxConcurrency = $opts['concurrency'] ?? 1; @@ -75,7 +72,6 @@ class FileOpBatch { // Do pre-checks for each operation; abort on failure... foreach ( $performOps as $index => $fileOp ) { $backendName = $fileOp->getBackend()->getName(); - $fileOp->setBatchId( $batchId ); // transaction ID // Decide if this op can be done concurrently within this sub-batch // or if a new concurrent sub-batch must be started after this one... if ( $fileOp->dependsOn( $curBatchDeps ) @@ -184,15 +180,4 @@ class FileOpBatch { } } } - - private static function getTimestampedUUID() { - // TODO: This is a leftover from FileJournal that is probably no longer needed. - $s = ''; - for ( $i = 0; $i < 5; $i++ ) { - $s .= mt_rand( 0, 2147483647 ); - } - $s = Wikimedia\base_convert( sha1( $s ), 16, 36, 31 ); - $timestamp = ConvertibleTimestamp::convert( TS_MW, time() ); - return substr( Wikimedia\base_convert( $timestamp, 10, 36, 9 ) . $s, 0, 31 ); - } } diff --git a/includes/libs/filebackend/fileop/FileOp.php b/includes/libs/filebackend/fileop/FileOp.php index fe83f95fa33..0281ecbce01 100644 --- a/includes/libs/filebackend/fileop/FileOp.php +++ b/includes/libs/filebackend/fileop/FileOp.php @@ -48,8 +48,6 @@ abstract class FileOp { protected $failed = false; /** @var bool */ protected $async = false; - /** @var string */ - protected $batchId; /** @var bool */ protected $cancelled = false; @@ -123,15 +121,6 @@ abstract class FileOp { return $path; } - /** - * Set the batch UUID this operation belongs to - * - * @param string $batchId - */ - final public function setBatchId( $batchId ) { - $this->batchId = $batchId; - } - /** * Get the value of the parameter with the given name * @@ -517,7 +506,7 @@ abstract class FileOp { $params['failedAction'] = $action; try { $this->logger->error( static::class . - " failed (batch #{$this->batchId}): " . FormatJson::encode( $params ) ); + " failed: " . FormatJson::encode( $params ) ); } catch ( Exception $e ) { // bad config? debug log error? }