public function run() { # Initialize this object and the upload object $this->upload = new UploadFromUrl(); $this->upload->initialize($this->title->getText(), $this->params['url'], false); $this->user = User::newFromName($this->params['userName']); # Fetch the file $status = $this->upload->fetchFile(); if (!$status->isOk()) { $this->leaveMessage($status); return true; } # Verify upload $result = $this->upload->verifyUpload(); if ($result['status'] != UploadBase::OK) { $status = $this->upload->convertVerifyErrorToStatus($result); $this->leaveMessage($status); return true; } # Check warnings if (!$this->params['ignoreWarnings']) { $warnings = $this->upload->checkWarnings(); if ($warnings) { wfSetupSession($this->params['sessionId']); if ($this->params['leaveMessage']) { $this->user->leaveUserMessage(wfMsg('upload-warning-subj'), wfMsg('upload-warning-msg', $this->params['sessionKey'], $this->params['url'])); } else { $this->storeResultInSession('Warning', 'warnings', $warnings); } # Stash the upload in the session $this->upload->stashSession($this->params['sessionKey']); session_write_close(); return true; } } # Perform the upload $status = $this->upload->performUpload($this->params['comment'], $this->params['pageText'], $this->params['watch'], $this->user); $this->leaveMessage($status); return true; }