public static function init() { date_default_timezone_set('Europe/Moscow'); DBConfig::setDBSettingsObj(AuthConstants::DB_NAME_PHPAUTH, new DBSettings('localhost', 'db_phpauthdemo', 'root', '1')); CacheConfig::addServerSettingsObj(new MemcacheServerSettings('localhost', 11211)); AuthConfig::setExtraCookiesArr(['ignore_nginx_cache' => 1]); AuthConfig::setAdminActionsBaseClassname(AdminDemoActionsBase::class); LayoutsConfig::setAdminLayoutClassName(LayoutBootstrap::class); // AuthConfig::setUserEventClass(UserEvents::class); //AuthConfig::setFullAccessCookieName('php_auth'); /* $conf['return_false_if_no_route'] = true; // for local php server $conf['php-bt'] = [ 'menu_classes_arr' => [ \OLOG\Auth\Admin\AuthAdminMenu::class ], 'application_title' => 'Auth demo' ]; $conf['php_auth'] = [ 'full_access_cookie_name' => 'jkhbsdfhjvkdfvjgvasdc' ]; return $conf; */ }
public static function chooseModelDBIndex() { echo CliUtil::delimiter(); echo "Choose model DB index:\n"; //$db_arr = \OLOG\ConfWrapper::value(\OLOG\Model\ModelConstants::MODULE_CONFIG_ROOT_KEY . '.db'); // TODO: check not empty $db_arr = DBConfig::getDBSettingsObjArr(); Assert::assert(count($db_arr) > 0, 'No database settings found in config'); // TODO: select db by index $db_id_by_index = []; $index = 1; foreach ($db_arr as $db_id => $db_settings_obj) { echo "\t" . str_pad($index, 8, '.') . $db_id . "\n"; $db_id_by_index[$index] = $db_id; $index++; } $model_db_index = CliUtil::readStdinAnswer(); if (!array_key_exists($model_db_index, $db_id_by_index)) { throw new \Exception('Wrong index'); } self::$model_db_id = $db_id_by_index[$model_db_index]; // TODO: check db presence in config? self::generateClass(); }
public static function init() { date_default_timezone_set('Europe/Moscow'); //$conf['return_false_if_no_route'] = true; // for local php server DBConfig::setDBSettingsObj(self::DB_NAME_PHPCRUDDEMO, new DBSettings('localhost', 'phpcrud', 'root', '1')); }
public static function init() { DBConfig::setDBSettingsObj(self::DB_NAME_PHPMODELDEMO, new DBSettings('localhost', 'phpmodel', 'root', '1')); CacheConfig::addServerSettingsObj(new MemcacheServerSettings('localhost', 11211)); }
public static function getSqlFileNameForDB($db_name) { // TODO: open file in current project root $cwd = getcwd(); $filename = $cwd . DIRECTORY_SEPARATOR . $db_name . '.sql'; //$db_config_sql_file = $db_arr = \OLOG\ConfWrapper::value(\OLOG\Model\ModelConstants::MODULE_CONFIG_ROOT_KEY . '.db.' . $db_name . '.sql_file', ''); $db_settings_obj = DBConfig::getDBSettingsObj($db_name); $db_config_sql_file = $db_settings_obj->getSqlFilePathInProjectRoot(); if ($db_config_sql_file) { $filename = $cwd . DIRECTORY_SEPARATOR . $db_config_sql_file; } return $filename; }