Index: trunk/phase3/includes/filerepo/LocalRepo.php |
— | — | @@ -52,8 +52,8 @@ |
53 | 53 | array( 'fa_storage_group' => 'deleted', 'fa_storage_key' => $key ), |
54 | 54 | __METHOD__, array( 'FOR UPDATE' ) ); |
55 | 55 | if( !$inuse ) { |
56 | | - $sha1 = substr( $key, 0, strcspn( $key, '.' ) ); |
57 | | - $ext = substr( $key, strcspn($key,'.') + 1 ); |
| 56 | + $sha1 = self::getHashFromKey( $key ); |
| 57 | + $ext = substr( $key, strcspn( $key, '.' ) + 1 ); |
58 | 58 | $ext = File::normalizeExtension($ext); |
59 | 59 | $inuse = $dbw->selectField( 'oldimage', '1', |
60 | 60 | array( 'oi_sha1' => $sha1, |
— | — | @@ -75,6 +75,17 @@ |
76 | 76 | } |
77 | 77 | return $status; |
78 | 78 | } |
| 79 | + |
| 80 | + /** |
| 81 | + * Gets the SHA1 hash from a storage key |
| 82 | + * |
| 83 | + * @static |
| 84 | + * @param string $key |
| 85 | + * @return string |
| 86 | + */ |
| 87 | + public static function getHashFromKey( $key ) { |
| 88 | + return strtok( $key, '.' ); |
| 89 | + } |
79 | 90 | |
80 | 91 | /** |
81 | 92 | * Checks if there is a redirect named as $title |
Index: trunk/phase3/includes/api/ApiQueryFilearchive.php |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | self::addTitleInfo( $file, Title::makeTitle( NS_FILE, $row->fa_name ) ); |
137 | 137 | |
138 | 138 | if ( $fld_sha1 ) { |
139 | | - $file['sha1'] = wfBaseConvert( $row->fa_storage_key, 36, 16, 40 ); |
| 139 | + $file['sha1'] = LocalRepo::getHashFromKey( $row->fa_storage_key ); |
140 | 140 | } |
141 | 141 | if ( $fld_timestamp ) { |
142 | 142 | $file['timestamp'] = wfTimestamp( TS_ISO_8601, $row->fa_timestamp ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -217,6 +217,7 @@ |
218 | 218 | * (bug 27018) Added action=filerevert to revert files to an old version |
219 | 219 | * (bug 27897) list=allusers and list=users list hidden users |
220 | 220 | * (bug 27717) API's exturlusage module does not respect $wgMiserMode |
| 221 | +* (bug 27588) list=filearchive&faprop=sha1 returns empty attribute |
221 | 222 | |
222 | 223 | === Languages updated in 1.18 === |
223 | 224 | |