예제 #1
0
 public function process()
 {
     $this->package->fromArray($this->getProperties());
     if (!$this->package->save()) {
         return $this->failure($this->modx->lexicon('package_err_save'));
     }
     $this->logManagerAction();
     return $this->success('', $this->package);
 }
예제 #2
0
 /**
  * Run the processor, downloading and transferring the package, and creating the metadata in the database
  * {@inheritDoc}
  * @return mixed
  */
 public function process()
 {
     if (!$this->loadProvider()) {
         return $this->failure($this->modx->lexicon('provider_err_nf'));
     }
     if (!$this->provider->getClient()) {
         return $this->failure($this->modx->lexicon('provider_err_no_client'));
     }
     $this->getTransportPackage();
     $metaLoaded = $this->getPackageMetadata();
     if ($metaLoaded !== true) {
         return $this->failure($metaLoaded);
     }
     $this->setPackageVersionData();
     $url = $this->getFileDownloadUrl();
     if (!is_string($url)) {
         return $url;
     }
     if (!$this->downloadPackage($url)) {
         $msg = $this->modx->lexicon('package_download_err', array('location' => $url));
         $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
         return $this->failure($msg);
     }
     if (!$this->package->save()) {
         $msg = $this->modx->lexicon('package_download_err_create', array('signature' => $this->signature));
         $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
         return $this->failure($msg);
     }
     $this->package->getTransport();
     return $this->success('', $this->package);
 }