/**
  * Executes update domain action.
  *
  * It should be called by update() method only. It should be redefined
  * by the extending class.
  *
  * @param string $domainid Domain identifier name
  * @param array $params Parameters in the component definition
  * @access public
  * @return void
  */
 public function doUpdateDomainAction($domainid, $params)
 {
     $domainQuery = $this->rootda->execute("SELECT domainid FROM domains WHERE id={$domainid}");
     if (!$domainQuery->getNumberRows()) {
         return false;
     }
     $domain = $domainQuery->getFields('domainid');
     $fileDestName = RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/conf/' . basename($params['file']);
     // Checks if the "keep" parameter is set to true.
     // If so, the configuration file will not be overwritten.
     if (isset($params['keep']) and $params['keep'] == true and file_exists($fileDestName)) {
         return true;
     }
     if (!file_exists(RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/conf/')) {
         DirectoryUtils::mkTree(RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/conf/', 0755);
     }
     if (!copy(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $this->appname . '/conf/' . basename($params['file']), $fileDestName)) {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 public function doUpdateDomainAction($domainid, $params)
 {
     $domainQuery = $this->rootda->execute("SELECT domainid FROM domains WHERE id={$domainid}");
     if (!$domainQuery->getNumberRows()) {
         return false;
     }
     $domain = $domainQuery->getFields('domainid');
     $fileDestName = RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/layouts/' . basename($params['file']);
     if (!file_exists(RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/layouts/')) {
         DirectoryUtils::mkTree(RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/layouts/', 0755);
     }
     if (!copy(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $this->appname . '/layouts/' . basename($params['file']), $fileDestName)) {
         return false;
     }
     return true;
 }