function backup_migrate_source_db_mysql::sources in Backup and Migrate 6.3
Same name and namespace in other branches
- 8.3 includes/sources.db.mysql.inc \backup_migrate_source_db_mysql::sources()
- 7.3 includes/sources.db.mysql.inc \backup_migrate_source_db_mysql::sources()
Declare any mysql databases defined in the settings.php file as a possible source.
File
- includes/
sources.db.mysql.inc, line 52 - Functions to handle the direct to database source.
Class
- backup_migrate_source_db_mysql
- A source type for backing up from database server.
Code
function sources() {
$out = array();
$urls = is_array($GLOBALS['db_url']) ? $GLOBALS['db_url'] : array(
'default' => $GLOBALS['db_url'],
);
foreach ((array) $urls as $key => $url) {
// Only mysql/mysqli supported by this source.
if (strpos($url, 'mysql') === 0) {
if ($source = backup_migrate_create_source('mysql', array(
'url' => $url,
'show_in_list' => TRUE,
))) {
// Treat the default database differently because it is probably the only one available.
if ($key == 'default') {
$source
->set_id('db');
$source
->set_name(t('Default Database'));
// Dissalow backing up to the default database because that's confusing and potentially dangerous.
$source
->remove_op('scheduled backup');
$source
->remove_op('manual backup');
}
else {
$source
->set_id('db:' . $key);
$source
->set_name($source
->get_display_location());
}
$out[$source
->get_id()] = $source;
}
}
}
return $out;
}