jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/343534 )
Change subject: Issue Solved - $wgMaxUploadSize being an array causes an error
in Page Forms
......................................................................
Issue Solved - $wgMaxUploadSize being an array causes an error in Page Forms
In the page form upload window, if $wgMaxUplaodSize was an array, a fatal error
would be thrown by. This issue has been solved now and thus $wgMaxUploadSize
can now be integer as well as an array.
Bug: T160687
Change-Id: I7b2da4803152470f82487a641512f6f9342ab5bc
---
M specials/PF_UploadForm.php
1 file changed, 15 insertions(+), 3 deletions(-)
Approvals:
Yaron Koren: Looks good to me, approved
jenkins-bot: Verified
diff --git a/specials/PF_UploadForm.php b/specials/PF_UploadForm.php
index f640520..16ba435 100644
--- a/specials/PF_UploadForm.php
+++ b/specials/PF_UploadForm.php
@@ -100,6 +100,19 @@
);
}
+ $maxUploadSizeFile = ini_get( 'upload_max_filesize' );
+ $maxUploadSizeURL = ini_get( 'upload_max_filesize' );
+ global $wgMaxUploadSize;
+ if( isset( $wgMaxUploadSize ) ) {
+ if( gettype( $wgMaxUploadSize ) == "array" ) {
+ $maxUploadSizeFile = $wgMaxUploadSize['*'];
+ $maxUploadSizeURL = $wgMaxUploadSize['url'];
+ } else {
+ $maxUploadSizeFile = $wgMaxUploadSize;
+ $maxUploadSizeURL = $wgMaxUploadSize;
+ }
+ }
+
$descriptor['UploadFile'] = array(
'class' => 'PFUploadSourceField',
'section' => 'source',
@@ -110,13 +123,12 @@
'radio' => &$radio,
'help' => wfMessage( 'upload-maxfilesize',
$this->getLanguage()->formatSize(
- wfShorthandToInteger(
ini_get( 'upload_max_filesize' ) )
+ wfShorthandToInteger(
$maxUploadSizeFile )
)
)->parse() . ' ' . wfMessage(
'upload_source_file' )->escaped(),
'checked' => $selectedSourceType == 'file',
);
if ( $canUploadByUrl ) {
- global $wgMaxUploadSize;
$descriptor['UploadFileURL'] = array(
'class' => 'UploadSourceField',
'section' => 'source',
@@ -125,7 +137,7 @@
'upload-type' => 'Url',
'radio' => &$radio,
'help' => wfMessage( 'upload-maxfilesize',
-
$this->getLanguage()->formatSize( $wgMaxUploadSize )
+
$this->getLanguage()->formatSize( $maxUploadSizeURL )
)->parse() . ' ' . wfMessage(
'upload_source_url' )->escaped(),
'checked' => $selectedSourceType == 'url',
);
--
To view, visit https://gerrit.wikimedia.org/r/343534
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7b2da4803152470f82487a641512f6f9342ab5bc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: Fz-29 <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits