public function DefaultDBSourcePlugin::getObject in Backup and Migrate 5.0.x
Same name and namespace in other branches
- 8.4 src/Plugin/BackupMigrateSource/DefaultDBSourcePlugin.php \Drupal\backup_migrate\Plugin\BackupMigrateSource\DefaultDBSourcePlugin::getObject()
Get the Backup and Migrate plugin object.
Return value
Drupal\backup_migrate\Core\Plugin\PluginInterface
Overrides WrapperPluginBase::getObject
1 call to DefaultDBSourcePlugin::getObject()
- DefaultDBSourcePlugin::alterBackupMigrate in src/
Plugin/ BackupMigrateSource/ DefaultDBSourcePlugin.php - Alter the backup_migrate object to add the source and required services.
File
- src/
Plugin/ BackupMigrateSource/ DefaultDBSourcePlugin.php, line 29
Class
- DefaultDBSourcePlugin
- Defines an default database source plugin.
Namespace
Drupal\backup_migrate\Plugin\BackupMigrateSourceCode
public function getObject() {
// Add the default database.
$info = Database::getConnectionInfo('default', 'default');
$info = $info['default'];
// Set a default port if none is set. Because that's what core does.
$info['port'] = empty($info['port']) ? 3306 : $info['port'];
if ($info['driver'] == 'mysql') {
$conf = $this
->getConfig();
foreach ($info as $key => $value) {
$conf
->set($key, $value);
}
return new DrupalMySQLiSource($conf);
}
return NULL;
}