summaryrefslogtreecommitdiff
path: root/includes/filerepo/file/ArchivedFile.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/filerepo/file/ArchivedFile.php')
-rw-r--r--includes/filerepo/file/ArchivedFile.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php
index 5b0d8e2b..1d454283 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" );