本文整理汇总了PHP中AmpConfig::get_all方法的典型用法代码示例。如果您正苦于以下问题:PHP AmpConfig::get_all方法的具体用法?PHP AmpConfig::get_all怎么用?PHP AmpConfig::get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmpConfig
的用法示例。
在下文中一共展示了AmpConfig::get_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
UI::show_header();
/* Switch on action boys */
switch ($_REQUEST['action']) {
/* This re-generates the config file comparing
* /config/ampache.cfg to .cfg.dist
*/
case 'generate_config':
ob_end_clean();
$current = parse_ini_file(AmpConfig::get('prefix') . '/config/ampache.cfg.php');
$final = generate_config($current);
$browser = new Horde_Browser();
$browser->downloadHeaders('ampache.cfg.php', 'text/plain', false, filesize(AmpConfig::get('prefix') . '/config/ampache.cfg.php.dist'));
echo $final;
exit;
case 'reset_db_charset':
Dba::reset_db_charset();
show_confirmation(T_('Database Charset Updated'), T_('Your Database and associated tables have been updated to match your currently configured charset'), AmpConfig::get('web_path') . '/admin/system.php?action=show_debug');
break;
case 'show_debug':
$configuration = AmpConfig::get_all();
if ($_REQUEST['autoupdate'] == 'force') {
$version = AutoUpdate::get_latest_version(true);
}
require_once AmpConfig::get('prefix') . '/templates/show_debug.inc.php';
break;
default:
// Rien a faire
break;
}
// end switch
UI::show_footer();
示例2: install_create_config
/**
* install_create_config
*
* Attempts to write out the config file or offer it as a download.
*/
function install_create_config($download = false)
{
$config_file = AmpConfig::get('prefix') . '/config/ampache.cfg.php';
/* Attempt to make DB connection */
Dba::dbh();
$params = AmpConfig::get_all();
if (empty($params['database_username']) || empty($params['database_password']) && strpos($params['database_hostname'], '/') !== 0) {
Error::add('general', T_("Invalid configuration settings"));
return false;
}
// Connect to the DB
if (!Dba::check_database()) {
Error::add('general', T_("Database Connection Failed Check Hostname, Username and Password"));
return false;
}
$final = generate_config($params);
// Make sure the directory is writable OR the empty config file is
if (!$download) {
if (!check_config_writable()) {
Error::add('general', T_('Config file is not writable'));
return false;
} else {
// Given that $final is > 0, we can ignore lazy comparison problems
if (!file_put_contents($config_file, $final)) {
Error::add('general', T_('Error writing config file'));
return false;
}
}
} else {
$browser = new Horde_Browser();
$browser->downloadHeaders('ampache.cfg.php', 'text/plain', false, strlen($final));
echo $final;
exit;
}
return true;
}