You are here

class EntireSiteSourcePlugin in Backup and Migrate 8.4

Same name and namespace in other branches
  1. 5.0.x src/Plugin/BackupMigrateSource/EntireSiteSourcePlugin.php \Drupal\backup_migrate\Plugin\BackupMigrateSource\EntireSiteSourcePlugin

Defines an default database source plugin.

Plugin annotation


@BackupMigrateSourcePlugin(
  id = "EntireSite",
  title = @Translation("Entire Site"),
  description = @Translation("Back up the entire Drupal site."),
  locked = true
)

Hierarchy

Expanded class hierarchy of EntireSiteSourcePlugin

File

src/Plugin/BackupMigrateSource/EntireSiteSourcePlugin.php, line 21

Namespace

Drupal\backup_migrate\Plugin\BackupMigrateSource
View source
class EntireSiteSourcePlugin extends SourcePluginBase {
  protected $db_source;

  /**
   * Get the Backup and Migrate plugin object.
   *
   * @return BackupMigrate\Core\Plugin\PluginInterface;
   */
  public function getObject() {

    // Add the default database.
    $info = \Drupal\Core\Database\Database::getConnectionInfo('default', 'default');
    $info = $info['default'];
    if ($info['driver'] == 'mysql') {
      $conf = $this
        ->getConfig();
      $conf
        ->set('directory', DRUPAL_ROOT);
      $this->db_source = new DrupalMySQLiSource(new Config($info));
      return new DrupalSiteArchiveSource($conf, $this->db_source);
    }
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function alterBackupMigrate(BackupMigrateInterface $bam, $key, $options = []) {
    if ($source = $this
      ->getObject()) {
      $bam
        ->sources()
        ->add($key, $source);
      $bam
        ->sources()
        ->add('default_db', $this->db_source);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntireSiteSourcePlugin::$db_source protected property
EntireSiteSourcePlugin::alterBackupMigrate public function Alter the backup and migrate object to add the source and required services. Overrides SourcePluginBase::alterBackupMigrate
EntireSiteSourcePlugin::getObject public function Get the Backup and Migrate plugin object. Overrides WrapperPluginBase::getObject
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
WrapperPluginBase::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides DependentPluginInterface::calculateDependencies
WrapperPluginBase::defaultConfiguration public function Gets default configuration for this plugin. Overrides ConfigurablePluginInterface::defaultConfiguration
WrapperPluginBase::getConfig public function Return a Backup and Migrate Config object with the plugin configuration.
WrapperPluginBase::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurablePluginInterface::getConfiguration
WrapperPluginBase::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurablePluginInterface::setConfiguration
WrapperPluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct 1