You are here

function BackupMigrateUnitTest::delete_directory in Backup and Migrate 5

6 calls to BackupMigrateUnitTest::delete_directory()
BackupMigrateUnitTest::tearDown in tests/BackupMigrateUnitTest.test
SimpleTest core method: code run after each and every test method.
BackupMigrateUnitTest::testCreateBackupDirectory in tests/BackupMigrateUnitTest.test
BackupMigrateUnitTest::testPathinSaveDir in tests/BackupMigrateUnitTest.test
BackupMigrateUnitTest::testRemoveExpiredBackups in tests/BackupMigrateUnitTest.test
BackupMigrateUnitTest::testSaveToDisk in tests/BackupMigrateUnitTest.test

... See full list

File

tests/BackupMigrateUnitTest.test, line 702

Class

BackupMigrateUnitTest
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);
  }
}