* @return bool|OldLocalFile
*/
static function newFromKey( $sha1, $repo, $timestamp = false ) {
- $dbr = $repo->getSlaveDB();
+ $dbr = $repo->getReplicaDB();
$conds = [ 'oi_sha1' => $sha1 ];
if ( $timestamp ) {
/**
* Fields in the oldimage table
+ * @todo Deprecate this in favor of a method that returns tables and joins
+ * as well, and use CommentStore::getJoin().
* @return array
*/
static function selectFields() {
'oi_media_type',
'oi_major_mime',
'oi_minor_mime',
- 'oi_description',
'oi_user',
'oi_user_text',
'oi_timestamp',
'oi_deleted',
'oi_sha1',
- ];
+ ] + CommentStore::newKey( 'oi_description' )->getFields();
}
/**
$dbr = ( $flags & self::READ_LATEST )
? $this->repo->getMasterDB()
- : $this->repo->getSlaveDB();
+ : $this->repo->getReplicaDB();
$conds = [ 'oi_name' => $this->getName() ];
if ( is_null( $this->requestedTime ) ) {
} else {
$this->fileExists = false;
}
-
}
/**
* Load lazy file metadata from the DB
*/
protected function loadExtraFromDB() {
-
$this->extraDataLoaded = true;
- $dbr = $this->repo->getSlaveDB();
+ $dbr = $this->repo->getReplicaDB();
$conds = [ 'oi_name' => $this->getName() ];
if ( is_null( $this->requestedTime ) ) {
$conds['oi_archive_name'] = $this->archive_name;
} else {
throw new MWException( "Could not find data for image '{$this->archive_name}'." );
}
-
}
/**
return false;
}
+ $commentFields = CommentStore::newKey( 'oi_description' )->insert( $dbw, $comment );
$dbw->insert( 'oldimage',
[
'oi_name' => $this->getName(),
'oi_height' => intval( $props['height'] ),
'oi_bits' => $props['bits'],
'oi_timestamp' => $dbw->timestamp( $timestamp ),
- 'oi_description' => $comment,
'oi_user' => $user->getId(),
'oi_user_text' => $user->getName(),
'oi_metadata' => $props['metadata'],
'oi_major_mime' => $props['major_mime'],
'oi_minor_mime' => $props['minor_mime'],
'oi_sha1' => $props['sha1'],
- ], __METHOD__
+ ] + $commentFields, __METHOD__
);
return true;