You are here

class DrupalFilesSourcePlugin in Backup and Migrate 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Plugin/BackupMigrateSource/DrupalFilesSourcePlugin.php \Drupal\backup_migrate\Plugin\BackupMigrateSource\DrupalFilesSourcePlugin

Defines an default database source plugin.

Plugin annotation


@BackupMigrateSourcePlugin(
  id = "DrupalFiles",
  title = @Translation("Public Files"),
  description = @Translation("Back up the Drupal public files."),
  wrapped_class = "\Drupal\backup_migrate\Core\Source\FileDirectorySource",
  locked = true
)

Hierarchy

Expanded class hierarchy of DrupalFilesSourcePlugin

File

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

Namespace

Drupal\backup_migrate\Plugin\BackupMigrateSource
View source
class DrupalFilesSourcePlugin extends SourcePluginBase {

  /**
   * {@inheritdoc}
   */
  public function alterBackupMigrate(BackupMigrateInterface $bam, $key, array $options = []) {
    $source = $this
      ->getObject();
    $bam
      ->sources()
      ->add($key, $source);
    $config = [
      'exclude_filepaths' => [],
      'source' => $source,
    ];
    switch ($this
      ->getConfig()
      ->get('directory')) {
      case 'public://':
        $config['exclude_filepaths'] = [
          'js',
          'css',
          'php',
          'styles',
          'config_*',
          '.htaccess',
        ];
        break;
      case 'private://':
        $config['exclude_filepaths'] = [
          'backup_migrate',
        ];
        break;
    }

    // @todo Allow modules to add their own excluded defaults.
    $bam
      ->plugins()
      ->add($key . '_exclude', new FileExcludeFilter(new Config($config)));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalFilesSourcePlugin::alterBackupMigrate public function Alter the backup_migrate object to add the source and required services. Overrides SourcePluginBase::alterBackupMigrate
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 2
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 ConfigurableInterface::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 ConfigurableInterface::getConfiguration
WrapperPluginBase::getObject public function Get the Backup and Migrate plugin object. 2
WrapperPluginBase::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurableInterface::setConfiguration
WrapperPluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct