X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2Ffile%2FArchivedFile.php;h=1d45428310131baab9775582d6389980f134dede;hb=a756c3b753e34a479da69a88a3176fd2d3e7cfa2;hp=5b0d8e2baa76474f684533ce10d2018f57c1be44;hpb=27eafef2947051a2d5d2ee024e0c23f518b786be;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php index 5b0d8e2baa..1d45428310 100644 --- a/includes/filerepo/file/ArchivedFile.php +++ b/includes/filerepo/file/ArchivedFile.php @@ -100,8 +100,9 @@ class ArchivedFile { * @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; @@ -136,7 +137,11 @@ class ArchivedFile { $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." ); } } @@ -162,6 +167,9 @@ class ArchivedFile { 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" );