本文整理汇总了PHP中Dba::reset_db_charset方法的典型用法代码示例。如果您正苦于以下问题:PHP Dba::reset_db_charset方法的具体用法?PHP Dba::reset_db_charset怎么用?PHP Dba::reset_db_charset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dba
的用法示例。
在下文中一共展示了Dba::reset_db_charset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_update
/**
* run_update
* This function actually updates the db.
* it goes through versions and finds the ones
* that need to be run. Checking to make sure
* the function exists first.
*/
public static function run_update()
{
/* Nuke All Active session before we start the mojo */
$sql = "TRUNCATE session";
Dba::write($sql);
// Prevent the script from timing out, which could be bad
set_time_limit(0);
$current_version = self::get_version();
// Run a check to make sure that they don't try to upgrade from a version that
// won't work.
if ($current_version < '340002') {
echo "<p align=\"center\">Database version too old, please upgrade to <a href=\"http://ampache.org/downloads/ampache-3.3.3.5.tar.gz\">Ampache-3.3.3.5</a> first</p>";
return false;
}
$methods = get_class_methods('Update');
if (!is_array(self::$versions)) {
self::$versions = self::populate_version();
}
foreach (self::$versions as $version) {
// If it's newer than our current version let's see if a function
// exists and run the bugger.
if ($version['version'] > $current_version) {
$update_function = "update_" . $version['version'];
if (in_array($update_function, $methods)) {
$success = call_user_func(array('Update', $update_function));
// If the update fails drop out
if ($success) {
self::set_version('db_version', $version['version']);
} else {
AmpError::display('update');
return false;
}
}
}
}
// end foreach version
// Once we've run all of the updates let's re-sync the character set as
// the user can change this between updates and cause mis-matches on any
// new tables.
Dba::reset_db_charset();
// Let's also clean up the preferences unconditionally
User::rebuild_all_preferences();
}
示例2: 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();