From 9d3f97870810e739041eccad234d47308747cb1f Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 6 Feb 2020 18:06:07 +0100 Subject: new feature : admin database manager fix #12 --- app/class/Modeladmin.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 app/class/Modeladmin.php (limited to 'app/class/Modeladmin.php') diff --git a/app/class/Modeladmin.php b/app/class/Modeladmin.php new file mode 100644 index 0000000..54c4f0c --- /dev/null +++ b/app/class/Modeladmin.php @@ -0,0 +1,48 @@ +copydb(Config::pagetable(), $name); + } + + /** + * Copy database folder to a new folder if it doeas not already exsit + * + * @param string $db name of source page database to copy + * @param string $name of the destination database + */ + public function copydb(string $db, string $name) + { + $dbdir = self::PAGES_DIR . $db; + $newdbdir = self::PAGES_DIR . idclean($name); + if(is_dir($dbdir) && !is_dir($newdbdir)) { + recurse_copy($dbdir, $newdbdir); + } + } +} + +?> \ No newline at end of file -- cgit v1.2.3