** 'extend' method added to QuickTemplate to append additional values to any field of data array
* (T86974) Several Title methods now load from the database when necessary
(instead of returning incorrect results) even when the page ID is known.
+* (T74070) Duplicate search for archived files on file upload now omits the extension.
+ This requires the fa_sha1 field being populated.
=== Action API changes in 1.25 ===
* (T67403) XML tag highlighting is now only performed for formats
* @param Title $title
* @param int $id
* @param string $key
+ * @param string $sha1
*/
- function __construct( $title, $id = 0, $key = '' ) {
+ function __construct( $title, $id = 0, $key = '', $sha1 = '' ) {
$this->id = -1;
$this->title = false;
$this->name = false;
$this->key = $key;
}
- if ( !$id && !$key && !( $title instanceof Title ) ) {
+ if ( $sha1 ) {
+ $this->sha1 = $sha1;
+ }
+
+ if ( !$id && !$key && !( $title instanceof Title ) && !$sha1 ) {
throw new MWException( "No specifications provided to ArchivedFile constructor." );
}
}
if ( $this->title ) {
$conds['fa_name'] = $this->title->getDBkey();
}
+ if ( $this->sha1 ) {
+ $conds['fa_sha1'] = $this->sha1;
+ }
if ( !count( $conds ) ) {
throw new MWException( "No specific information for retrieving archived file" );
}
// Check dupes against archives
- $archivedImage = new ArchivedFile( null, 0, "{$hash}.{$this->mFinalExtension}" );
- if ( $archivedImage->getID() > 0 ) {
- if ( $archivedImage->userCan( File::DELETED_FILE ) ) {
- $warnings['duplicate-archive'] = $archivedImage->getName();
+ $archivedFile = new ArchivedFile( null, 0, '', $hash );
+ if ( $archivedFile->getID() > 0 ) {
+ if ( $archivedFile->userCan( File::DELETED_FILE ) ) {
+ $warnings['duplicate-archive'] = $archivedFile->getName();
} else {
$warnings['duplicate-archive'] = '';
}