Exemple #1
0
 /**
  * Handle the mediawiki file upload process
  * @return boolean status of file "upload"
  */
 public function run()
 {
     global $wgOut;
     $mUpload = new UploadFromFile();
     wfDebug("QrCodeDebug::" . $this->_dstFileName . " " . $this->_tmpName . "\n");
     // $mUpload->initialize( $this->_dstFileName, $this->_tmpName, null );	// pre 1.17
     $mUpload->initializePathInfo($this->_dstFileName, $this->_tmpName, null);
     // we don't know the filesize, how could we?
     wfDebug("QrCodeDebug:: Intialization finished\n");
     $pageText = 'QrCode ' . $this->_dstFileName . ', generated on ' . date("r") . ' by the QrCode Extension for page [[' . $this->title->getFullText() . ']].';
     wfDebug('QrCodeJob::run: Uploading qrcode, c: ' . $this->_uploadComment . ' t: ' . $pageText . "\n");
     $status = $mUpload->performUpload($this->_uploadComment, $pageText, false, $this->_getBot());
     if ($status->isGood()) {
         return true;
     } else {
         $wgOut->addWikiText($status->getWikiText());
         return false;
     }
 }