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();
* @return int
*/
public function getWidth( $page = 1 ) {
+ $page = (int)$page;
+ if ( $page < 1 ) {
+ $page = 1;
+ }
+
$this->load();
if ( $this->isMultipage() ) {
* @return int
*/
public function getHeight( $page = 1 ) {
+ $page = (int)$page;
+ if ( $page < 1 ) {
+ $page = 1;
+ }
+
$this->load();
if ( $this->isMultipage() ) {
$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
- if ( strpos( $file, $this->getName() ) !== false
+ if ( strpos( $file, $reference ) !== false
|| strpos( $file, "-thumbnail" ) !== false // "short" thumb name
) {
$purgeList[] = "{$dir}/{$file}";