You are here

function BackupMigrateUnitTest::getOldestFiletime in Backup and Migrate 5

1 call to BackupMigrateUnitTest::getOldestFiletime()
BackupMigrateUnitTest::testRemoveExpiredBackups in tests/BackupMigrateUnitTest.test

File

tests/BackupMigrateUnitTest.test, line 750

Class

BackupMigrateUnitTest
Unit tests for Backup and Migrate module.

Code

function getOldestFiletime($dir) {

  // A very high number (the highest in fact).
  $out = 0xffffffff;
  if ($res = opendir($dir)) {

    // read all files and sort them by modified time
    while ($file = readdir($res)) {
      if ($file != '.' && $file != '..' && $file != 'test.txt') {
        $out = min($out, filemtime($dir . '/' . $file));
      }
    }
  }
  return $out;
}