From 1d011471674ede030407c351abfbf2bfc93d8b7a Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Fri, 18 Oct 2019 14:20:55 +0200 Subject: new page render system create html files in `/render` folder --- app/class/modelart.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'app/class/modelart.php') diff --git a/app/class/modelart.php b/app/class/modelart.php index 8462675..8dee09c 100644 --- a/app/class/modelart.php +++ b/app/class/modelart.php @@ -11,6 +11,9 @@ class Modelart extends Modeldb { parent::__construct(); $this->storeinit(Config::arttable()); + if(!$this->dircheck(Model::HTML_RENDER_DIR)) { + throw new Exception("Media error : Cant create /rendernew folder"); + } } /** @@ -50,7 +53,13 @@ class Modelart extends Modeldb $this->repo->store($artdata); } - + /** + * Obtain a page object from the database + * + * @param Art2|string $id could be an Art2 object or a id string + * + * @return Art2|false The Art2 object or false if it does not exist. + */ public function get($id) { if ($id instanceof Art2) { @@ -120,6 +129,9 @@ class Modelart extends Modeldb unlink(Model::RENDER_DIR . $artid . $file); } } + if(file_exists(Model::HTML_RENDER_DIR . $artid . '.html')) { + unlink(Model::HTML_RENDER_DIR . $artid . '.html'); + } } public function update(Art2 $art) -- cgit v1.2.3