You are here

protected static function ConfigurationManagement::deteleTempConfigDir in Configuration Management 7.2

1 call to ConfigurationManagement::deteleTempConfigDir()
ConfigurationManagement::importToActiveStoreFromTar in lib/Drupal/configuration/Config/ConfigurationManagement.php
Import configurations from a Tar file.

File

lib/Drupal/configuration/Config/ConfigurationManagement.php, line 797
Definition of Drupal\configuration\Config\ConfigurationManagement.

Class

ConfigurationManagement

Namespace

Drupal\configuration\Config

Code

protected static function deteleTempConfigDir($dir, $force = FALSE) {

  // Allow to delete symlinks even if the target doesn't exist.
  if (!is_link($dir) && !file_exists($dir)) {
    return TRUE;
  }
  if (!is_dir($dir)) {
    if ($force) {

      // Force deletion of items with readonly flag.
      @chmod($dir, 0777);
    }
    return unlink($dir);
  }
  foreach (scandir($dir) as $item) {
    if ($item == '.' || $item == '..') {
      continue;
    }
    if ($force) {
      @chmod($dir, 0777);
    }
    if (!static::deteleTempConfigDir($dir . '/' . $item, $force)) {
      return FALSE;
    }
  }
  if ($force) {

    // Force deletion of items with readonly flag.
    @chmod($dir, 0777);
  }
  return rmdir($dir);
}