public function filedepot_archiver::createAndCleanArchiveDirectory in filedepot 7
Same name in this branch
- 7 filedepot_archiver.class.php \filedepot_archiver::createAndCleanArchiveDirectory()
- 7 filedepot_archiver.zip.class.php \filedepot_archiver::createAndCleanArchiveDirectory()
Runs over the supplied directory, creates it if it does not exist, and if it does, cleans any old archive files
File
- ./
filedepot_archiver.zip.class.php, line 173 - filedepot_archiver.class.php Archiving class for filedepot
Class
- filedepot_archiver
- @file filedepot_archiver.class.php Archiving class for filedepot
Code
public function createAndCleanArchiveDirectory() {
// Create a new archive folder
$archiveDirectory = $this->archiveDirPath;
if (!file_exists($archiveDirectory)) {
@mkdir($archiveDirectory, 0777, TRUE);
}
// delete any older zip archives that were created
$fd = opendir($archiveDirectory);
while (false !== ($file = @readdir($fd))) {
if ($file != '.' && $file != '..' && $file != 'CVS' && preg_match('/\\.zip$/i', $file)) {
$ftimestamp = @fileatime("{$archiveDirectory}{$file}");
if ($ftimestamp < time() - 600) {
@unlink("{$archiveDirectory}{$file}");
}
}
}
}