Fix the features sql schema execution operations, so the tables and data could be imported directly from the sql files from each feature

This commit is contained in:
Gustavo Cruz
2015-03-05 15:39:58 -04:00
parent 49aeeaa37b
commit d77b8efc9b

View File

@@ -13,6 +13,9 @@ class Installer extends Controller
public $path_config; public $path_config;
public $path_languages; public $path_languages;
public $path_plugins; public $path_plugins;
/****features-begins****/
public $path_features;
/****features-ends****/
public $path_xmlforms; public $path_xmlforms;
public $path_shared; public $path_shared;
public $path_sep; public $path_sep;
@@ -26,6 +29,9 @@ class Installer extends Controller
$this->path_config = PATH_CORE . 'config/'; $this->path_config = PATH_CORE . 'config/';
$this->path_languages = PATH_CORE . 'content/languages/'; $this->path_languages = PATH_CORE . 'content/languages/';
$this->path_plugins = PATH_CORE . 'plugins/'; $this->path_plugins = PATH_CORE . 'plugins/';
/****features-begins****/
$this->path_features = PATH_CORE . 'Features/';
/****features-ends****/
$this->path_xmlforms = PATH_CORE . 'xmlform/'; $this->path_xmlforms = PATH_CORE . 'xmlform/';
$this->path_public = PATH_HOME . 'public_html/index.html'; $this->path_public = PATH_HOME . 'public_html/index.html';
$this->path_shared = PATH_TRUNK . 'shared/'; $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/schema.sql' );
$this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/insert.sql' ); $this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/insert.sql' );
/****features-begins****/
$this->createMysqlFeatures(); $this->createMysqlFeatures();
/****features-ends****/
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
$this->setPartner(); $this->setPartner();
//$this->setConfiguration(); //$this->setConfiguration();
@@ -1626,31 +1634,40 @@ class Installer extends Controller
} }
} }
} }
/****features-begins****/
/**
*
*/
public function createMysqlFeatures() public function createMysqlFeatures()
{ {
foreach ($this->getFeatureList() as $feature) { foreach ($this->getFeatureList() as $feature) {
$this->mysqlFileQuery( $feature->path . '/data/schema.sql' ); $this->mysqlFileQuery( $feature->path . '/data/schema.sql' );
$this->mysqlFileQuery( $feature->path . '/data/insert.sql' ); $this->mysqlFileQuery( $feature->path . '/data/insert.sql' );
} }
} }
/**
*
* @return \stdClass
*/
public function getFeatureList() public function getFeatureList()
{ {
$invalidFolders = array('ViewContainers'); $invalidFolders = array('ViewContainers');
$featuresFolders = glob(PATH_FEATURES.'/*', GLOB_ONLYDIR); $featuresFolders = glob($this->path_features.'/*', GLOB_ONLYDIR);
$features = array(); $features = array();
foreach ($featuresFolders as $directory) { foreach ($featuresFolders as $directory) {
$feature = new stdClass(); $feature = new \stdClass();
if (in_array($directory, $invalidFolders)) { $featureName = basename($directory);
if (in_array($featureName, $invalidFolders)) {
continue; continue;
} }
$feature->path = PATH_FEATURES . PATH_SEP . $directory; $feature->path = $this->path_features . $featureName;
$feature->name = $directory; $feature->name = $featureName;
$features[] = $feature; $features[] = $feature;
} }
return $features; return $features;
} }
/****features-ends****/
} }