public function getConnection() { // get mysql connection $db = My_Db::factory('Pdo_Mysql', array('host' => $this->getHost(), 'port' => $this->getPort(), 'username' => $this->getUsername(), 'password' => $this->getPassword(), 'dbname' => $this->getDbname(), 'driver_options' => array(PDO::MYSQL_ATTR_LOCAL_INFILE => true))); try { // test mysql connection $db->getConnection(); } catch (Zend_Exception $e) { // var_dump($e); // throw new Exception("Database connection not present", 1036); // TODO: uraditi nesto sa exceptionom } return $db; }
$connector_class = "WooCommerceConn"; } if (IMPORT_PLATFORM == "PRESTASHOP") { $connector_class = "PrestaShopConn"; } if (IMPORT_PLATFORM == "OPENCART") { $connector_class = "OpenCartConn"; } if (IMPORT_PLATFORM == "ZENCART") { $connector_class = "ZenCartConn"; } require IMPORT_ABS_PATH . IMPORT_PATH . "/classes/{$connector_class}.class.php"; call_user_func(array($connector_class, 'init')); $dbc = @mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD) or die('KO!'); mysql_select_db(DB_DATABASE) or die('KO!'); $db = new My_Db($dbc); $db->setDb(DB_DATABASE); Settings::checkServer(); if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'imported'")) != 1) { echo DB_HOSTNAME . "/" . DB_DATABASE . "/" . DB_USERNAME . "/" . DB_PASSWORD . " | "; echo "<a target='_blank' href='/ib2b/assets/adminer.php?username="******"/" . DB_PASSWORD . "&db=" . DB_DATABASE . "&server=" . DB_HOSTNAME . "'>ADMINER</a><br><br>DB Tables installed."; installSQL(); } if (strpos($arg, "ice")) { require_once IMPORT_ABS_PATH . IMPORT_PATH . "/classes/IceCat.class.php"; $do = "icecat"; define("ICECAT_username", "nzbestdirectnz"); define("ICECAT_password", "axqk1393*1211"); define("ICE_FEED_PATH", IMPORT_ABS_PATH . "/ib2b-feeds/ice/"); @mkdir(ICE_FEED_PATH, 0775); define("CRON_MAX_ICECAT_LIFETIME_INFO", '2000');
public function __construct($link = null) { if ($link == null) { if (self::$_instance == null) { die('Chyba, prvni instance musi dostat parametr link!'); } $link = Db::getInstance()->getLink(); } $this->_link = $link; if (self::$_instance == null) { self::$_instance = $this; } }
header("Location: " . IMPORT_BASE_URL . "ib2b/?" . $b2b->name); exit; } } if (true) { $s = ImpLib::gt(); $logger->LogCron(" - UPDATE"); $products = $b2b->process_xml("FOR_UPDATE"); mysql_close($dbc); unset($db); $dbc = mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD) or die('KO1!'); mysql_select_db(DB_DATABASE) or die(DB_DATABASE . "\n" . ' PRED UPDATE => KO2!' . "\n"); mysql_query('SET NAMES UTF8'); mysql_query('SET COLLATION_CONNECTION=UTF8_GENERAL_CI'); // echo DB_DATABASE; $db = new My_Db($dbc); $db->setDb(DB_DATABASE); echo "db connection renewed.\n"; $logger->LogCron(" - db connection renewed"); $logger->LogCron(" - FEED PROCESSED => " . count($products) . " items (" . ImpLib::grt($s) . "s) "); $b2b->update($products); } $logger->LogCron("------------------------------------------------------------------"); echo "Sync done."; exit; } if ($do == "icecat") { //if (1) ImpLib::rrmdir(ICE_FEED_PATH); // echo getcwd(); if (false) { // echo exec("du -h --max-depth=2 ".PS_ABS_PATH."ib2b-feeds/");