/** * Returns true if uploads are enabled. * Can be override by subclasses. */ public static function isEnabled() { global $wgEnableUploads; if (!$wgEnableUploads) { return false; } # Check php's file_uploads setting return wfIsHipHop() || wfIniGetBool('file_uploads'); }
/** * 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; }
$serverCount = $lb->getServerCount(); for ($i = 0; $i < $serverCount; $i++) { $server = $lb->getServerInfo($i); $server['flags'] |= DBO_DEBUG; $lb->setServerInfo($i, $server); } } if ($d > 2) { $wgDebugFunctionEntry = true; } } $useReadline = function_exists('readline_add_history') && Maintenance::posix_isatty(0); if ($useReadline) { $historyFile = isset($_ENV['HOME']) ? "{$_ENV['HOME']}/.mweval_history" : "{$IP}/maintenance/.mweval_history"; readline_read_history($historyFile); } while (($line = Maintenance::readconsole()) !== false) { if ($useReadline) { readline_add_history($line); readline_write_history($historyFile); } $val = eval($line . ";"); if (wfIsHipHop() || is_null($val)) { echo "\n"; } elseif (is_string($val) || is_numeric($val)) { echo "{$val}\n"; } else { var_dump($val); } } print "\n";