/** * Executes disable domain action. * * It should be called by disable() 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 doDisableDomainAction($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']); if (file_exists($fileDestName)) { return unlink($fileDestName); } else { return false; } }
/** * Executes a clean exit of the script. * * This method must be called by scripts when they end (eg. at the end of * the script or in cases where execution must be terminated before * script's end). * * Scripts must avoid terminating their execution with a direct call to PHP * exit() or die(). * * A clean exit tells Innomatic to properly shutdown and mark the process * as cleanly terminated. * * @param int $status Optional status code to be returned to the shell. * @static * @access public * @return void */ public static function cleanExit($status = 0) { RootContainer::instance('\\Innomatic\\Core\\RootContainer')->stop(); exit($status); }
/** * Tests RootContainer->stop() */ public function testStop() { $this->RootContainer->stop(); $this->assertTrue($this->RootContainer->isClean()); }
public function shutdown($exit = true) { if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_SETUP) { if (is_object($this->rootDb)) { $hook = new \Innomatic\Process\Hook($this->rootDb, 'innomatic', 'instance'); $null = ''; switch ($hook->callHooks('shutdown', $null, '')) { case \Innomatic\Process\Hook::RESULT_ABORT: $this->abort('Shutdown aborted'); break; } } } switch ($this->state) { case \Innomatic\Core\InnomaticContainer::STATE_DEBUG: if (is_object($this->loadTimer) and RootContainer::instance('\\Innomatic\\Core\\RootContainer')->isClean() == true) { $this->loadTimer->Mark('end'); $log = $this->getLogger(); $log->logEvent('innomatic', 'Profiler total time: ' . $this->loadTimer->getTotalTime(), \Innomatic\Logging\Logger::DEBUG); $fh = @fopen($this->home . 'core/temp/pids/' . $this->pid, 'w'); if ($fh) { $dump = \Innomatic\Debug\InnomaticDump::instance('\\Innomatic\\Debug\\InnomaticDump'); $dump->snapshot(); @fwrite($fh, serialize($dump)); @fclose($fh); } } break; } if (!RootContainer::instance('\\Innomatic\\Core\\RootContainer')->isClean()) { if (is_object($this->loadTimer)) { $this->loadTimer->Mark('end'); $log = $this->getLogger(); $log->logEvent('innomatic', 'Profiler total time: ' . $this->loadTimer->getTotalTime(), \Innomatic\Logging\Logger::DEBUG); } $fh = @fopen($this->home . 'core/temp/pids/' . $this->pid . '_coredump', 'w'); if ($fh) { $dump = \Innomatic\Debug\InnomaticDump::instance('\\Innomatic\\Debug\\InnomaticDump'); $dump->snapshot(); @fwrite($fh, serialize($dump)); @fclose($fh); } } if (!RootContainer::instance('\\Innomatic\\Core\\RootContainer')->isClean() or $this->state != \Innomatic\Core\InnomaticContainer::STATE_DEBUG and file_exists($this->home . 'core/temp/pids/' . $this->pid)) { @unlink($this->home . 'core/temp/pids/' . $this->pid); } if ($exit) { exit; } }
public function doDisableDomainAction($domainid, $params) { $domainQuery = $this->rootda->execute("SELECT domainid FROM domains WHERE id={$domainid}"); if (!$domainQuery->getNumberRows()) { return false; } $domain = $domainQuery->getFields('domainid'); $assetDestFolder = RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/assets/' . basename($params['asset']) . '/'; if (is_dir($assetDestFolder)) { return DirectoryUtils::unlinkTree($assetDestFolder); } else { return false; } }