Skip to content

Commit f20375b

Browse files
committed
Mass delete templates in container version
1 parent 224468f commit f20375b

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

Dao/TagsDao.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@ public function deleteContainerTag($idSite, $idContainerVersion, $idTag, $delete
189189
Db::query($query, $bind);
190190
}
191191

192+
/**
193+
* @param int $idSite
194+
* @param int $idContainerVersion
195+
* @param string $deletedDate
196+
*/
197+
public function deleteContainerTags($idSite, $idContainerVersion, $deletedDate)
198+
{
199+
$table = $this->tablePrefixed;
200+
201+
$query = "UPDATE $table SET status = ?, deleted_date = ? WHERE idsite = ? and idcontainerversion = ? and status != ?";
202+
$bind = array(self::STATUS_DELETED, $deletedDate, $idSite, $idContainerVersion, self::STATUS_DELETED);
203+
204+
Db::query($query, $bind);
205+
}
206+
192207
private function enrichTags($tags)
193208
{
194209
if (empty($tags)) {
@@ -217,7 +232,7 @@ private function enrichTag($tag)
217232
$tag['idcontainerversion'] = (int) $tag['idcontainerversion'];
218233
$tag['fire_delay'] = (int)$tag['fire_delay'];
219234
$tag['priority'] = (int)$tag['priority'];
220-
235+
221236
if ($tag['start_date'] === '0000-00-00 00:00:00') {
222237
$tag['start_date'] = null;
223238
}

Dao/TriggersDao.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,21 @@ public function deleteContainerTrigger($idSite, $idContainerVersion, $idTrigger,
170170
Db::query($query, $bind);
171171
}
172172

173+
/**
174+
* @param int $idSite
175+
* @param int $idContainerVersion
176+
* @param string $deletedDate
177+
*/
178+
public function deleteContainerTriggers($idSite, $idContainerVersion, $deletedDate)
179+
{
180+
$table = $this->tablePrefixed;
181+
182+
$query = "UPDATE $table SET status = ?, deleted_date = ? WHERE idsite = ? and idcontainerversion = ? and status != ?";
183+
$bind = array(self::STATUS_DELETED, $deletedDate, $idSite, $idContainerVersion, self::STATUS_DELETED);
184+
185+
Db::query($query, $bind);
186+
}
187+
173188
private function enrichTriggers($triggers)
174189
{
175190
if (empty($triggers)) {

Dao/VariablesDao.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,21 @@ public function deleteContainerVariable($idSite, $idContainerVersion, $idVariabl
187187
Db::query($query, $bind);
188188
}
189189

190+
/**
191+
* @param int $idSite
192+
* @param int $idContainerVersion
193+
* @param string $deletedDate
194+
*/
195+
public function deleteContainerVariables($idSite, $idContainerVersion, $deletedDate)
196+
{
197+
$table = $this->tablePrefixed;
198+
199+
$query = "UPDATE $table SET status = ?, deleted_date = ? WHERE idsite = ? and idcontainerversion = ? and status != ?";
200+
$bind = array(self::STATUS_DELETED, $deletedDate, $idSite, $idContainerVersion, self::STATUS_DELETED);
201+
202+
Db::query($query, $bind);
203+
}
204+
190205
private function enrichVariables($variables)
191206
{
192207
if (empty($variables)) {

0 commit comments

Comments
 (0)