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 "Add .pipeline/ with dev image variant"
[lhc/web/wiklou.git]
/
includes
/
filerepo
/
file
/
UnregisteredLocalFile.php
diff --git
a/includes/filerepo/file/UnregisteredLocalFile.php
b/includes/filerepo/file/UnregisteredLocalFile.php
index
5ee25cd
..
4292ea0
100644
(file)
--- a/
includes/filerepo/file/UnregisteredLocalFile.php
+++ b/
includes/filerepo/file/UnregisteredLocalFile.php
@@
-43,7
+43,7
@@
class UnregisteredLocalFile extends File {
/** @var bool|string */
protected $mime;
/** @var bool|string */
protected $mime;
- /** @var array Dimension data */
+ /** @var array
[]|bool[]
Dimension data */
protected $dims;
/** @var bool|string Handler-specific metadata which will be saved in the img_metadata field */
protected $dims;
/** @var bool|string Handler-specific metadata which will be saved in the img_metadata field */
@@
-55,19
+55,19
@@
class UnregisteredLocalFile extends File {
/**
* @param string $path Storage path
* @param string $mime
/**
* @param string $path Storage path
* @param string $mime
- * @return
UnregisteredLocalFile
+ * @return
static
*/
static function newFromPath( $path, $mime ) {
*/
static function newFromPath( $path, $mime ) {
- return new s
elf
( false, false, $path, $mime );
+ return new s
tatic
( false, false, $path, $mime );
}
/**
* @param Title $title
* @param FileRepo $repo
}
/**
* @param Title $title
* @param FileRepo $repo
- * @return
UnregisteredLocalFile
+ * @return
static
*/
static function newFromTitle( $title, $repo ) {
*/
static function newFromTitle( $title, $repo ) {
- return new s
elf
( $title, $repo, false, false );
+ return new s
tatic
( $title, $repo, false, false );
}
/**
}
/**
@@
-108,9
+108,14
@@
class UnregisteredLocalFile extends File {
/**
* @param int $page
/**
* @param int $page
- * @return bool
+ * @return
array|
bool
*/
private function cachePageDimensions( $page = 1 ) {
*/
private function cachePageDimensions( $page = 1 ) {
+ $page = (int)$page;
+ if ( $page < 1 ) {
+ $page = 1;
+ }
+
if ( !isset( $this->dims[$page] ) ) {
if ( !$this->getHandler() ) {
return false;
if ( !isset( $this->dims[$page] ) ) {
if ( !$this->getHandler() ) {
return false;
@@
-146,7
+151,7
@@
class UnregisteredLocalFile extends File {
*/
function getMimeType() {
if ( !isset( $this->mime ) ) {
*/
function getMimeType() {
if ( !isset( $this->mime ) ) {
- $magic = M
imeMagic::singleton
();
+ $magic = M
ediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer
();
$this->mime = $magic->guessMimeType( $this->getLocalRefPath() );
}
$this->mime = $magic->guessMimeType( $this->getLocalRefPath() );
}
@@
-166,8
+171,8
@@
class UnregisteredLocalFile extends File {
}
/**
}
/**
- * @return int
- */
+
* @return int
+
*/
function getBitDepth() {
$gis = $this->getImageSize( $this->getLocalRefPath() );
function getBitDepth() {
$gis = $this->getImageSize( $this->getLocalRefPath() );