Beispiel #1
0
 /**
  * Fetch the job file from the server
  *
  * @return bool|JError True on Success or false|JError if something goes wrong.
  */
 public function fetchJobFromServer()
 {
     $config = JFactory::getConfig();
     $tmpPath = $config->get('tmp_path');
     $filename = $this->getFileName();
     /* @var $zipAdapter JArchiveZip */
     $zipAdapter = JArchive::getAdapter('zip');
     $fullPath = JPATH_ROOT . '/tmp/' . $filename . '.json.zip';
     // Check if the file has been downloaded properly
     if (!NenoHelperApi::getJobFile($this->id, $fullPath)) {
         return false;
     }
     try {
         return $zipAdapter->extract($fullPath, $tmpPath . '/' . $filename . '.json');
     } catch (RuntimeException $e) {
         NenoLog::log($e->getMessage(), NenoLog::PRIORITY_ERROR, true);
         return false;
     }
 }