/** * @param UploadBase $upload * @return array */ private function uploadImage($upload) { global $wgRequest, $wgUser, $wgEnableUploads; $uploadStatus = array("status" => "error"); if (empty($wgEnableUploads)) { $uploadStatus["errors"] = [wfMessage('themedesigner-upload-disabled')->plain()]; } else { $upload->initializeFromRequest($wgRequest); $permErrors = $upload->verifyPermissions($wgUser); if ($permErrors !== true) { $uploadStatus["errors"] = array(wfMsg('badaccess')); } else { $details = $upload->verifyUpload(); if ($details['status'] != UploadBase::OK) { $uploadStatus["errors"] = array($this->getUploadErrorMessage($details)); } else { $warnings = $upload->checkWarnings(); if (!empty($warnings)) { $uploadStatus["errors"] = $this->getUploadWarningMessages($warnings); } else { //save temp file $status = $upload->performUpload(); $uploadStatus["status"] = "uploadattempted"; $uploadStatus["isGood"] = $status->isGood(); } } } } return $uploadStatus; }