| @@ 88-102 (lines=15) @@ | ||
| 85 | * |
|
| 86 | * @return bool|OldLocalFile |
|
| 87 | */ |
|
| 88 | static function newFromKey( $sha1, $repo, $timestamp = false ) { |
|
| 89 | $dbr = $repo->getSlaveDB(); |
|
| 90 | ||
| 91 | $conds = [ 'oi_sha1' => $sha1 ]; |
|
| 92 | if ( $timestamp ) { |
|
| 93 | $conds['oi_timestamp'] = $dbr->timestamp( $timestamp ); |
|
| 94 | } |
|
| 95 | ||
| 96 | $row = $dbr->selectRow( 'oldimage', self::selectFields(), $conds, __METHOD__ ); |
|
| 97 | if ( $row ) { |
|
| 98 | return self::newFromRow( $row, $repo ); |
|
| 99 | } else { |
|
| 100 | return false; |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||
| 104 | /** |
|
| 105 | * Fields in the oldimage table |
|
| @@ 176-190 (lines=15) @@ | ||
| 173 | * @param string|bool $timestamp MW_timestamp (optional) |
|
| 174 | * @return bool|LocalFile |
|
| 175 | */ |
|
| 176 | static function newFromKey( $sha1, $repo, $timestamp = false ) { |
|
| 177 | $dbr = $repo->getSlaveDB(); |
|
| 178 | ||
| 179 | $conds = [ 'img_sha1' => $sha1 ]; |
|
| 180 | if ( $timestamp ) { |
|
| 181 | $conds['img_timestamp'] = $dbr->timestamp( $timestamp ); |
|
| 182 | } |
|
| 183 | ||
| 184 | $row = $dbr->selectRow( 'image', self::selectFields(), $conds, __METHOD__ ); |
|
| 185 | if ( $row ) { |
|
| 186 | return self::newFromRow( $row, $repo ); |
|
| 187 | } else { |
|
| 188 | return false; |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| 192 | /** |
|
| 193 | * Fields in the image table |
|