Esempio n. 1
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!file_exists($this->filename) || strpos($this->filename, '.yml') === false) {
         die('0');
     }
     $db = new \fpcm\classes\database(false, true);
     if ($db->execYaTdl($this->filename)) {
         die('1');
     }
     die('0');
 }
Esempio n. 2
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     $databaseInfo = $this->getRequestVar('dbdata');
     try {
         $db = new \fpcm\classes\database($databaseInfo);
     } catch (\PDOException $exc) {
         trigger_error($exc->getMessage());
         die('0');
     }
     if (!$db->checkDbVersion()) {
         trigger_error('Unsupported database system detected. Installed version is ' . $db->getDbVersion() . ', FanPress CM requires version ' . $db->getRecommendVersion());
         die('0');
     }
     include_once \fpcm\classes\baseconfig::$configDir . '/database.php.sample';
     foreach ($databaseInfo as $key => $value) {
         $config[$key] = $value;
     }
     $content = array();
     $content[] = '<?php';
     $content[] = '/**';
     $content[] = ' * FanPress CM databse connection configuration file';
     $content[] = ' * Only edit this file, if you know what you are doing!!!';
     $content[] = ' *';
     $content[] = ' * DBTYPE => databse type, mysql support only so far';
     $content[] = ' * DBHOST => mostly localhost, modify this if you use a different name';
     $content[] = ' * DBNAME => the database to connect to';
     $content[] = ' * DBUSER => user to connect to database';
     $content[] = ' * DBPASS => the users password to connect to database';
     $content[] = ' * DBPREF => table prefix';
     $content[] = ' *';
     $content[] = ' */';
     $content[] = '$config = ' . var_export($config, true) . ';';
     $content[] = '?>';
     file_put_contents(\fpcm\classes\baseconfig::$configDir . '/database.php', implode(PHP_EOL, $content));
     die('1');
 }