->getComment( 'description', (object)$decoded )->text;
$decoded['user'] = User::newFromAnyId(
- isset( $decoded['user'] ) ? $decoded['user'] : null,
- isset( $decoded['user_text'] ) ? $decoded['user_text'] : null,
- isset( $decoded['actor'] ) ? $decoded['actor'] : null
+ $decoded['user'] ?? null,
+ $decoded['user_text'] ?? null,
+ $decoded['actor'] ?? null
);
unset( $decoded['user_text'], $decoded['actor'] );
if ( isset( $info['user'] ) || isset( $info['user_text'] ) || isset( $info['actor'] ) ) {
$this->user = User::newFromAnyId(
- isset( $info['user'] ) ? $info['user'] : null,
- isset( $info['user_text'] ) ? $info['user_text'] : null,
- isset( $info['actor'] ) ? $info['actor'] : null
+ $info['user'] ?? null,
+ $info['user_text'] ?? null,
+ $info['actor'] ?? null
);
}
// If extra data (metadata) was not loaded then it must have been large
return $this->extraDataLoaded
- && strlen( serialize( $this->metadata ) ) <= self::CACHE_FIELD_MAX_LEN;
+ && strlen( serialize( $this->metadata ) ) <= self::CACHE_FIELD_MAX_LEN;
}
/**
* @since 1.28
*/
public function acquireFileLock() {
- return $this->getRepo()->getBackend()->lockFiles(
+ return Status::wrap( $this->getRepo()->getBackend()->lockFiles(
[ $this->getPath() ], LockManager::LOCK_EX, 10
- );
+ ) );
}
/**
* @since 1.28
*/
public function releaseFileLock() {
- return $this->getRepo()->getBackend()->unlockFiles(
+ return Status::wrap( $this->getRepo()->getBackend()->unlockFiles(
[ $this->getPath() ], LockManager::LOCK_EX
- );
+ ) );
}
/**
$status = $repo->newGood();
$dbw = $this->db;
- $hasCurrent = $dbw->selectField(
+ $hasCurrent = $dbw->lockForUpdate(
'image',
- '1',
[ 'img_name' => $this->oldName ],
- __METHOD__,
- [ 'FOR UPDATE' ]
+ __METHOD__
);
- $oldRowCount = $dbw->selectRowCount(
+ $oldRowCount = $dbw->lockForUpdate(
'oldimage',
- '*',
[ 'oi_name' => $this->oldName ],
- __METHOD__,
- [ 'FOR UPDATE' ]
+ __METHOD__
);
if ( $hasCurrent ) {