You are here

public static function ConfigBit::actionUnArchiveFiles in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8

Same name and namespace in other branches
  1. 8.4 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::actionUnArchiveFiles()
  2. 8.5 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::actionUnArchiveFiles()
  3. 8.6 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::actionUnArchiveFiles()
  4. 8.7 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::actionUnArchiveFiles()
  5. 9.0.x src/Config/ConfigBit.php \Drupal\varbase\Config\ConfigBit::actionUnArchiveFiles()

Apply the action of Un archive files to the given config bit file.

Parameters

string $config_bit_file_name: Config bit file name in the root configbit folder.

string $condition_name: Condition name in the config bit file.

string|bool $condition_value: Condition value for the condition name in the config bit file.

string $type: The type of profile.

string $project: The project.

File

src/Config/ConfigBit.php, line 728

Class

ConfigBit
Class ConfigBit.

Namespace

Drupal\varbase\Config

Code

public static function actionUnArchiveFiles($config_bit_file_name, $condition_name, $condition_value, $type = 'profile', $project = 'varbase') {
  $config_bit_data = ConfigBit::getConfigBit($config_bit_file_name, $type, $project);
  if (isset($config_bit_data['type']) && ($config_bit_data['type'] = 'action' && isset($config_bit_data['action']) && isset($config_bit_data['action']['unarchive_files']) && isset($config_bit_data['action']['unarchive_files']['when']) && isset($config_bit_data['action']['unarchive_files']['when'][$condition_name]) && $config_bit_data['action']['unarchive_files']['when'][$condition_name] == $condition_value && isset($config_bit_data['action']['unarchive_files']['files']))) {
    foreach ($config_bit_data['action']['unarchive_files']['files'] as $language_config_file) {
      $config_file = drupal_get_path($type, $project) . '/' . $language_config_file;
      $config_file_backup = $config_file . $config_bit_data['action']['unarchive_files']['archive_extensiton'];
      if (!file_exists($config_file) && file_exists($config_file_backup)) {
        \Drupal::service('file_system')
          ->move($config_file_backup, $config_file);
      }
    }
  }
}