From 0c196e35dd68f76776ac39b4d76c50d7c8a172d5 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Wed, 16 May 2018 18:22:57 +0200 Subject: [PATCH 1/4] [com_contenthistory] - fix for not delete kepp forever items --- administrator/components/com_contenthistory/models/history.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_contenthistory/models/history.php b/administrator/components/com_contenthistory/models/history.php index 41d032eb7ba5b..357c2241623ad 100644 --- a/administrator/components/com_contenthistory/models/history.php +++ b/administrator/components/com_contenthistory/models/history.php @@ -120,7 +120,7 @@ public function delete(&$pks) { if ($table->load($pk)) { - if ($this->canEdit($table)) + if ($this->canEdit($table) && $table->keep_forever !== "1") { if (!$table->delete($pk)) { From 67fd1e48f7feb549698e39819c888d2a5778db3b Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Wed, 16 May 2018 18:41:08 +0200 Subject: [PATCH 2/4] don't stop delete --- .../components/com_contenthistory/models/history.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_contenthistory/models/history.php b/administrator/components/com_contenthistory/models/history.php index 357c2241623ad..4ab402f30139a 100644 --- a/administrator/components/com_contenthistory/models/history.php +++ b/administrator/components/com_contenthistory/models/history.php @@ -118,9 +118,16 @@ public function delete(&$pks) // Iterate the items to delete each one. foreach ($pks as $i => $pk) { + if ($table->load($pk)) { - if ($this->canEdit($table) && $table->keep_forever !== "1") + if ($table->keep_forever === "1") + { + unset($pks[$i]); + continue; + } + + if ($this->canEdit($table)) { if (!$table->delete($pk)) { From 21d69332c7616c589076cedc4159d29331b1aa0f Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Wed, 16 May 2018 18:49:27 +0200 Subject: [PATCH 3/4] cs --- administrator/components/com_contenthistory/models/history.php | 1 - 1 file changed, 1 deletion(-) diff --git a/administrator/components/com_contenthistory/models/history.php b/administrator/components/com_contenthistory/models/history.php index 4ab402f30139a..3ee1a4fd74312 100644 --- a/administrator/components/com_contenthistory/models/history.php +++ b/administrator/components/com_contenthistory/models/history.php @@ -118,7 +118,6 @@ public function delete(&$pks) // Iterate the items to delete each one. foreach ($pks as $i => $pk) { - if ($table->load($pk)) { if ($table->keep_forever === "1") From 8bcc22907ef3712ee164b6e6aa89752f91cf6a05 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sat, 16 Jun 2018 17:52:54 +0200 Subject: [PATCH 4/4] cs removed spaces at end of line --- administrator/components/com_contenthistory/models/history.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_contenthistory/models/history.php b/administrator/components/com_contenthistory/models/history.php index 3ee1a4fd74312..92376fade3371 100644 --- a/administrator/components/com_contenthistory/models/history.php +++ b/administrator/components/com_contenthistory/models/history.php @@ -123,7 +123,7 @@ public function delete(&$pks) if ($table->keep_forever === "1") { unset($pks[$i]); - continue; + continue; } if ($this->canEdit($table))