diff --git a/magmi/inc/magmi_engine.php b/magmi/inc/magmi_engine.php index c587f5cb..b144967c 100755 --- a/magmi/inc/magmi_engine.php +++ b/magmi/inc/magmi_engine.php @@ -33,7 +33,7 @@ abstract class Magmi_Engine extends DbHelper */ public function getEngineInfo() { - return array("name"=>"Generic Magmi Engine","version"=>"1.1","author"=>"dweeves"); + return array("name" => "Generic Magmi Engine", "version" => "1.1", "author" => "dweeves"); } /** @@ -278,6 +278,11 @@ public function getPluginInstance($family, $order = -1) if ($order < 0) { $order += count($this->_activeplugins[$family]); } + + + + + if (is_array($this->_activeplugins) && isset($this->_activeplugins[$family]) && isset($this->_activeplugins[$family][$order])) { return $this->_activeplugins[$family][$order]; @@ -310,7 +315,7 @@ public function callPlugins($types, $callback, &$data = null, $params = null, $b if (isset($this->_activeplugins[$ptype])) { // For all instances in the family foreach ($this->_activeplugins[$ptype] as $pinst) { - $pclass=get_class($pinst); + $pclass = get_class($pinst); // If the plugin has a hook for the defined processing step if (method_exists($pinst, $callback)) { // Timing initialization for current plugin in processing step @@ -417,11 +422,11 @@ public function getExceptionTrace($tk, &$traces) } } if (!isset($this->_exceptions[$tk])) { - $this->_exceptions[$tk] = array(0,$this->_excid); + $this->_exceptions[$tk] = array(0, $this->_excid); } $this->_exceptions[$tk][0]++; $trstr = "************************************\n$tk\n*************************************\n$trstr"; - return array($trstr,$this->_exceptions[$tk][0] == 1,$this->_exceptions[$tk][1]); + return array($trstr, $this->_exceptions[$tk][0] == 1, $this->_exceptions[$tk][1]); } public function trace($e, $data = "") @@ -505,7 +510,7 @@ public function connectToMagento() $socket = $this->getProp("DATABASE", "unix_socket"); if ($conn == 'localxml') { $baseDir = $this->getProp('MAGENTO', 'basedir'); - $xmlPath = $baseDir.'/app/etc/local.xml'; + $xmlPath = $baseDir . '/app/etc/local.xml'; if (!file_exists($xmlPath)) { throw new Exception("Cannot load xml from path '$xmlPath'"); } @@ -516,6 +521,18 @@ public function connectToMagento() $user = $default_setup->username; $pass = $default_setup->password; $port = $default_setup->port; + } else if ($conn === 'envphp') { + $envPath = dirname(__FILE__) . "/../../app/etc/env.php"; + if (!file_exists($envPath)) { + throw new Exception("Cannot load xml from path '$envPath'"); + } + $env_array = include $envPath; + $host_array = explode(":",$env_array['db']['connection']['default']['host']); + $host = $host_array[0]; + $port = isset($host_array[1]) ? $host_array[1] : '3306'; + $dbname = $env_array['db']['connection']['default']['dbname']; + $user = $env_array['db']['connection']['default']['username']; + $pass = $env_array['db']['connection']['default']['password']; } else { $host = $this->getProp("DATABASE", "host", "localhost"); $dbname = $this->getProp("DATABASE", "dbname", "magento"); @@ -528,6 +545,7 @@ public function connectToMagento() $this->_db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } } + /* * Disconnect Magento db */ diff --git a/magmi/web/magmi_config_setup.php b/magmi/web/magmi_config_setup.php index 5265e673..0e1e769d 100755 --- a/magmi/web/magmi_config_setup.php +++ b/magmi/web/magmi_config_setup.php @@ -179,6 +179,7 @@ class="saveinfo"> +