@@ 172-186 (lines=15) @@ | ||
169 | * @param string|bool $timestamp MW_timestamp (optional) |
|
170 | * @return bool|LocalFile |
|
171 | */ |
|
172 | static function newFromKey( $sha1, $repo, $timestamp = false ) { |
|
173 | $dbr = $repo->getSlaveDB(); |
|
174 | ||
175 | $conds = array( 'img_sha1' => $sha1 ); |
|
176 | if ( $timestamp ) { |
|
177 | $conds['img_timestamp'] = $dbr->timestamp( $timestamp ); |
|
178 | } |
|
179 | ||
180 | $row = $dbr->selectRow( 'image', self::selectFields(), $conds, __METHOD__ ); |
|
181 | if ( $row ) { |
|
182 | return self::newFromRow( $row, $repo ); |
|
183 | } else { |
|
184 | return false; |
|
185 | } |
|
186 | } |
|
187 | ||
188 | /** |
|
189 | * Fields in the image table |
@@ 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 = array( '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 |