public function DefaultDBSourcePlugin::getObject in Backup and Migrate 8.4
Same name and namespace in other branches
- 5.0.x src/Plugin/BackupMigrateSource/DefaultDBSourcePlugin.php \Drupal\backup_migrate\Plugin\BackupMigrateSource\DefaultDBSourcePlugin::getObject()
Get the Backup and Migrate plugin object.
Return value
BackupMigrate\Core\Plugin\PluginInterface;
Overrides WrapperPluginBase::getObject
1 call to DefaultDBSourcePlugin::getObject()
- DefaultDBSourcePlugin::alterBackupMigrate in src/
Plugin/ BackupMigrateSource/ DefaultDBSourcePlugin.php - Alter the backup and migrate object to add the source and required services.
File
- src/
Plugin/ BackupMigrateSource/ DefaultDBSourcePlugin.php, line 28
Class
- DefaultDBSourcePlugin
- Defines an default database source plugin.
Namespace
Drupal\backup_migrate\Plugin\BackupMigrateSourceCode
public function getObject() {
// Add the default database.
$info = \Drupal\Core\Database\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;
}