コード例 #1
0
ファイル: Installer.php プロジェクト: mpf-soft/mpf
 public static function baseAppWithSQL()
 {
     if ('n' == Helper::get()->input("Execute initial setup? (creates db, config file, changes user password salt)", 'y')) {
         return;
     }
     self::$APP_CONFIG_DIR = dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR;
     echo "Config folder " . self::$APP_CONFIG_DIR . '.. \\n';
     echo "updating htdocs rights..   ";
     chmod(dirname(dirname(self::$APP_CONFIG_DIR)) . DIRECTORY_SEPARATOR . 'htdocs' . DIRECTORY_SEPARATOR . '__assets', '0777');
     echo "done\n";
     $conf = SQL::loadConfig();
     self::$data['mpf\\datasources\\sql\\PDOConnection'] = ['dns' => "{$conf[0]}:dbname={$conf[2]};host={$conf[1]}", 'username' => $conf[3], 'password' => $conf[4]];
     self::$data['mpf\\base\\App']['title'] = Helper::get()->input("App Long Title", 'New MPF App');
     self::$data['mpf\\base\\App']['shortTitle'] = Helper::get()->input("App Short Name", 'app');
     if (SQL::$connected) {
         echo "\n" . Helper::get()->startAction("importing DB from file..");
         SQL::importFromFile(self::$APP_CONFIG_DIR . '__db_' . $conf[0] . '.sql');
         echo Helper::get()->endAction();
         self::createAdminUser();
     }
     if ('y' == Helper::get()->input("Use redis cache?", 'y')) {
         self::$data['mpf\\base\\App']['cacheEngineClass'] = '\\mpf\\datasources\\redis\\Cache';
     }
     self::mailConfig();
     self::writeConfig();
 }
コード例 #2
0
ファイル: SQL.php プロジェクト: mpf-soft/mpf
 public static function loadConfig()
 {
     echo "\n" . Helper::get()->color("DB Config: ") . "\n";
     do {
         $type = Helper::get()->input("SQL DB Type", "mysql");
         $host = Helper::get()->input("SQL Host", "localhost");
         $name = Helper::get()->input("SQL Name", "");
         $user = Helper::get()->input("SQL User", "root");
         $pass = Helper::get()->input("SQL Pass", "");
     } while (!SQL::testConnection($type, $host, $name, $user, $pass));
     return [$type, $host, $name, $user, $pass];
 }