Пример #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;
 }
Пример #2
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;
 }