dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "mw.htmlform: Fix hiding of the textbox for 'selectorother' fields on page...
[lhc/web/wiklou.git]
/
includes
/
filerepo
/
file
/
LocalFile.php
diff --git
a/includes/filerepo/file/LocalFile.php
b/includes/filerepo/file/LocalFile.php
index
8d715e8
..
33177d3
100644
(file)
--- a/
includes/filerepo/file/LocalFile.php
+++ b/
includes/filerepo/file/LocalFile.php
@@
-215,7
+215,6
@@
class LocalFile extends File {
}
/**
}
/**
- * Constructor.
* Do not call this except from inside a repo class.
* @param Title $title
* @param FileRepo $repo
* Do not call this except from inside a repo class.
* @param Title $title
* @param FileRepo $repo
@@
-593,7
+592,7
@@
class LocalFile extends File {
if ( $upgrade ) {
$this->upgrading = true;
// Defer updates unless in auto-commit CLI mode
if ( $upgrade ) {
$this->upgrading = true;
// Defer updates unless in auto-commit CLI mode
- DeferredUpdates::addCallableUpdate( function() {
+ DeferredUpdates::addCallableUpdate( function
() {
$this->upgrading = false; // avoid duplicate updates
try {
$this->upgradeRow();
$this->upgrading = false; // avoid duplicate updates
try {
$this->upgradeRow();
@@
-716,6
+715,11
@@
class LocalFile extends File {
* @return int
*/
public function getWidth( $page = 1 ) {
* @return int
*/
public function getWidth( $page = 1 ) {
+ $page = (int)$page;
+ if ( $page < 1 ) {
+ $page = 1;
+ }
+
$this->load();
if ( $this->isMultipage() ) {
$this->load();
if ( $this->isMultipage() ) {
@@
-743,6
+747,11
@@
class LocalFile extends File {
* @return int
*/
public function getHeight( $page = 1 ) {
* @return int
*/
public function getHeight( $page = 1 ) {
+ $page = (int)$page;
+ if ( $page < 1 ) {
+ $page = 1;
+ }
+
$this->load();
if ( $this->isMultipage() ) {
$this->load();
if ( $this->isMultipage() ) {
@@
-1022,9
+1031,15
@@
class LocalFile extends File {
$purgeList = [];
foreach ( $files as $file ) {
$purgeList = [];
foreach ( $files as $file ) {
- # Check that the base file name is part of the thumb name
+ if ( $this->repo->supportsSha1URLs() ) {
+ $reference = $this->getSha1();
+ } else {
+ $reference = $this->getName();
+ }
+
+ # Check that the reference (filename or sha1) is part of the thumb name
# This is a basic sanity check to avoid erasing unrelated directories
# This is a basic sanity check to avoid erasing unrelated directories
- if ( strpos( $file, $
this->getName()
) !== false
+ if ( strpos( $file, $
reference
) !== false
|| strpos( $file, "-thumbnail" ) !== false // "short" thumb name
) {
$purgeList[] = "{$dir}/{$file}";
|| strpos( $file, "-thumbnail" ) !== false // "short" thumb name
) {
$purgeList[] = "{$dir}/{$file}";