Beispiel #1
0
 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();
         }
     }
 }
 protected function updateConfiguredVersion($sVersionTo)
 {
     # Create new settings
     $oConfig = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php");
     $oConfig->persist();
     # Update BAIKAL_CONFIGURED_VERSION
     $oConfig = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php");
     $oConfig->set("BAIKAL_CONFIGURED_VERSION", $sVersionTo);
     $oConfig->persist();
 }