From d8b8719d6b02d52fb5603a196972db9634766a99 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 11 Jan 2021 07:58:02 +0100 Subject: [PATCH] add method migrate() which calls the methode migrate() in the extension --- inc/inc.ClassExtensionMgr.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/inc/inc.ClassExtensionMgr.php b/inc/inc.ClassExtensionMgr.php index f3f1d1487..191587e28 100644 --- a/inc/inc.ClassExtensionMgr.php +++ b/inc/inc.ClassExtensionMgr.php @@ -297,6 +297,28 @@ class SeedDMS_Extension_Mgr { return $tmpfile; } /* }}} */ + /** + * Migrate database tables of extension if one exists + * + * @param string $extname name of extension + * @param SeedDMS_Core_DMS $dms + * @return boolean true on success, false on error + */ + public function migrate($extname, $dms) { /* {{{ */ + if(!isset($this->extconf[$extname])) + return false; + $extconf = $this->extconf[$extname]; + if(isset($extconf['class']) && isset($extconf['class']['file']) && isset($extconf['class']['name'])) { + $classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file']; + if(file_exists($classfile)) { + include($classfile); + $obj = new $extconf['class']['name']($settings); + if(method_exists($obj, 'migrate')) + $obj->migrate(isset($settings->_extensions[$extname]) ? $settings->_extensions[$extname] : null); + } + } + } /* }}} */ + /** * Check content of extension directory or configuration of extension *