+ return $db->getLBInfo( 'blobs table' ) ?? 'blobs'; // b/c
+ }
+
+ /**
+ * Create the appropriate blobs table on this cluster
+ *
+ * @see getTable()
+ * @since 1.34
+ * @param string $cluster
+ */
+ public function initializeTable( $cluster ) {
+ global $IP;
+
+ static $supportedTypes = [ 'mysql', 'sqlite' ];
+
+ $dbw = $this->getMaster( $cluster );
+ if ( !in_array( $dbw->getType(), $supportedTypes, true ) ) {
+ throw new DBUnexpectedError( $dbw, "RDBMS type '{$dbw->getType()}' not supported." );
+ }
+
+ $sqlFilePath = "$IP/maintenance/storage/blobs.sql";
+ $sql = file_get_contents( $sqlFilePath );
+ if ( $sql === false ) {
+ throw new RuntimeException( "Failed to read '$sqlFilePath'." );
+ }
+
+ $rawTable = $this->getTable( $dbw, $cluster ); // e.g. "blobs_cluster23"
+ $encTable = $dbw->tableName( $rawTable );
+ $dbw->query(
+ str_replace(
+ [ '/*$wgDBprefix*/blobs', '/*_*/blobs' ],
+ [ $encTable, $encTable ],
+ $sql
+ ),
+ __METHOD__,
+ $dbw::QUERY_IGNORE_DBO_TRX
+ );