If we are in PHP CLI mode, then switch the Engine on/off in install mode.
In we are not in PHP CLI mode, this method does not have effect.
@param bool $mode If true then install mode is setted.
@throws ENabuCoreException
346479
public static function setInstallMode($mode)
    {
        if (self::isCLIEnvironment()) {
            if ($mode === true) {
                self::$install_mode = true;
            } else {
                if (self::$install_mode &&
                    self::$nb_engine !== null &&
                    self::$nb_engine->main_database === null
                ) {
                    self::$nb_engine->registerMainDatabase();
                }
                self::$install_mode = false;
            }
        } else {
            throw new ENabuCoreException(ENabuCoreException::ERROR_INSTALL_MODE_LOCKED);
        }
    }
824163
public function lock($mode = true)
    {
        $this->shouldLock = $mode;

        if (!$handle = $this->resource()) {
            return false;
        }

        return $this->applyLock($handle);

    }
144099
public function setLoggingMode($mode, $filename = NULL) {
		$this->logging_mode = $mode;
		$this->log_filename = $filename;
	}
532597
public function setCompression($mode)
    {
        switch ($mode) {
            case "gzip":
                $this->compression = "gz";
                break;
            case "bzip2":
                $this->compression = "bz2";
                break;
            case "lzma2":
                $this->compression = "lzma2";
                break;
            case "none":
                $this->compression = null;
                break;
            default:
                $this->log("Ignoring unknown compression mode: " . $mode, Project::MSG_WARN);
                $this->compression = null;
        }
    }
42473
public function set_true_no_break_narrow_space( $on = false ) {

		if ( $on ) {
			$this->no_break_narrow_space = U::NO_BREAK_NARROW_SPACE;
		} else {
			$this->no_break_narrow_space = U::NO_BREAK_SPACE;
		}
	}
1260379
public function setMode($mode)
    {
        $fs = FileSystem::getFileSystem();

        $fs->chmod($this->getPath(), $mode);
    }
427866
public static function isValid($mode)
    {
        switch (strtolower($mode)) {
        case self::AUTO:
        case self::MANUAL:
        return true;

        default:
        return false;
        }
    }
1107529
public function noReset($bool = false)
	{
		if (is_bool($bool)) {
			$this->noReset = $bool;
		} else {
			throw new RuntimeException('Invalid parameter type setted, expected boolean, got ' . gettype($bool));
		}
	}
744735
private function _setBeginning($bool)
    {
        if (!is_bool($bool)) {
            throw new Exception('$bool in not boolean');
        }
        if ($this->_beginning === $bool) {
            throw new Exception("Error begin or end.");
        }
        $this->_beginning = $bool;
    }
364288
public function setMode($mode)
    {
        if (!in_array($mode, [self::MODE_AND, self::MODE_OR])) {
            throw new InvalidArgumentException("Invalid mode $mode");
        }
        $this->mode = $mode;

        return $this;
    }
684774
public void setEnabled(boolean enabled) {
		if (enabled && engine == null) {
			return;
		}

		if (this.enabled != enabled) {
			this.enabled = enabled;
			this.changed = true;
		}
	}
109033
final public static function launch()
    {
        try {
            $nb_engine = CNabuEngine::getEngine();

            $class_name = get_called_class();
            $instance = new $class_name();
            if (!($instance instanceof CNabuHTTPStandaloneApplication)) {
                throw new ENabuCoreException(ENabuCoreException::ERROR_OPERATION_MODE_NOT_ALLOWED);
            }

            $instance->init();

            $nb_engine->getHTTPServer()
                      ->getSite()
                          ->setSmartyCachePath(NABU_CACHE_FOLDER)
                          ->setSmartyCompilePath(SMARTY_COMPILES_FOLDER)
                          ->setSmartyConfigsPath(SMARTY_CONFIG_FOLDER)
                          ->setSmartyTemplatePath(SMARTY_TEMPLATES_FOLDER)
            ;

            $retval = $instance->prepareEnvironment();

            /*
            $nb_engine->registerApplication($instance);
            $instance->prepareMediotecasManager();
            */

            $nb_engine->getHTTPServer()
                      ->getSite()
                          ->indexURLs()
                          ->indexSiteMaps()
                          ->indexStaticContents();

            if ($retval) {
                $retval = $instance->run();
            }

            $nb_engine->removeApplication();
        } catch (Throwable $re) {
            if (isset($instance)) {
                $instance->displayErrorPage(500, $re);
            }
            throw $re;
        } catch (Exception $re) {
            if (isset($instance)) {
                $instance->displayErrorPage(500, $re);
            }
            throw $re;
        }

        return $retval;
    }
1260193
public function set_messages_caching($set, $mode = null)
    {
        if ($set) {
            $this->messages_caching = true;

            if ($mode && ($cache = $this->get_mcache_engine())) {
                $cache->set_mode($mode);
            }
        }
        else {
            if ($this->mcache) {
                $this->mcache->close();
            }
            $this->mcache = null;
            $this->messages_caching = false;
        }
    }
1284862
private function runClustered()
    {
        $nb_server = CNabuServer::findByKey($this->server_key);
        if (!is_object($nb_server)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SERVER_NOT_FOUND, array($this->server_key, '*', '*'));
        }

        $apache_server = new CApacheHTTPServer($nb_server);

        if ($apache_server->locateApacheServer()) {
            $this->displayServerConfig($apache_server);
            $apache_server->createClusteredConfiguration();
        }
    }
595707
public function setSandboxMode($enable)
    {
        if ($enable instanceof SandBoxMode) {
            $sandbox_mode = $enable;
            $this->sandbox_mode = $sandbox_mode;
            return;
        }
        $this->sandbox_mode = new SandBoxMode($enable);
        return;
    }
29261
public function setEngine($engine)
    {
        if ($this->isValidEngine($engine)) {
            $this->engine =& $engine;

            return true;
        }

        return false;
    }
853863
final protected function setWriteMode($mode)
    {
        if (!in_array($mode, [static::WRITE_MODE_INSERT, static::WRITE_MODE_UPSERT, static::WRITE_MODE_UPDATE])) {
            throw new \InvalidArgumentException(sprintf('Passed write mode "%s" is invalid!', $mode));
        }
        $this->writeMode = $mode;
    }