From 1671759292b0d4bfb04c1fb8673befb8ebc1a268 Mon Sep 17 00:00:00 2001 From: Joe Bordes Date: Sun, 15 Jun 2014 00:32:33 +0200 Subject: [PATCH] fixes #187: create method to import module manifest file --- vtlib/Vtiger/PackageImport.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/vtlib/Vtiger/PackageImport.php b/vtlib/Vtiger/PackageImport.php index 125210ccd7..7149de4fd4 100644 --- a/vtlib/Vtiger/PackageImport.php +++ b/vtlib/Vtiger/PackageImport.php @@ -373,6 +373,34 @@ function import($zipfile, $overwrite=false) { } } + /** + * Import Module from manifest.xml file. Other files should already be in place + * @param String manifest.xml file path + */ + function importManifest($manifestfile) { + global $adb,$log; + if (!file_exists($manifestfile)) + $manifestfile .= $manifestfile.'/manifest.xml'; // in case they just give us the path + if (!file_exists($manifestfile)) + return false; + $this->_modulexml = simplexml_load_file($manifestfile); + $module = (string) $this->_modulexml->name; + if($module != null) { + if ($this->isLanguageType()) { + require_once('vtlib/Vtiger/Language.php'); + $languagePack = new Vtiger_Language(); + @$languagePack->register((string) $this->_modulexml->prefix,(string) $this->_modulexml->label,$module); + } else { + $sql = "select tabid from vtiger_tab where name=?"; + $result = $adb->pquery($sql, array($module)); + if ($result and $adb->num_rows($result) > 0) { + return false; // module already installed + } + $this->import_Module(); + } + } + return true; + } /** * Import Module