summaryrefslogtreecommitdiff
path: root/includes/filerepo/FileRepo.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
commit6dc1997577fab2c366781fd7048144935afa0012 (patch)
tree8918d28c7ab4342f0738985e37af1dfc42d0e93a /includes/filerepo/FileRepo.php
parent150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff)
parentfa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff)
Merge commit 'fa89acd'
# Conflicts: # .gitignore # extensions/ArchInterWiki.sql
Diffstat (limited to 'includes/filerepo/FileRepo.php')
-rw-r--r--includes/filerepo/FileRepo.php43
1 files changed, 27 insertions, 16 deletions
diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index cef1176d..7370c5cd 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -49,6 +49,9 @@ class FileRepo {
/** @var int */
public $descriptionCacheExpiry;
+ /** @var bool */
+ protected $hasSha1Storage = false;
+
/** @var FileBackend */
protected $backend;
@@ -63,7 +66,7 @@ class FileRepo {
protected $transformVia404;
/** @var string URL of image description pages, e.g.
- * http://en.wikipedia.org/wiki/File:
+ * https://en.wikipedia.org/wiki/File:
*/
protected $descBaseUrl;
@@ -76,7 +79,7 @@ class FileRepo {
* to $wgScriptExtension, e.g. .php5 defaults to .php */
protected $scriptExtension;
- /** @var string Equivalent to $wgArticlePath, e.g. http://en.wikipedia.org/wiki/$1 */
+ /** @var string Equivalent to $wgArticlePath, e.g. https://en.wikipedia.org/wiki/$1 */
protected $articleUrl;
/** @var bool Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE],
@@ -433,16 +436,16 @@ class FileRepo {
$img = $this->newFile( $title, $time );
if ( $img ) {
$img->load( $flags );
- }
- if ( $img && $img->exists() ) {
- if ( !$img->isDeleted( File::DELETED_FILE ) ) {
- return $img; // always OK
- } elseif ( !empty( $options['private'] ) &&
- $img->userCan( File::DELETED_FILE,
- $options['private'] instanceof User ? $options['private'] : null
- )
- ) {
- return $img;
+ if ( $img->exists() ) {
+ if ( !$img->isDeleted( File::DELETED_FILE ) ) {
+ return $img; // always OK
+ } elseif ( !empty( $options['private'] ) &&
+ $img->userCan( File::DELETED_FILE,
+ $options['private'] instanceof User ? $options['private'] : null
+ )
+ ) {
+ return $img;
+ }
}
}
}
@@ -909,9 +912,9 @@ class FileRepo {
$status->merge( $backend->doOperations( $operations, $opts ) );
// Cleanup for disk source files...
foreach ( $sourceFSFilesToDelete as $file ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
unlink( $file ); // FS cleanup
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
return $status;
@@ -1297,9 +1300,9 @@ class FileRepo {
}
// Cleanup for disk source files...
foreach ( $sourceFSFilesToDelete as $file ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
unlink( $file ); // FS cleanup
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
return $status;
@@ -1885,6 +1888,14 @@ class FileRepo {
return $ret;
}
+
+ /**
+ * Returns whether or not storage is SHA-1 based
+ * @return boolean
+ */
+ public function hasSha1Storage() {
+ return $this->hasSha1Storage;
+ }
}
/**