aboutsummaryrefslogtreecommitdiff
path: root/app/class/Modelpage.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-01-22 01:21:39 +0100
committervincent-peugnet <v.peugnet@free.fr>2020-01-22 01:44:20 +0100
commit8e2abd192527a308d08920c69ab4a551b6f1e994 (patch)
tree42c540d53074c5ba17400ea6bebd2cbbdcc80b8e /app/class/Modelpage.php
parent3060bfc76b6dc58bb1fa241a17bc15926b39e515 (diff)
downloadwcms-8e2abd192527a308d08920c69ab4a551b6f1e994.tar.gz
wcms-8e2abd192527a308d08920c69ab4a551b6f1e994.zip
new feature : multidelete
Diffstat (limited to 'app/class/Modelpage.php')
-rw-r--r--app/class/Modelpage.php24
1 files changed, 20 insertions, 4 deletions
diff --git a/app/class/Modelpage.php b/app/class/Modelpage.php
index 21cdf8a..1cc6b27 100644
--- a/app/class/Modelpage.php
+++ b/app/class/Modelpage.php
@@ -134,13 +134,29 @@ class Modelpage extends Modeldb
}
}
- public function delete(Page $page)
+ /**
+ * Delete a page and it's linked rendered html and css files
+ *
+ * @param Page|string $id could be an Page object or a id string
+ *
+ * @return bool true if success otherwise false
+ */
+ public function delete($page) : bool
{
- $this->repo->delete($page->id());
- $this->unlink($page->id());
+ if ($page instanceof Page) {
+ $page = $page->id();
+ }
+ if (is_string($page)) {
+ $this->unlink($page);
+ return $this->repo->delete($page);
+ } else {
+ return false;
+ }
}
-
+ /**
+ * Delete rendered CSS and HTML files
+ */
public function unlink(string $pageid)
{
$files = ['.css', '.quick.css', '.js'];