本文整理汇总了PHP中UploadBase::isThrottled方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadBase::isThrottled方法的具体用法?PHP UploadBase::isThrottled怎么用?PHP UploadBase::isThrottled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadBase
的用法示例。
在下文中一共展示了UploadBase::isThrottled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContextResult
/**
* Get an upload result based on upload context
* @return array
*/
private function getContextResult()
{
$warnings = $this->getApiWarnings();
if ($warnings && !$this->mParams['ignorewarnings']) {
// Get warnings formatted in result array format
return $this->getWarningsResult($warnings);
} elseif ($this->mParams['chunk']) {
// Add chunk, and get result
return $this->getChunkResult($warnings);
} elseif ($this->mParams['stash']) {
// Stash the file and get stash result
return $this->getStashResult($warnings);
}
// Check throttle after we've handled warnings
if (UploadBase::isThrottled($this->getUser())) {
$this->dieUsageMsg('actionthrottledtext');
}
// This is the most common case -- a normal upload with no warnings
// performUpload will return a formatted properly for the API with status
return $this->performUpload($warnings);
}
示例2: processUpload
/**
* Do the upload.
* Checks are made in SpecialUpload::execute()
*/
protected function processUpload()
{
// Fetch the file if required
$status = $this->mUpload->fetchFile();
if (!$status->isOK()) {
$this->showUploadError($this->getOutput()->parse($status->getWikiText()));
return;
}
if (!Hooks::run('UploadForm:BeforeProcessing', array(&$this))) {
wfDebug("Hook 'UploadForm:BeforeProcessing' broke processing the file.\n");
// This code path is deprecated. If you want to break upload processing
// do so by hooking into the appropriate hooks in UploadBase::verifyUpload
// and UploadBase::verifyFile.
// If you use this hook to break uploading, the user will be returned
// an empty form with no error message whatsoever.
return;
}
// Upload verification
$details = $this->mUpload->verifyUpload();
if ($details['status'] != UploadBase::OK) {
$this->processVerificationError($details);
return;
}
// Verify permissions for this title
$permErrors = $this->mUpload->verifyTitlePermissions($this->getUser());
if ($permErrors !== true) {
$code = array_shift($permErrors[0]);
$this->showRecoverableUploadError($this->msg($code, $permErrors[0])->parse());
return;
}
$this->mLocalFile = $this->mUpload->getLocalFile();
// Check warnings if necessary
if (!$this->mIgnoreWarning) {
$warnings = $this->mUpload->checkWarnings();
if ($this->showUploadWarning($warnings)) {
return;
}
}
// This is as late as we can throttle, after expected issues have been handled
if (UploadBase::isThrottled($this->getUser())) {
$this->showRecoverableUploadError($this->msg('actionthrottledtext')->escaped());
return;
}
// Get the page text if this is not a reupload
if (!$this->mForReUpload) {
$pageText = self::getInitialPageText($this->mComment, $this->mLicense, $this->mCopyrightStatus, $this->mCopyrightSource, $this->getConfig());
} else {
$pageText = false;
}
$status = $this->mUpload->performUpload($this->mComment, $pageText, $this->mWatchthis, $this->getUser());
if (!$status->isGood()) {
$this->showUploadError($this->getOutput()->parse($status->getWikiText()));
return;
}
// Success, redirect to description page
$this->mUploadSuccessful = true;
Hooks::run('SpecialUploadComplete', array(&$this));
$this->getOutput()->redirect($this->mLocalFile->getTitle()->getFullURL());
}