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 "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git]
/
includes
/
upload
/
UploadBase.php
diff --git
a/includes/upload/UploadBase.php
b/includes/upload/UploadBase.php
index
c42584c
..
9e92e78
100644
(file)
--- a/
includes/upload/UploadBase.php
+++ b/
includes/upload/UploadBase.php
@@
-947,8
+947,8
@@
abstract class UploadBase {
*/
list( $partname, $ext ) = $this->splitExtensions( $this->mFilteredName );
*/
list( $partname, $ext ) = $this->splitExtensions( $this->mFilteredName );
- if (
count( $ext )
) {
- $this->mFinalExtension = trim(
$ext[count( $ext ) - 1]
);
+ if (
$ext !== []
) {
+ $this->mFinalExtension = trim(
end( $ext )
);
} else {
$this->mFinalExtension = '';
} else {
$this->mFinalExtension = '';
@@
-1078,10
+1078,8
@@
abstract class UploadBase {
$props = $this->mFileProps;
$error = null;
Hooks::run( 'UploadStashFile', [ $this, $user, $props, &$error ] );
$props = $this->mFileProps;
$error = null;
Hooks::run( 'UploadStashFile', [ $this, $user, $props, &$error ] );
- if ( $error ) {
- if ( !is_array( $error ) ) {
- $error = [ $error ];
- }
+ if ( $error && !is_array( $error ) ) {
+ $error = [ $error ];
}
return $error;
}
}
return $error;
}
@@
-1916,10
+1914,8
@@
abstract class UploadBase {
$output = true; # if there's no output, return true
} elseif ( $msgPattern ) {
$groups = [];
$output = true; # if there's no output, return true
} elseif ( $msgPattern ) {
$groups = [];
- if ( preg_match( $msgPattern, $output, $groups ) ) {
- if ( $groups[1] ) {
- $output = $groups[1];
- }
+ if ( preg_match( $msgPattern, $output, $groups ) && $groups[1] ) {
+ $output = $groups[1];
}
}
}
}