BaikalAdmin\Controller\Install\Initialize::execute PHP Метод

execute() публичный Метод

# \Formal\Form
public execute ( )
    function execute()
    {
        # Assert that /Specific is writable
        if (!file_exists(PROJECT_PATH_SPECIFIC) || !is_dir(PROJECT_PATH_SPECIFIC) || !is_writable(PROJECT_PATH_SPECIFIC)) {
            $message = "<h1>Error - Insufficient  permissions on the <span style='background-color: yellow;'>Specific/</span> folder</h1><p>";
            $message .= "<p>In order to work properly, Baïkal needs to have write permissions in the <strong>Specific/</strong> folder.</p>";
            die($message);
        }
        $this->createHtaccessFilesIfNeeded();
        $this->oModel = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php");
        $this->oForm = $this->oModel->formForThisModelInstance(["close" => false]);
        if ($this->oForm->submitted()) {
            $this->oForm->execute();
            if ($this->oForm->persisted()) {
                # Creating system config, and initializing BAIKAL_ENCRYPTION_KEY
                $oSystemConfig = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php");
                $oSystemConfig->set("BAIKAL_ENCRYPTION_KEY", md5(microtime() . rand()));
                # Default: PDO::SQLite or PDO::MySQL ?
                $aPDODrivers = \PDO::getAvailableDrivers();
                if (!in_array('sqlite', $aPDODrivers)) {
                    # PDO::MySQL is already asserted in \Baikal\Core\Tools::assertEnvironmentIsOk()
                    $oSystemConfig->set("PROJECT_DB_MYSQL", true);
                }
                $oSystemConfig->persist();
            }
        }
    }