You are here

function BackupMigrateFunctionalityTest::delete_directory in Backup and Migrate 5

Same name and namespace in other branches
  1. 6.3 tests/backup_migrate.functionality.test \BackupMigrateFunctionalityTest::delete_directory()
  2. 6.2 tests/backup_migrate.functionality.test \BackupMigrateFunctionalityTest::delete_directory()
6 calls to BackupMigrateFunctionalityTest::delete_directory()
BackupMigrateFunctionalityTest::tearDown in tests/BackupMigrateFunctionalityTest.test
SimpleTest core method: code run after each and every test method.
BackupMigrateFunctionalityTest::testDeleteBackup in tests/BackupMigrateFunctionalityTest.test
BackupMigrateFunctionalityTest::testListSavedBackups in tests/BackupMigrateFunctionalityTest.test
BackupMigrateFunctionalityTest::testManualBackup in tests/BackupMigrateFunctionalityTest.test
BackupMigrateFunctionalityTest::testRestoreFromSaved in tests/BackupMigrateFunctionalityTest.test

... See full list

File

tests/BackupMigrateFunctionalityTest.test, line 474

Class

BackupMigrateFunctionalityTest
Unit tests for Backup and Migrate module.

Code

function delete_directory($dirname) {
  if (is_dir($dirname) && ($dir_handle = opendir($dirname))) {
    while ($file = readdir($dir_handle)) {
      if ($file != '.' && $file != '..') {
        if (!is_dir($dirname . '/' . $file)) {
          unlink($dirname . '/' . $file);
        }
        else {
          $this
            ->delete_directory($dirname . '/' . $file);
        }
      }
    }
    closedir($dir_handle);
    rmdir($dirname);
  }
}