private function filedepot_archiver::generateAllFilesUnderCidRecursively in filedepot 7
Same name in this branch
- 7 filedepot_archiver.class.php \filedepot_archiver::generateAllFilesUnderCidRecursively()
- 7 filedepot_archiver.zip.class.php \filedepot_archiver::generateAllFilesUnderCidRecursively()
Generate all the files under a given category ID
Parameters
type $cid:
2 calls to filedepot_archiver::generateAllFilesUnderCidRecursively()
- filedepot_archiver::createArchive in ./
filedepot_archiver.class.php - Create the requested archive
- filedepot_archiver::createArchive in ./
filedepot_archiver.zip.class.php - Create the requested archive
File
- ./
filedepot_archiver.class.php, line 52 - filedepot_archiver.class.php Archiving class for filedepot
Class
- filedepot_archiver
- @file filedepot_archiver.class.php Archiving class for filedepot
Code
private function generateAllFilesUnderCidRecursively($cid) {
$found_subdirs = FALSE;
// Only process if not already finished
if (in_array($cid, $this->processedCategoryIds)) {
return;
}
else {
$this->processedCategoryIds[] = $cid;
}
// Grab all subdirectories under this category
$result = db_query("SELECT cid FROM {filedepot_categories} WHERE pid = :pid", array(
':pid' => $cid,
));
while ($A = $result
->fetchAssoc()) {
$found_subdirs = TRUE;
if (!in_array($A['cid'], $this->uncheckedFolderIds)) {
$this
->generateAllFilesUnderCidRecursively($A['cid']);
}
}
// Grab all files under this category
$result = db_query("SELECT fid FROM {filedepot_files} WHERE cid = :cid", array(
':cid' => $cid,
));
$file_count = 0;
while ($A = $result
->fetchAssoc()) {
$file_count++;
if (!in_array($A['fid'], $this->filesToBeDownloaded) && !in_array($A['fid'], $this->uncheckedFileIds)) {
$this->filesToBeDownloaded[] = $A['fid'];
}
}
if ($file_count == 0 && $found_subdirs === FALSE) {
if ($this
->hasViewPermission($cid) === TRUE) {
$destination_dir = $this->archiveStorePath . $this
->getProcessedPath($cid) . "";
// Make sure CID exists
if (!file_exists($destination_dir)) {
@mkdir($destination_dir, 0777, TRUE);
}
// $this->addEmptyDir($this->getProcessedPath($cid));
}
}
}