Example #1
0
 /**
  * Main upgrade process
  * 
  * @return Aitoc_Aitsys_Model_Module_License_Upgrade
  */
 public function upgrade()
 {
     if ($this->canUpgrade()) {
         // without this check could lead to crash while saving new license xml files
         if (!$this->_checkLicensesFilesPermissions()) {
             throw new Aitoc_Aitsys_Model_License_Service_Exception("<strong>Please set writable permissions for the following files before upgrade:</strong><br />" . implode('<br />', $this->_failedFiles) . '<br />' . "<strong>You can set permissions back for these files after upgrade.</strong>");
         }
         $upgrade = array('upgrade_purchaseid' => $this->getPurchaseId(), 'purchaseid' => $this->_license->getPurchaseId());
         $service = $this->_license->getService();
         $service->connect();
         $service->upgradeLicense($upgrade);
         $service->disconnect();
         $installXML = simplexml_load_file($this->_getInstallPath());
         $upgradeXML = simplexml_load_file($this->_getUpgradePath());
         $installXML->serial = (string) $upgradeXML->serial;
         $installXML->product['license_id'] = (string) $upgradeXML->product['license_id'];
         foreach ($upgradeXML->constraint->children() as $child) {
             $installXML->constraint->{$child->getName()} = (string) $child;
         }
         foreach ($this->_getInstallPaths() as $installPath) {
             $installXML->asXML($installPath);
         }
         $this->_removeUpgradeXMLs();
         $this->getModule()->reset();
     } else {
         throw new Aitoc_Aitsys_Model_License_Service_Exception("Can`t upgrade to this license!");
     }
     return $this;
 }
Example #2
0
 /**
  * 
  * @return Aitoc_Aitsys_Helper_License
  */
 protected function _addInstallAction()
 {
     if ($this->_license->isUninstalled()) {
         $this->_actions[] = array('url' => array('path' => 'aitsys/license/manage', 'args' => array('modulekey' => $this->_license->getKey())), 'title' => $this->__('Install'));
     } elseif ($this->_license->isInstalled()) {
         $this->_actions[] = array('url' => array('path' => 'aitsys/license/manage', 'args' => array('modulekey' => $this->_license->getKey())), 'title' => $this->__('Manage'));
     }
     return $this;
 }
Example #3
0
 /**
  * 
  * @param $args
  * @return Aitoc_Aitsys_Model_License_Service
  */
 protected function _updateArgs(&$args)
 {
     $platform = $this->tool()->platform();
     if (!isset($args[0]) || !is_array($args[0])) {
         $args[0] = array();
     }
     $args[0]['platform_version'] = $platform->getVersion();
     $args[0]['is_test'] = $platform->isTestMode();
     $args[0]['magento_version'] = Mage::getVersion();
     /*
     try
     {
         $args[0]['base_url'] = Mage::getBaseUrl();
     }
     catch (Mage_Core_Model_Store_Exception $exc)
     {
         $args[0]['base_url'] = Mage::app()->getStore(0)->getBaseUrl();
     }
     */
     $args[0]['base_url'] = $this->tool()->getRealBaseUrl(false);
     if (!isset($args[0]['domain']) || !$args[0]['domain'] || $args[0]['domain'] === '') {
         $args[0]['domain'] = $this->tool()->getRealBaseUrl();
     }
     $args[0]['platform_path'] = $this->tool()->platform()->getInstallDir(true);
     $args[0]['server_info'] = Mage::helper('aitsys/statistics')->getServerInfo();
     if ($platformId = $platform->getPlatformId()) {
         $args[0]['platformid'] = $platformId;
     }
     if ($this->_license) {
         $args[0]['module_key'] = $this->_license->getKey();
         $args[0]['link_id'] = $this->_license->getLinkId();
         $args[0]['module_version'] = $this->_license->getModule()->getVersion();
         if (!isset($args[0]['purchaseid'])) {
             $args[0]['purchaseid'] = $this->_license->getPurchaseId();
         }
     }
     return $this;
 }
Example #4
0
 /**
  * 
  * @return Aitoc_Aitsys_Model_Module_License_Upgrade
  */
 public function upgrade()
 {
     if ($this->canUpgrade()) {
         $upgrade = array('upgrade_purchaseid' => $this->getPurchaseId(), 'purchaseid' => $this->_license->getPurchaseId());
         $service = $this->_license->getService();
         $service->connect();
         $service->upgradeLicense($upgrade);
         $service->disconnect();
         $installXML = simplexml_load_file($this->_getInstallPath());
         $upgradeXML = simplexml_load_file($this->_getUpgradePath());
         $installXML->serial = (string) $upgradeXML->serial;
         $installXML->product['license_id'] = (string) $upgradeXML->product['license_id'];
         foreach ($upgradeXML->constraint->children() as $child) {
             $installXML->constraint->{$child->getName()} = (string) $child;
         }
         $installXML->asXML($this->_getInstallPath());
         $this->tool()->filesystem()->rmFile($this->_getUpgradePath());
         $this->getModule()->reset();
     } else {
         throw new Aitoc_Aitsys_Model_License_Service_Exception("Can`t upgrade to this license!");
     }
     return $this;
 }
Example #5
0
 /**
  * 
  * @return Aitoc_Aitsys_Helper_License
  */
 protected function _addManualInstallAction()
 {
     $this->_actions[] = array('url' => array('path' => 'aitsys/license/manualInstall', 'args' => array('modulekey' => $this->_license->getKey())), 'title' => $this->__('Manual Install'));
     return $this;
 }