From d77b8efc9b480ecd2a08035bdd2c11ed723879d7 Mon Sep 17 00:00:00 2001 From: Gustavo Cruz Date: Thu, 5 Mar 2015 15:39:58 -0400 Subject: [PATCH] Fix the features sql schema execution operations, so the tables and data could be imported directly from the sql files from each feature --- workflow/engine/controllers/installer.php | 33 +++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/workflow/engine/controllers/installer.php b/workflow/engine/controllers/installer.php index 7c780bc20..ee879f6ad 100755 --- a/workflow/engine/controllers/installer.php +++ b/workflow/engine/controllers/installer.php @@ -13,6 +13,9 @@ class Installer extends Controller public $path_config; public $path_languages; public $path_plugins; + /****features-begins****/ + public $path_features; + /****features-ends****/ public $path_xmlforms; public $path_shared; public $path_sep; @@ -26,6 +29,9 @@ class Installer extends Controller $this->path_config = PATH_CORE . 'config/'; $this->path_languages = PATH_CORE . 'content/languages/'; $this->path_plugins = PATH_CORE . 'plugins/'; + /****features-begins****/ + $this->path_features = PATH_CORE . 'Features/'; + /****features-ends****/ $this->path_xmlforms = PATH_CORE . 'xmlform/'; $this->path_public = PATH_HOME . 'public_html/index.html'; $this->path_shared = PATH_TRUNK . 'shared/'; @@ -782,8 +788,10 @@ class Installer extends Controller $this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/schema.sql' ); $this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/insert.sql' ); + /****features-begins****/ $this->createMysqlFeatures(); - + /****features-ends****/ + if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { $this->setPartner(); //$this->setConfiguration(); @@ -1626,31 +1634,40 @@ class Installer extends Controller } } } - + + /****features-begins****/ + /** + * + */ public function createMysqlFeatures() { foreach ($this->getFeatureList() as $feature) { $this->mysqlFileQuery( $feature->path . '/data/schema.sql' ); $this->mysqlFileQuery( $feature->path . '/data/insert.sql' ); } - } + /** + * + * @return \stdClass + */ public function getFeatureList() { $invalidFolders = array('ViewContainers'); - $featuresFolders = glob(PATH_FEATURES.'/*', GLOB_ONLYDIR); + $featuresFolders = glob($this->path_features.'/*', GLOB_ONLYDIR); $features = array(); foreach ($featuresFolders as $directory) { - $feature = new stdClass(); - if (in_array($directory, $invalidFolders)) { + $feature = new \stdClass(); + $featureName = basename($directory); + if (in_array($featureName, $invalidFolders)) { continue; } - $feature->path = PATH_FEATURES . PATH_SEP . $directory; - $feature->name = $directory; + $feature->path = $this->path_features . $featureName; + $feature->name = $featureName; $features[] = $feature; } return $features; } + /****features-ends****/ }