/** * @return array */ public function verifyUpload() { # Check for a post_max_size or upload_max_size overflow, so that a # proper error can be shown to the user if (is_null($this->mTempPath) || $this->isEmptyFile()) { if ($this->mUpload->isIniSizeOverflow()) { return array('status' => UploadBase::FILE_TOO_LARGE, 'max' => min(self::getMaxUploadSize($this->getSourceType()), wfShorthandToInteger(ini_get('upload_max_filesize')), wfShorthandToInteger(ini_get('post_max_size')))); } } return parent::verifyUpload(); }
} # Check for PCRE support if (!function_exists('preg_match')) { dieout("The PCRE support module appears to be missing. MediaWiki requires the\n\tPerl-compatible regular expression functions."); } # The installer can take a while, and we really don't want it to time out wfSuppressWarnings(); set_time_limit(0); wfRestoreWarnings(); $memlimit = ini_get("memory_limit"); if ($memlimit == -1) { print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n"; } else { print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars($memlimit) . " bytes. "; $newlimit = wfMemoryLimit(); $memlimit = wfShorthandToInteger($memlimit); if ($newlimit < $memlimit) { print "<b>Failed raising limit, installation may fail.</b>"; } elseif ($newlimit > $memlimit) { print "Raised <tt>memory_limit</tt> to " . htmlspecialchars($newlimit) . " bytes. "; } print "</li>\n"; } $conf->xcache = function_exists('xcache_get'); if ($conf->xcache) { print "<li><a href=\"http://trac.lighttpd.net/xcache/\">XCache</a> installed</li>\n"; } $conf->apc = function_exists('apc_fetch'); if ($conf->apc) { print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>\n"; }
/** * Get the descriptor of the fieldset that contains the file source * selection. The section is 'source' * * @return array Descriptor array */ protected function getSourceSection() { if ($this->mSessionKey) { return array('SessionKey' => array('type' => 'hidden', 'default' => $this->mSessionKey), 'SourceType' => array('type' => 'hidden', 'default' => 'Stash')); } $canUploadByUrl = UploadFromUrl::isEnabled() && UploadFromUrl::isAllowed($this->getUser()) === true && $this->getConfig()->get('CopyUploadsFromSpecialUpload'); $radio = $canUploadByUrl; $selectedSourceType = strtolower($this->getRequest()->getText('wpSourceType', 'File')); $descriptor = array(); if ($this->mTextTop) { $descriptor['UploadFormTextTop'] = array('type' => 'info', 'section' => 'source', 'default' => $this->mTextTop, 'raw' => true); } $this->mMaxUploadSize['file'] = UploadBase::getMaxUploadSize('file'); # Limit to upload_max_filesize unless we are running under HipHop and # that setting doesn't exist if (!wfIsHHVM()) { $this->mMaxUploadSize['file'] = min($this->mMaxUploadSize['file'], wfShorthandToInteger(ini_get('upload_max_filesize')), wfShorthandToInteger(ini_get('post_max_size'))); } $help = $this->msg('upload-maxfilesize', $this->getContext()->getLanguage()->formatSize($this->mMaxUploadSize['file']))->parse(); // If the user can also upload by URL, there are 2 different file size limits. // This extra message helps stress which limit corresponds to what. if ($canUploadByUrl) { $help .= $this->msg('word-separator')->escaped(); $help .= $this->msg('upload_source_file')->parse(); } $descriptor['UploadFile'] = array('class' => 'UploadSourceField', 'section' => 'source', 'type' => 'file', 'id' => 'wpUploadFile', 'radio-id' => 'wpSourceTypeFile', 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, 'help' => $help, 'checked' => $selectedSourceType == 'file'); if ($canUploadByUrl) { $this->mMaxUploadSize['url'] = UploadBase::getMaxUploadSize('url'); $descriptor['UploadFileURL'] = array('class' => 'UploadSourceField', 'section' => 'source', 'id' => 'wpUploadFileURL', 'radio-id' => 'wpSourceTypeurl', 'label-message' => 'sourceurl', 'upload-type' => 'url', 'radio' => &$radio, 'help' => $this->msg('upload-maxfilesize', $this->getContext()->getLanguage()->formatSize($this->mMaxUploadSize['url']))->parse() . $this->msg('word-separator')->escaped() . $this->msg('upload_source_url')->parse(), 'checked' => $selectedSourceType == 'url'); } Hooks::run('UploadFormSourceDescriptors', array(&$descriptor, &$radio, $selectedSourceType)); $descriptor['Extensions'] = array('type' => 'info', 'section' => 'source', 'default' => $this->getExtensionsMessage(), 'raw' => true); return $descriptor; }
/** * Get the descriptor of the fieldset that contains the file source * selection. The section is 'source' * * @return Array: descriptor array */ protected function getSourceSection() { if ($this->mSessionKey) { return array('SessionKey' => array('type' => 'hidden', 'default' => $this->mSessionKey), 'SourceType' => array('type' => 'hidden', 'default' => 'Stash')); } $canUploadByUrl = UploadFromUrl::isEnabled() && UploadFromUrl::isAllowed($this->getUser()); $radio = $canUploadByUrl; $selectedSourceType = strtolower($this->getRequest()->getText('wpSourceType', 'File')); $descriptor = array(); if ($this->mTextTop) { $descriptor['UploadFormTextTop'] = array('type' => 'info', 'section' => 'source', 'default' => $this->mTextTop, 'raw' => true); } $this->mMaxUploadSize['file'] = UploadBase::getMaxUploadSize('file'); # Limit to upload_max_filesize unless we are running under HipHop and # that setting doesn't exist if (!wfIsHipHop()) { $this->mMaxUploadSize['file'] = min($this->mMaxUploadSize['file'], wfShorthandToInteger(ini_get('upload_max_filesize')), wfShorthandToInteger(ini_get('post_max_size'))); } $descriptor['UploadFile'] = array('class' => 'UploadSourceField', 'section' => 'source', 'type' => 'file', 'id' => 'wpUploadFile', 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, 'help' => $this->msg('upload-maxfilesize', $this->getContext()->getLanguage()->formatSize($this->mMaxUploadSize['file']))->parse() . ' ' . $this->msg('upload_source_file')->escaped(), 'checked' => $selectedSourceType == 'file'); if ($canUploadByUrl) { $this->mMaxUploadSize['url'] = UploadBase::getMaxUploadSize('url'); $descriptor['UploadFileURL'] = array('class' => 'UploadSourceField', 'section' => 'source', 'id' => 'wpUploadFileURL', 'label-message' => 'sourceurl', 'upload-type' => 'url', 'radio' => &$radio, 'help' => $this->msg('upload-maxfilesize', $this->getContext()->getLanguage()->formatSize($this->mMaxUploadSize['url']))->parse() . ' ' . $this->msg('upload_source_url')->escaped(), 'checked' => $selectedSourceType == 'url'); } wfRunHooks('UploadFormSourceDescriptors', array(&$descriptor, &$radio, $selectedSourceType)); $descriptor['Extensions'] = array('type' => 'info', 'section' => 'source', 'default' => $this->getExtensionsMessage(), 'raw' => true); return $descriptor; }
/** * Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit; * * @return int Value the memory limit was set to. */ function wfMemoryLimit() { global $wgMemoryLimit; $memlimit = wfShorthandToInteger(ini_get('memory_limit')); if ($memlimit != -1) { $conflimit = wfShorthandToInteger($wgMemoryLimit); if ($conflimit == -1) { wfDebug("Removing PHP's memory limit\n"); MediaWiki\suppressWarnings(); ini_set('memory_limit', $conflimit); MediaWiki\restoreWarnings(); return $conflimit; } elseif ($conflimit > $memlimit) { wfDebug("Raising PHP's memory limit to {$conflimit} bytes\n"); MediaWiki\suppressWarnings(); ini_set('memory_limit', $conflimit); MediaWiki\restoreWarnings(); return $conflimit; } } return $memlimit; }
if ($wgMetaNamespace === false) { $wgMetaNamespace = str_replace(' ', '_', $wgSitename); } // Default value is 2000 or the suhosin limit if it is between 1 and 2000 if ($wgResourceLoaderMaxQueryLength === false) { $suhosinMaxValueLength = (int) ini_get('suhosin.get.max_value_length'); if ($suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000) { $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength; } else { $wgResourceLoaderMaxQueryLength = 2000; } unset($suhosinMaxValueLength); } // Ensure the minimum chunk size is less than PHP upload limits or the maximum // upload size. $wgMinUploadChunkSize = min($wgMinUploadChunkSize, UploadBase::getMaxUploadSize('file'), UploadBase::getMaxPhpUploadSize(), (wfShorthandToInteger(ini_get('post_max_size') ?: ini_get('hhvm.server.max_post_size'), PHP_INT_MAX) ?: PHP_INT_MAX) - 1024); /** * Definitions of the NS_ constants are in Defines.php * @private */ $wgCanonicalNamespaceNames = [NS_MEDIA => 'Media', NS_SPECIAL => 'Special', NS_TALK => 'Talk', NS_USER => 'User', NS_USER_TALK => 'User_talk', NS_PROJECT => 'Project', NS_PROJECT_TALK => 'Project_talk', NS_FILE => 'File', NS_FILE_TALK => 'File_talk', NS_MEDIAWIKI => 'MediaWiki', NS_MEDIAWIKI_TALK => 'MediaWiki_talk', NS_TEMPLATE => 'Template', NS_TEMPLATE_TALK => 'Template_talk', NS_HELP => 'Help', NS_HELP_TALK => 'Help_talk', NS_CATEGORY => 'Category', NS_CATEGORY_TALK => 'Category_talk']; /// @todo UGLY UGLY if (is_array($wgExtraNamespaces)) { $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces; } // These are now the same, always // To determine the user language, use $wgLang->getCode() $wgContLanguageCode = $wgLanguageCode; // Easy to forget to falsify $wgDebugToolbar for static caches. // If file cache or CDN cache is on, just disable this (DWIMD). if ($wgUseFileCache || $wgUseSquid) {
/** * test @see wfShorthandToInteger() * @dataProvider provideShorthand * @covers ::wfShorthandToInteger */ public function testWfShorthandToInteger($shorthand, $expected) { $this->assertEquals($expected, wfShorthandToInteger($shorthand)); }
protected function getDescriptors() { global $wgUser, $wgLang, $wgMaxUploadSize; $descriptor = $this->getCommonFields(); $size = $wgLang->formatSize(wfShorthandToInteger(min(wfShorthandToInteger(ini_get('upload_max_filesize')), $wgMaxUploadSize))); $upload_source_file = wfMessage('upload_source_file')->escaped(); $descriptor['UploadFile'] = array('class' => 'UploadSourceField', 'type' => 'file', 'id' => 'wpUploadFile', 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, 'help' => wfMessage('upload-maxfilesize', $size)->text() . " {$upload_source_file}", 'checked' => true); $descriptor['Extensions'] = array('type' => 'info', 'default' => $this->getExtensionsMessage(), 'raw' => true); $descriptor['DestFile'] = array('type' => 'text', 'id' => 'wpDestFile', 'label-message' => 'destfilename', 'size' => 60, 'default' => $this->mDesiredDestName, 'nodata' => strval($this->mDesiredDestName) !== ''); $descriptor['UploadDescription'] = array('type' => 'textarea', 'id' => 'wpUploadDescription', 'label-message' => $this->mForReUpload ? 'filereuploadsummary' : 'fileuploadsummary', 'default' => $this->mComment, 'cols' => intval($wgUser->getOption('cols')), 'rows' => 8); $descriptor['IgnoreWarning'] = array('type' => 'hidden', 'id' => 'wpIgnoreWarning', 'label-message' => 'ignorewarnings', 'default' => '1'); $descriptor['DestFileWarningAck'] = array('type' => 'hidden', 'id' => 'wpDestFileWarningAck', 'default' => '1'); $descriptor['ForReUpload'] = array('type' => 'hidden', 'id' => 'wpForReUpload', 'default' => '1'); return $descriptor; }
/** * Get the descriptor of the fieldset that contains the file source * selection. The section is 'source' * * @return array Descriptor array */ protected function getSourceSection() { if ($this->mSessionKey) { return array('wpSessionKey' => array('type' => 'hidden', 'default' => $this->mSessionKey), 'wpSourceType' => array('type' => 'hidden', 'default' => 'Stash')); } $canUploadByUrl = UploadFromUrl::isEnabled() && $this->getUser()->isAllowed('upload_by_url'); $radio = $canUploadByUrl; $selectedSourceType = strtolower($this->getRequest()->getText('wpSourceType', 'File')); $descriptor = array(); if ($this->mTextTop) { $descriptor['UploadFormTextTop'] = array('type' => 'info', 'section' => 'source', 'default' => $this->mTextTop, 'raw' => true); } $descriptor['UploadFile'] = array('class' => 'SFUploadSourceField', 'section' => 'source', 'type' => 'file', 'id' => 'wpUploadFile', 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, 'help' => wfMessage('upload-maxfilesize', $this->getLanguage()->formatSize(wfShorthandToInteger(ini_get('upload_max_filesize'))))->parse() . ' ' . wfMessage('upload_source_file')->escaped(), 'checked' => $selectedSourceType == 'file'); if ($canUploadByUrl) { global $wgMaxUploadSize; $descriptor['UploadFileURL'] = array('class' => 'SFUploadSourceField', 'section' => 'source', 'id' => 'wpUploadFileURL', 'label-message' => 'sourceurl', 'upload-type' => 'Url', 'radio' => &$radio, 'help' => wfMessage('upload-maxfilesize', $this->getLanguage()->formatSize($wgMaxUploadSize))->parse() . ' ' . wfMessage('upload_source_url')->escaped(), 'checked' => $selectedSourceType == 'url'); } Hooks::run('UploadFormSourceDescriptors', array(&$descriptor, &$radio, $selectedSourceType)); $descriptor['Extensions'] = array('type' => 'info', 'section' => 'source', 'default' => $this->getExtensionsMessage(), 'raw' => true); return $descriptor; }
/** * Get the descriptor of the fieldset that contains the file source * selection. The section is 'source' * * @return array Descriptor array */ protected function getSourceSection() { if (sizeof($this->mSessionKeys) > 0) { $data = array('wpSourceType' => array('type' => 'hidden', 'default' => 'Stash')); $index = 0; foreach ($this->mDestFiles as $k => $v) { if ($v == '') { continue; } $data['wpDestFile' . $index] = array('type' => 'hidden', 'default' => $v); $data['wpSessionKey' . $index] = array('type' => 'hidden', 'default' => $this->mSessionKeys['sessionkey' . $v]); $index++; } return $data; } $canUploadByUrl = UploadFromUrl::isEnabled() && $this->getUser()->isAllowed('upload_by_url'); $radio = $canUploadByUrl; $selectedSourceType = strtolower($this->getRequest()->getText('wpSourceType', 'File')); $descriptor = array(); if ($this->mTextTop) { $descriptor['UploadFormTextTop'] = array('type' => 'info', 'section' => 'source', 'default' => $this->mTextTop, 'raw' => true); } for ($i = 0; $i < MultipleUpload::getMaxUploadFiles(); $i++) { $descriptor['UploadFile' . $i] = array('class' => 'UploadSourceField', 'section' => 'source', 'type' => 'file', 'id' => 'wpUploadFile' . $i, 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, 'checked' => $selectedSourceType == 'file'); $descriptor['DestFile' . $i] = array('type' => 'text', 'section' => 'source', 'id' => 'wpDestFile' . $i, 'label-message' => 'destfilename', 'size' => 60, 'default' => $this->mDestFiles[$i], 'nodata' => strval($this->mDestFile) !== ''); if ($canUploadByUrl) { global $wgMaxUploadSize; $descriptor['UploadFileURL'] = array('class' => 'UploadSourceField', 'section' => 'source', 'id' => 'wpUploadFileURL', 'label-message' => 'sourceurl', 'upload-type' => 'url', 'radio' => &$radio, 'help' => wfMsgExt('upload-maxfilesize', array('parseinline', 'escapenoentities'), $this->getLang()->formatSize($wgMaxUploadSize)) . ' ' . wfMsgHtml('upload_source_url'), 'checked' => $selectedSourceType == 'url'); } } wfRunHooks('UploadFormSourceDescriptors', array(&$descriptor, &$radio, $selectedSourceType)); $descriptor['Extensions'] = array('type' => 'info', 'section' => 'source', 'default' => $this->getExtensionsMessage(), 'raw' => true, 'help' => wfMsgExt('upload-maxfilesize', array('parseinline', 'escapenoentities'), $this->getLang()->formatSize(wfShorthandToInteger(ini_get('upload_max_filesize')))) . ' ' . wfMsgHtml('upload_source_file')); return $descriptor; }
/** * Get the PHP maximum uploaded file size, based on ini settings. If there is no limit or the * limit can't be guessed, returns a very large number (PHP_INT_MAX). * * @since 1.27 * @return int */ public static function getMaxPhpUploadSize() { $phpMaxFileSize = wfShorthandToInteger(ini_get('upload_max_filesize') ?: ini_get('hhvm.server.upload.upload_max_file_size'), PHP_INT_MAX); $phpMaxPostSize = wfShorthandToInteger(ini_get('post_max_size') ?: ini_get('hhvm.server.max_post_size'), PHP_INT_MAX) ?: PHP_INT_MAX; return min($phpMaxFileSize, $phpMaxPostSize); }
/** * Returns whether this upload failed because of overflow of a maximum set * in php.ini * * @return bool */ public function isIniSizeOverflow() { if ($this->getError() == UPLOAD_ERR_INI_SIZE) { # PHP indicated that upload_max_filesize is exceeded return true; } $contentLength = $this->request->getHeader('Content-Length'); $maxPostSize = wfShorthandToInteger(ini_get('post_max_size') ?: ini_get('hhvm.server.max_post_size'), 0); if ($maxPostSize && $contentLength > $maxPostSize) { # post_max_size is exceeded return true; } return false; }
/** * @dataProvider provideABunchOfShorthands */ function testWfShorthandToInteger($input, $output, $description) { $this->assertEquals(wfShorthandToInteger($input), $output, $description); }
if ($wgMetaNamespace === false) { $wgMetaNamespace = str_replace(' ', '_', $wgSitename); } // Default value is 2000 or the suhosin limit if it is between 1 and 2000 if ($wgResourceLoaderMaxQueryLength === false) { $suhosinMaxValueLength = (int) ini_get('suhosin.get.max_value_length'); if ($suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000) { $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength; } else { $wgResourceLoaderMaxQueryLength = 2000; } unset($suhosinMaxValueLength); } // Ensure the minimum chunk size is less than PHP upload limits or the maximum // upload size. $wgMinUploadChunkSize = min($wgMinUploadChunkSize, $wgMaxUploadSize, wfShorthandToInteger(ini_get('upload_max_filesize'), 1.0E+100), wfShorthandToInteger(ini_get('post_max_size'), 1.0E+100) - 1024); /** * Definitions of the NS_ constants are in Defines.php * @private */ $wgCanonicalNamespaceNames = array(NS_MEDIA => 'Media', NS_SPECIAL => 'Special', NS_TALK => 'Talk', NS_USER => 'User', NS_USER_TALK => 'User_talk', NS_PROJECT => 'Project', NS_PROJECT_TALK => 'Project_talk', NS_FILE => 'File', NS_FILE_TALK => 'File_talk', NS_MEDIAWIKI => 'MediaWiki', NS_MEDIAWIKI_TALK => 'MediaWiki_talk', NS_TEMPLATE => 'Template', NS_TEMPLATE_TALK => 'Template_talk', NS_HELP => 'Help', NS_HELP_TALK => 'Help_talk', NS_CATEGORY => 'Category', NS_CATEGORY_TALK => 'Category_talk'); /// @todo UGLY UGLY if (is_array($wgExtraNamespaces)) { $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces; } // These are now the same, always // To determine the user language, use $wgLang->getCode() $wgContLanguageCode = $wgLanguageCode; // Easy to forget to falsify $wgShowIPinHeader for static caches. // If file cache or squid cache is on, just disable this (DWIMD). // Do the same for $wgDebugToolbar.
/** * Environment check for available memory. */ protected function envCheckMemory() { $limit = ini_get('memory_limit'); if (!$limit || $limit == -1) { return true; } $n = wfShorthandToInteger($limit); if ($n < $this->minMemorySize * 1024 * 1024) { $newLimit = "{$this->minMemorySize}M"; if (ini_set("memory_limit", $newLimit) === false) { $this->showMessage('config-memory-bad', $limit); } else { $this->showMessage('config-memory-raised', $limit, $newLimit); $this->setVar('_RaiseMemory', true); } } else { return true; } }
$languageFixups = $uwDefaultLanguageFixups; } // Use LinkBatch to make this a little bit more faster. // It works because $title->exists (below) will use LinkCache. $linkBatch = new LinkBatch(); foreach ($baseLangs as $code => $name) { $fixedCode = array_key_exists($code, $languageFixups) ? $languageFixups[$code] : $code; if (is_string($fixedCode) && $fixedCode !== '') { $title = Title::makeTitle(NS_TEMPLATE, Title::capitalize($fixedCode, NS_TEMPLATE)); $linkBatch->addObj($title); } } $linkBatch->execute(); // Then, check that there's a template for each one. foreach ($baseLangs as $code => $name) { $fixedCode = array_key_exists($code, $languageFixups) ? $languageFixups[$code] : $code; if (is_string($fixedCode) && $fixedCode !== '') { $title = Title::makeTitle(NS_TEMPLATE, Title::capitalize($fixedCode, NS_TEMPLATE)); if ($title->exists()) { // If there is, then it's in the final picks! $uwLanguages[$code] = $name; } } } // Sort the list by the language name natsort($uwLanguages); // Cache the list for 1 day $wgMemc->set($cacheKey, $uwLanguages, 60 * 60 * 24); } return array('debug' => false, 'enableLicensePreference' => true, 'campaignSquidMaxAge' => 10 * 60, 'campaignExpensiveStatsEnabled' => true, 'campaignStatsMaxAge' => 60, 'campaignCTACampaignTemplate' => 'uploadCampaign:$1', 'fileExtensions' => $wgCheckFileExtensions ? $wgFileExtensions : null, 'flickrApiUrl' => 'https://api.flickr.com/services/rest/?', 'flickrApiKey' => 'aeefff139445d825d4460796616f9349', 'flickrBlacklistPage' => '', 'autoAdd' => array('categories' => array(), 'wikitext' => ''), 'missingCategoriesWikiText' => '', 'display' => array('headerLabel' => '', 'thanksLabel' => '', 'labelPickImage' => '', 'noticeExistingImage' => '', 'noticeUpdateDelay' => ''), 'tutorial' => array('skip' => false, 'template' => 'Licensing_tutorial_$1.svg', 'width' => 720, 'helpdeskCoords' => '27, 1319, 691, 1384'), 'trackingCategory' => array('all' => 'Uploaded with UploadWizard', 'campaign' => 'Uploaded via Campaign:$1'), 'fields' => array(array('wikitext' => '', 'label' => '', 'maxLength' => 25, 'initialValue' => '', 'required' => false, 'type' => "text", 'options' => array())), 'defaults' => array('categories' => array(), 'description' => ''), 'uwLanguages' => empty($uwLanguages) ? array('en' => 'English') : $uwLanguages, 'licenses' => array('cc-by-sa-4.0' => array('msg' => 'mwe-upwiz-license-cc-by-sa-4.0', 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/4.0/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0', 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-gfdl' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-gfdl', 'templates' => array('GFDL', 'cc-by-sa-3.0'), 'icons' => array('cc-by', 'cc-sa')), 'cc-by-sa-3.0-at' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-at', 'templates' => array('cc-by-sa-3.0-at'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/at/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-de' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-de', 'templates' => array('cc-by-sa-3.0-de'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/de/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-ee' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-ee', 'templates' => array('cc-by-sa-3.0-ee'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/ee/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-es' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-es', 'templates' => array('cc-by-sa-3.0-es'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/es/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-hr' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-hr', 'templates' => array('cc-by-sa-3.0-hr'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/hr/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-lu' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-lu', 'templates' => array('cc-by-sa-3.0-lu'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/lu/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-nl' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-nl', 'templates' => array('cc-by-sa-3.0-nl'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/nl/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-no' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-no', 'templates' => array('cc-by-sa-3.0-no'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/no/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-pl' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-pl', 'templates' => array('cc-by-sa-3.0-pl'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/pl/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-3.0-ro' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-ro', 'templates' => array('cc-by-sa-3.0-ro'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/ro/', 'languageCodePrefix' => 'deed.'), 'cc-by-4.0' => array('msg' => 'mwe-upwiz-license-cc-by-4.0', 'icons' => array('cc-by'), 'url' => '//creativecommons.org/licenses/by/4.0/', 'languageCodePrefix' => 'deed.'), 'cc-by-3.0' => array('msg' => 'mwe-upwiz-license-cc-by-3.0', 'icons' => array('cc-by'), 'url' => '//creativecommons.org/licenses/by/3.0/', 'languageCodePrefix' => 'deed.'), 'cc-zero' => array('msg' => 'mwe-upwiz-license-cc-zero', 'icons' => array('cc-zero'), 'url' => '//creativecommons.org/publicdomain/zero/1.0/', 'languageCodePrefix' => 'deed.'), 'own-pd' => array('msg' => 'mwe-upwiz-license-own-pd', 'icons' => array('cc-zero'), 'templates' => array('cc-zero')), 'cc-by-sa-2.5' => array('msg' => 'mwe-upwiz-license-cc-by-sa-2.5', 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/2.5/', 'languageCodePrefix' => 'deed.'), 'cc-by-2.5' => array('msg' => 'mwe-upwiz-license-cc-by-2.5', 'icons' => array('cc-by'), 'url' => '//creativecommons.org/licenses/by/2.5/', 'languageCodePrefix' => 'deed.'), 'cc-by-sa-2.0' => array('msg' => 'mwe-upwiz-license-cc-by-sa-2.0', 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/2.0/', 'languageCodePrefix' => 'deed.'), 'cc-by-2.0' => array('msg' => 'mwe-upwiz-license-cc-by-2.0', 'icons' => array('cc-by'), 'url' => '//creativecommons.org/licenses/by/2.0/', 'languageCodePrefix' => 'deed.'), 'fal' => array('msg' => 'mwe-upwiz-license-fal', 'templates' => array('FAL')), 'pd-old-100' => array('msg' => 'mwe-upwiz-license-pd-old-100', 'templates' => array('PD-old-100')), 'pd-old' => array('msg' => 'mwe-upwiz-license-pd-old', 'templates' => array('PD-old')), 'pd-art' => array('msg' => 'mwe-upwiz-license-pd-art', 'templates' => array('PD-Art')), 'pd-us' => array('msg' => 'mwe-upwiz-license-pd-us', 'templates' => array('PD-US')), 'pd-usgov' => array('msg' => 'mwe-upwiz-license-pd-usgov', 'templates' => array('PD-USGov')), 'pd-usgov-nasa' => array('msg' => 'mwe-upwiz-license-pd-usgov-nasa', 'templates' => array('PD-USGov-NASA')), 'pd-ineligible' => array('msg' => 'mwe-upwiz-license-pd-ineligible'), 'pd-textlogo' => array('msg' => 'mwe-upwiz-license-pd-textlogo', 'templates' => array('trademarked', 'PD-textlogo')), 'attribution' => array('msg' => 'mwe-upwiz-license-attribution'), 'gfdl' => array('msg' => 'mwe-upwiz-license-gfdl', 'templates' => array('GFDL')), 'none' => array('msg' => 'mwe-upwiz-license-none', 'templates' => array('subst:uwl')), 'custom' => array('msg' => 'mwe-upwiz-license-custom', 'templates' => array('subst:Custom license marker added by UW'), 'url' => wfMessage('mwe-upwiz-license-custom-url')->parse())), 'licenseCategory' => 'License tags', 'licenseTagFilters' => array('self'), 'licensing' => array('defaultType' => 'choice', 'ownWorkDefault' => 'choice', 'ownWork' => array('type' => 'or', 'template' => 'self', 'licenses' => array('cc-by-sa-4.0', 'cc-by-sa-3.0', 'cc-by-4.0', 'cc-by-3.0', 'cc-zero')), 'thirdParty' => array('type' => 'or', 'licenseGroups' => array(array('head' => 'mwe-upwiz-license-cc-head', 'subhead' => 'mwe-upwiz-license-cc-subhead', 'licenses' => array('cc-by-sa-4.0', 'cc-by-sa-3.0', 'cc-by-sa-2.5', 'cc-by-4.0', 'cc-by-3.0', 'cc-by-2.5', 'cc-zero')), array('head' => 'mwe-upwiz-license-flickr-head', 'subhead' => 'mwe-upwiz-license-flickr-subhead', 'prependTemplates' => array('flickrreview'), 'licenses' => array('cc-by-sa-2.0', 'cc-by-2.0', 'pd-usgov')), array('head' => 'mwe-upwiz-license-public-domain-usa-head', 'subhead' => 'mwe-upwiz-license-public-domain-usa-subhead', 'licenses' => array('pd-us', 'pd-art')), array('head' => 'mwe-upwiz-license-usgov-head', 'licenses' => array('pd-usgov', 'pd-usgov-nasa')), array('head' => 'mwe-upwiz-license-custom-head', 'special' => 'custom', 'licenses' => array('custom')), array('head' => 'mwe-upwiz-license-none-head', 'licenses' => array('none'))))), 'thumbnailWidth' => 100, 'thumbnailMaxHeight' => 100, 'largeThumbnailWidth' => 500, 'largeThumbnailMaxHeight' => 500, 'maxAuthorLength' => 10000, 'minAuthorLength' => 1, 'maxSourceLength' => 10000, 'minSourceLength' => 5, 'maxTitleLength' => 500, 'minTitleLength' => 5, 'maxDescriptionLength' => 10000, 'minDescriptionLength' => 5, 'maxOtherInformationLength' => 10000, 'maxSimultaneousConnections' => 3, 'maxUploads' => 50, 'maxPhpUploadSize' => min(wfShorthandToInteger(ini_get('upload_max_filesize')), wfShorthandToInteger(ini_get('post_max_size'))), 'maxMwUploadSize' => $wgMaxUploadSize, 'minCustomLicenseLength' => 6, 'maxCustomLicenseLength' => 10000, 'languageTemplateFixups' => $uwDefaultLanguageFixups, 'enableFirefogg' => true, 'transcodeExtensionList' => array('avi', 'asf', 'asx', 'wmv', 'wmx', 'dv', 'rm', 'ra', '3gp', 'mkv', 'mp4', 'm4v', 'mov', 'qt', 'mpeg', 'mpeg2', 'mp2', 'mpg', 'mts'), 'firefoggEncodeSettings' => array('maxSize' => '1920x1080', 'videoQuality' => 7, 'audioQuality' => 3, 'noUpscaling' => 'true', 'videoCodec' => 'vp8'), 'feedbackPage' => '', 'bugList' => 'https://phabricator.wikimedia.org/tag/MediaWiki-extensions-UploadWizard', 'altUploadForm' => '', 'useTitleBlacklistApi' => array_key_exists('titleblacklist', $wgAPIModules), 'blacklistIssuesPage' => '', 'enableFormData' => true, 'enableMultiFileSelect' => true, 'enableChunked' => false, 'chunkSize' => 5 * 1024 * 1024, 'copyMetadataFeature' => true, 'enableMultipleFiles' => true);
/** * Returns whether this upload failed because of overflow of a maximum set * in php.ini * * @return bool */ public function isIniSizeOverflow() { if ($this->getError() == UPLOAD_ERR_INI_SIZE) { # PHP indicated that upload_max_filesize is exceeded return true; } $contentLength = $this->request->getHeader('CONTENT_LENGTH'); if ($contentLength > wfShorthandToInteger(ini_get('post_max_size'))) { # post_max_size is exceeded return true; } return false; }
<?php /** * Upload Wizard Configuration * Do not modify this file, instead use localsettings.php and set: * $wgUploadWizardConfig[ 'name'] = 'value'; */ global $wgFileExtensions, $wgServer, $wgScriptPath, $wgAPIModules, $wgMaxUploadSize; return array('debug' => false, 'enableLicensePreference' => true, 'fileExtensions' => $wgFileExtensions, 'apiUrl' => $wgServer . $wgScriptPath . '/api.php', 'autoCategories' => array(), 'autoCategory' => '', 'defaultCategories' => array(), 'missingCategoriesWikiText' => '', 'autoWikiText' => '', 'headerLabelPage' => '', 'thanksLabelPage' => '', 'defaultLicenseType' => 'choice', 'ownWorkOption' => 'choice', 'tutorialTemplate' => 'Licensing_tutorial_$1.svg', 'tutorialWidth' => 720, 'tutorialHelpdeskCoords' => '27, 1319, 691, 1384', 'idField' => '', 'idFieldLabel' => '', 'idFieldLabelPage' => '', 'idFieldMaxLength' => 25, 'idFieldInitialValue' => '', 'defaultDescription' => '', 'defaultLat' => '', 'defaultLon' => '', 'defaultAlt' => '', 'licenses' => array('cc-by-sa-3.0' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0', 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/'), 'cc-by-sa-3.0-gfdl' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-gfdl', 'templates' => array('GFDL', 'cc-by-sa-3.0'), 'icons' => array('cc-by', 'cc-sa')), 'cc-by-sa-3.0-at' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-at', 'templates' => array('cc-by-sa-3.0-at'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/at/'), 'cc-by-sa-3.0-de' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-de', 'templates' => array('cc-by-sa-3.0-de'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/de/'), 'cc-by-sa-3.0-ee' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-ee', 'templates' => array('cc-by-sa-3.0-ee'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/ee/'), 'cc-by-sa-3.0-es' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-es', 'templates' => array('cc-by-sa-3.0-es'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/es/'), 'cc-by-sa-3.0-hr' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-hr', 'templates' => array('cc-by-sa-3.0-hr'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/hr/'), 'cc-by-sa-3.0-lu' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-lu', 'templates' => array('cc-by-sa-3.0-lu'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/lu/'), 'cc-by-sa-3.0-nl' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-nl', 'templates' => array('cc-by-sa-3.0-nl'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/nl/'), 'cc-by-sa-3.0-no' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-no', 'templates' => array('cc-by-sa-3.0-no'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/no/'), 'cc-by-sa-3.0-pl' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-pl', 'templates' => array('cc-by-sa-3.0-pl'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/pl/'), 'cc-by-sa-3.0-ro' => array('msg' => 'mwe-upwiz-license-cc-by-sa-3.0-ro', 'templates' => array('cc-by-sa-3.0-ro'), 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/3.0/ro/'), 'cc-by-3.0' => array('msg' => 'mwe-upwiz-license-cc-by-3.0', 'icons' => array('cc-by'), 'url' => '//creativecommons.org/licenses/by/3.0/'), 'cc-zero' => array('msg' => 'mwe-upwiz-license-cc-zero', 'icons' => array('cc-zero'), 'url' => '//creativecommons.org/publicdomain/zero/1.0/'), 'own-pd' => array('msg' => 'mwe-upwiz-license-own-pd', 'icons' => array('cc-zero'), 'templates' => array('cc-zero')), 'cc-by-sa-2.5' => array('msg' => 'mwe-upwiz-license-cc-by-sa-2.5', 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/2.5/'), 'cc-by-2.5' => array('msg' => 'mwe-upwiz-license-cc-by-2.5', 'icons' => array('cc-by'), 'url' => '//creativecommons.org/licenses/by/2.5/'), 'cc-by-sa-2.0' => array('msg' => 'mwe-upwiz-license-cc-by-sa-2.0', 'icons' => array('cc-by', 'cc-sa'), 'url' => '//creativecommons.org/licenses/by-sa/2.0/'), 'cc-by-2.0' => array('msg' => 'mwe-upwiz-license-cc-by-2.0', 'icons' => array('cc-by'), 'url' => '//creativecommons.org/licenses/by/2.0/'), 'fal' => array('msg' => 'mwe-upwiz-license-fal', 'templates' => array('FAL')), 'pd-old-100' => array('msg' => 'mwe-upwiz-license-pd-old-100', 'templates' => array('PD-old-100')), 'pd-old' => array('msg' => 'mwe-upwiz-license-pd-old', 'templates' => array('PD-old')), 'pd-art' => array('msg' => 'mwe-upwiz-license-pd-art', 'templates' => array('PD-Art')), 'pd-us' => array('msg' => 'mwe-upwiz-license-pd-us', 'templates' => array('PD-US')), 'pd-usgov' => array('msg' => 'mwe-upwiz-license-pd-usgov', 'templates' => array('PD-USGov')), 'pd-usgov-nasa' => array('msg' => 'mwe-upwiz-license-pd-usgov-nasa', 'templates' => array('PD-USGov-NASA')), 'pd-ineligible' => array('msg' => 'mwe-upwiz-license-pd-ineligible'), 'pd-textlogo' => array('msg' => 'mwe-upwiz-license-pd-textlogo', 'templates' => array('trademarked', 'PD-textlogo')), 'attribution' => array('msg' => 'mwe-upwiz-license-attribution'), 'gfdl' => array('msg' => 'mwe-upwiz-license-gfdl', 'templates' => array('GFDL')), 'none' => array('msg' => 'mwe-upwiz-license-none', 'templates' => array('subst:uwl')), 'custom' => array('msg' => 'mwe-upwiz-license-custom', 'templates' => array('subst:Custom license marker added by UW'), 'url' => wfMessage('mwe-upwiz-license-custom-url')->parse())), 'licenseCategory' => 'License tags', 'licenseTagFilters' => array('self'), 'licensesOwnWork' => array('type' => 'or', 'filterTemplate' => 'self', 'licenses' => array('cc-by-sa-3.0', 'cc-by-3.0', 'cc-zero'), 'defaults' => array('cc-by-sa-3.0')), 'licensesThirdParty' => array('type' => 'or', 'licenseGroups' => array(array('head' => 'mwe-upwiz-license-cc-head', 'subhead' => 'mwe-upwiz-license-cc-subhead', 'licenses' => array('cc-by-sa-3.0', 'cc-by-sa-2.5', 'cc-by-3.0', 'cc-by-2.5', 'cc-zero')), array('head' => 'mwe-upwiz-license-flickr-head', 'subhead' => 'mwe-upwiz-license-flickr-subhead', 'prependTemplates' => array('flickrreview'), 'licenses' => array('cc-by-sa-2.0', 'cc-by-2.0', 'pd-usgov')), array('head' => 'mwe-upwiz-license-public-domain-usa-head', 'subhead' => 'mwe-upwiz-license-public-domain-usa-subhead', 'licenses' => array('pd-us', 'pd-art')), array('head' => 'mwe-upwiz-license-usgov-head', 'licenses' => array('pd-usgov', 'pd-usgov-nasa')), array('head' => 'mwe-upwiz-license-custom-head', 'special' => 'custom', 'licenses' => array('custom')), array('head' => 'mwe-upwiz-license-none-head', 'licenses' => array('none'))), 'defaults' => array('none')), 'thumbnailWidth' => 100, 'thumbnailMaxHeight' => 100, 'largeThumbnailWidth' => 500, 'largeThumbnailMaxHeight' => 500, 'maxAuthorLength' => 10000, 'minAuthorLength' => 1, 'maxSourceLength' => 10000, 'minSourceLength' => 5, 'maxTitleLength' => 500, 'minTitleLength' => 5, 'maxDescriptionLength' => 10000, 'minDescriptionLength' => 5, 'maxOtherInformationLength' => 10000, 'maxSimultaneousConnections' => 3, 'maxUploads' => 50, 'maxPhpUploadSize' => min(wfShorthandToInteger(ini_get('upload_max_filesize')), wfShorthandToInteger(ini_get('post_max_size'))), 'maxMwUploadSize' => $wgMaxUploadSize, 'minCustomLicenseLength' => 6, 'maxCustomLicenseLength' => 10000, 'languageTemplateFixups' => array('tl' => 'tgl'), 'enableFirefogg' => false, 'transcodeExtensionList' => array('avi', 'asf', 'asx', 'wmv', 'wmx', 'dv', 'rm', 'ra', '3gp', 'mkv', 'mp4', 'm4v', 'mov', 'qt', 'mpeg', 'mpeg2', 'mp2', 'mpg'), 'firefoggEncodeSettings' => array('maxSize' => '1280', 'videoQuality' => 6, 'audioQuality' => 3, 'noUpscaling' => 'true', 'keyframeInterval' => '128', 'videoCodec' => 'theora'), 'skipTutorial' => false, 'feedbackPage' => '', 'bugList' => 'https://bugzilla.wikimedia.org/buglist.cgi?query_format=advanced&component=UploadWizard&resolution=---&product=MediaWiki+extensions', 'translateHelp' => '//translatewiki.net/w/i.php?title=Special:Translate&group=ext-uploadwizard', 'altUploadForm' => '', 'useTitleBlacklistApi' => array_key_exists('titleblacklist', $wgAPIModules), 'blacklistIssuesPage' => '', 'enableFormData' => true, 'enableMultiFileSelect' => true, 'enableChunked' => false, 'copyMetadataFeature' => true, 'startImmediately' => true);