Skip to content

Commit 2b7d6a1

Browse files
author
markus-moser
committed
object naming scheme: delete empty folders in archive dir too
1 parent e73fbe9 commit 2b7d6a1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/CustomerProvider/ObjectNamingScheme/DefaultObjectNamingScheme.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,21 @@ public function cleanupEmptyFolders()
100100
// apply it for folders older then 10 minutes only
101101
$timestamp = time() - 60*10;
102102

103+
$archiveDir = $this->archiveDir ? : $this->parentPath;
104+
103105
$folders->setCondition(
104-
"o_id in (select o_id from (select o_id, o_path, o_key, o_type, (select count(*) from objects where o_parentId = o.o_id) as counter from objects o) as temp where counter=0 and o_type = 'folder' and o_path like ? and o_creationDate < ?)",
106+
"o_id in (select o_id from (select o_id, o_path, o_key, o_type, (select count(*) from objects where o_parentId = o.o_id) as counter from objects o) as temp where counter=0 and o_type = 'folder' and (o_path like ? or o_path like ?) and o_creationDate < ?)",
105107
[
106108
str_replace('//', '/', $this->parentPath.'/%'),
109+
str_replace('//', '/', $archiveDir .'/%'),
107110
$timestamp
108111
]
109112
);
110113

111114
foreach($folders as $folder) {
112115
if($folder instanceof Folder) {
113116
$folder->delete();
114-
$this->getLogger()->error("delete empty folder ". (string) $folder);
117+
$this->getLogger()->info("delete empty folder ". (string) $folder);
115118
}
116119
}
117120
}

0 commit comments

Comments
 (0)