1
0
Fork 0

Updated file refresh_dblist.

Dieser Commit ist enthalten in:
dsb 2015-05-24 14:23:15 +02:00
Ursprung a15ca02189
Commit d9b5665f63
2 geänderte Dateien mit 658 neuen und 612 gelöschten Zeilen

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -10,32 +10,28 @@ $verbose = true;
* Build exclude array with configuration files that should be skipped * Build exclude array with configuration files that should be skipped
*/ */
$excludedConfigurationFiles = array( $excludedConfigurationFiles = array(
'mysqldumper', //'mysqldumper',
//add more excluded files via: 'configFileName', //add more excluded files by adding their name
); );
$myNl = '<br />';
$verbose = true; $verbose = true;
if (isset ($_SERVER['SESSIONNAME'])) { if (PHP_SAPI === 'cli' || empty($_SERVER['REMOTE_ADDR'])) {
// called via cli - check verbose param // called via cli - check verbose param
$myNl = "\n"; define('NEWLINE', "\n");
$options = getopt('v::', array('verbose::')); $options = getopt('v::', array('verbose::'));
if (isset($options['v'])) { $verbose = isset($options['verbose']) || isset($options['v']) ? true : false;
$verbose = $options['v']; } else {
} define('NEWLINE', '<br />');
if (isset($options['verbose'])) {
$verbose = $options['verbose'];
}
} }
date_default_timezone_set('Europe/Berlin'); date_default_timezone_set('Europe/Berlin');
define('APPLICATION_PATH', realpath(dirname(__FILE__))); define('APPLICATION_PATH', __DIR__);
chdir(APPLICATION_PATH); chdir(APPLICATION_PATH);
include (APPLICATION_PATH . '/inc/functions.php'); include(APPLICATION_PATH . '/inc/functions.php');
include (APPLICATION_PATH . '/inc/mysql.php'); include(APPLICATION_PATH . '/inc/mysql.php');
include ('language/en/lang.php'); include('language/en/lang.php');
// load default configuration // load default configuration
include ('work/config/mysqldumper.php'); include('work/config/mysqldumper.php');
GetLanguageArray(); GetLanguageArray();
$configFiles = get_config_filenames(); $configFiles = get_config_filenames();
@ -43,18 +39,26 @@ foreach ($configFiles as $configFile) {
if (in_array($configFile, $excludedConfigurationFiles)) { if (in_array($configFile, $excludedConfigurationFiles)) {
continue; continue;
} }
if ($verbose) { output('Refreshing database list for configuration file: ' . $configFile, $verbose);
echo 'Refreshing database list for configuration file: ' . $configFile . $myNl;
}
$config['config_file'] = $configFile; $config['config_file'] = $configFile;
include ($config['paths']['config'] . $configFile . '.php'); include($config['paths']['config'] . $configFile . '.php');
$out = ''; $out = '';
if (isset($config['dbconnection']) && is_resource($config['dbconnection'])) { if (isset($config['dbconnection']) && is_resource($config['dbconnection'])) {
mysql_close($config['dbconnection']); mysql_close($config['dbconnection']);
$config['dbconnection'] = false; $config['dbconnection'] = false;
} }
SetDefault(); SetDefault();
if ($verbose) { output($out, $verbose);
echo str_replace("\n", $myNl, $out) . $myNl;
}
} }
/**
* @param string $message
* @param boolean $verbose
*/
function output($message, $verbose)
{
if ($verbose) {
$message = str_replace("\n", NEWLINE, $message);
echo $message . NEWLINE;
}
}