コード例 #1
0
 public function initialize()
 {
     $signature = $this->getProperty('signature');
     $this->package = $this->modx->getObject('transport.modTransportPackage', $signature);
     if (empty($this->package)) {
         $msg = $this->modx->lexicon('package_err_nf');
         $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
         return $msg;
     }
     $this->package->parseSignature();
     if ($this->package->provider != 0) {
         /* if package has a provider */
         $this->provider = $this->package->getOne('Provider');
         if (empty($this->provider)) {
             $msg = $this->modx->lexicon('provider_err_nf');
             $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
             return $msg;
         }
     } else {
         /* if no provider, indicate it is up to date */
         $msg = $this->modx->lexicon('package_err_uptodate', array('signature' => $this->package->get('signature')));
         $this->modx->log(modX::LOG_LEVEL_INFO, $msg);
         return $msg;
     }
     return parent::initialize();
 }