function action_install($eventData)
{
    global $gLocale, $gLocale, $gStatus;
    if (strcmp($eventData['applicationfile']['tmp_name'], 'none') != 0) {
        $tempApplication = new \Innomatic\Application\Application(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess(), '');
        move_uploaded_file($eventData['applicationfile']['tmp_name'], \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/temp/' . $eventData['applicationfile']['name']);
        if (!$tempApplication->Install(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/temp/' . $eventData['applicationfile']['name'])) {
            $unmetDeps = $tempApplication->getLastActionUnmetDeps();
            $unmetDepsStr = '';
            while (list($key, $val) = each($unmetDeps)) {
                $unmetDepsStr .= ' ' . $val;
            }
            $gStatus = $gLocale->getStr('unmetdeps_status') . $unmetDepsStr;
        } else {
            $gStatus = $gLocale->getStr('appinstalled_status');
        }
        $unmetSuggs = $tempApplication->getLastActionUnmetSuggs();
        $unmetSuggsStr = '';
        while (list($key, $val) = each($unmetSuggs)) {
            $unmetSuggsStr .= ' ' . $val;
        }
        if (strlen($unmetSuggsStr)) {
            $gStatus .= $gLocale->getStr('unmetsuggs_status') . $unmetSuggsStr;
        }
    }
}
示例#2
0
 public function enableApplication($appid)
 {
     $result = false;
     $hook = new \Innomatic\Process\Hook($this->rootda, 'innomatic', 'domain.application.enable');
     if ($hook->callHooks('calltime', $this, array('domainserial' => $this->domainserial, 'appid' => $appid)) == \Innomatic\Process\Hook::RESULT_OK) {
         if (!empty($this->dataAccess) and !empty($appid) and !$this->isApplicationEnabled($appid)) {
             $modquery = $this->rootda->execute('SELECT appid FROM applications WHERE id=' . (int) $appid);
             $tmpmod = new \Innomatic\Application\Application($this->rootda, $appid);
             $this->container->setCurrentDomain($this);
             if ($tmpmod->Enable($this->domainserial)) {
                 if ($hook->callHooks('applicationenabled', $this, array('domainserial' => $this->domainserial, 'appid' => $appid)) == \Innomatic\Process\Hook::RESULT_OK) {
                     $result = true;
                 }
                 $log = $this->container->getLogger();
                 $log->logEvent($this->domainid, 'Enabled application ' . $modquery->getFields('appid'), \Innomatic\Logging\Logger::NOTICE);
                 $this->domainlog->logEvent($this->domainid, 'Enabled application ' . $modquery->getFields('appid'), \Innomatic\Logging\Logger::NOTICE);
             }
             $this->unmetdeps = $tmpmod->getLastActionUnmetDeps();
             $this->unmetsuggs = $tmpmod->getLastActionUnmetSuggs();
         } else {
             $log = $this->container->getLogger();
             if (empty($this->dataAccess)) {
                 $log->logEvent('innomatic.domains.domain.enableapplication', 'Invalid domain database handler', \Innomatic\Logging\Logger::ERROR);
             }
             if (empty($appid)) {
                 $log->logEvent('innomatic.domains.domain.enableapplication', 'Empty application id', \Innomatic\Logging\Logger::ERROR);
             }
             if ($this->isApplicationEnabled($appid)) {
                 $log->logEvent('innomatic.domains.domain.enableapplication', 'Innomatic already enabled to the domain', \Innomatic\Logging\Logger::ERROR);
             }
         }
     }
     return $result;
 }