Example #1
0
	/**
	 * Leave a message on the user talk page or in the session according to
	 * $params['leaveMessage'].
	 *
	 * @param $status Status
	 */
	protected function leaveMessage( $status ) {
		if ( $this->params['leaveMessage'] ) {
			if ( $status->isGood() ) {
				$this->user->leaveUserMessage( wfMessage( 'upload-success-subj' )->text(),
					wfMessage( 'upload-success-msg',
						$this->upload->getTitle()->getText(),
						$this->params['url']
					)->text() );
			} else {
				$this->user->leaveUserMessage( wfMessage( 'upload-failure-subj' )->text(),
					wfMessage( 'upload-failure-msg',
						$status->getWikiText(),
						$this->params['url']
					)->text() );
			}
		} else {
			wfSetupSession( $this->params['sessionId'] );
			if ( $status->isOk() ) {
				$this->storeResultInSession( 'Success',
					'filename', $this->upload->getLocalFile()->getName() );
			} else {
				$this->storeResultInSession( 'Failure',
					'errors', $status->getErrorsArray() );
			}
			session_write_close();
		}
	}
Example #2
0
 /**
  * Leave a message on the user talk page or in the session according to
  * $params['leaveMessage'].
  *
  * @param Status $status
  */
 protected function leaveMessage($status)
 {
     if ($this->params['leaveMessage']) {
         if ($status->isGood()) {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-success-subj')->text(), wfMessage('upload-success-msg', $this->upload->getTitle()->getText(), $this->params['url'])->text());
         } else {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-failure-subj')->text(), wfMessage('upload-failure-msg', $status->getWikiText(), $this->params['url'])->text());
         }
     } else {
         $session = MediaWiki\Session\SessionManager::singleton()->getSessionById($this->params['sessionId']);
         if ($status->isOk()) {
             $this->storeResultInSession($session, 'Success', 'filename', $this->upload->getLocalFile()->getName());
         } else {
             $this->storeResultInSession($session, 'Failure', 'errors', $status->getErrorsArray());
         }
     }
 }