Пример #1
1
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     General::backupSettings();
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     //Find all quick menu linked to the template_editor and change it to file_editor
     $quick_menus = db_get_array("SELECT * FROM ?:quick_menu WHERE url LIKE '%template_editor%'");
     foreach ($quick_menus as $quick_menu) {
         $quick_menu['url'] = str_replace('template_editor', 'file_editor', $quick_menu['url']);
         db_query("REPLACE INTO ?:quick_menu ?e", $quick_menu);
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #2
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #3
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::processAddons($this->store_data, __CLASS__);
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::updateAltLanguages('privilege_descriptions', 'privilege');
     General::updateAltLanguages('privilege_section_descriptions', 'section_id');
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::updateAltLanguages('country_descriptions', 'code');
     General::processBlocks();
     General::setEmptyProgressBar();
     if (db_get_field("SHOW TABLES LIKE '?:mailing_lists'")) {
         db_query("ALTER TABLE ?:mailing_lists DROP `show_on_sidebar`");
     }
     return true;
 }
Пример #4
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::addEsStates();
     General::restoreSettings();
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #5
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     General::backupSettings();
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     $payflow_enabled = db_get_field("SELECT processor_params FROM ?:payments WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'payflow_pro.php')");
     if (!empty($payflow_enabled)) {
         $payflow_params = unserialize($payflow_enabled);
         unset($payflow_params['country']);
         $payflow_params['currency'] = 840;
         db_query("UPDATE ?:payments SET processor_params = ?s WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'payflow_pro.php')", serialize($payflow_params));
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #6
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     //        General::restoreSettings();
     if (db_get_field("SELECT status FROM ?:addons WHERE addon = 'searchanise'") != 'D') {
         db_query("UPDATE ?:addons SET status = 'D' WHERE addon = 'searchanise'");
         fn_set_notification('W', __('warning'), General::getUnavailableLangVar('uc_searchanise_disabled'));
     }
     General::setActualLangValues();
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('ult_language_values', array('name', 'company_id'));
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #7
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::restoreSettings();
     db_query("\n            DELETE FROM ?:settings_objects\n            WHERE name IN (\n                'product_notify_vendor',\n                'order_notify_vendor',\n                'page_notify_vendor',\n                'company_discussion_type',\n                'company_only_buyers',\n                'company_posts_per_page',\n                'company_post_approval',\n                'company_post_ip_check',\n                'company_notification_email',\n                'company_notify_vendor',\n                'companies_setting',\n                'include_companies',\n                'companies_change',\n                'companies_priority',\n                'product_share_discussion',\n                'news_share_discussion',\n                'page_share_discussion',\n                'testimonials_from_all_stores'\n            )\n            AND section_id IN (\n                SELECT section_id FROM ?:settings_sections\n                WHERE name IN (\n                    'discussion',\n                    'google_sitemap'\n                )\n            )\n        ");
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('state_descriptions', 'state_id');
     db_query('DROP TABLE IF EXISTS ?:se_queue');
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #8
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar();
     General::restoreSettings();
     db_query("\n            DELETE FROM ?:settings_objects\n            WHERE name IN (\n                'product_share_discussion',\n                'news_share_discussion',\n                'page_share_discussion',\n                'testimonials_from_all_stores'\n            )\n            AND section_id IN (\n                SELECT section_id FROM ?:settings_sections\n                WHERE name = 'discussion'\n            )\n        ");
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::setEmptyProgressBar();
     return true;
 }
Пример #9
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     //       General::restoreSettings();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #10
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::convertPresets403To411();
     General::convertScrollerBlocks();
     db_query("UPDATE ?:sales_reports_tables SET type = 'P' WHERE type = 'C'");
     General::setEmptyProgressBar();
     return true;
 }
Пример #11
0
 public function import($db_already_cloned)
 {
     Registry::set('runtime.simple_ultimate', true);
     Registry::del('runtime.forced_company_id');
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #12
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     //We should get locations before database upgrade. It is for the old versions.
     $bm_locations = $this->_getBmLocations();
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     if (General::supplierSettings('enabled')) {
         $this->_installSuppliers();
     }
     $skin_name = $this->_getSkinName();
     General::processAddons($this->store_data, __CLASS__);
     $this->_processCurrencies();
     $this->_processLanguages();
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::uninstallAddons(array('twigmo', 'searchanise', 'live_help', 'exim_store', 'webmail'));
     //        General::restoreSettings();
     $this->_processPayments();
     $this->_processBMContainers();
     $this->_createLayouts($bm_locations);
     $this->_convertOrders();
     $this->_processImages($skin_name);
     $this->_processFiles('downloads');
     $this->_processFiles('attachments');
     $this->_processFiles('custom_files');
     $this->_processLanguageValues();
     $this->_fillSharingTable();
     General::updateStatusColors();
     General::processBMBlocksTemplates();
     General::processBMProductFiltersBlockContent();
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::updateAltLanguages('privilege_descriptions', 'privilege');
     General::updateAltLanguages('privilege_section_descriptions', 'section_id');
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::updateAltLanguages('country_descriptions', 'code');
     General::updateAltLanguages('bm_blocks_descriptions', 'block_id');
     General::updateAltLanguages('bm_locations_descriptions', 'location_id');
     General::updateAltLanguages('bm_blocks_content', array('snapping_id', 'object_id', 'object_type', 'block_id'));
     return true;
 }
Пример #13
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $default_company = General::getDefaultCompany();
     General::processAddons($this->store_data, __CLASS__);
     $this->_processCurrencies();
     $this->_processLanguages();
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     $default_company_id = (int) General::createDefaultCompany($default_company);
     $this->_updateCompanyId($default_company_id);
     $this->_processPayments();
     $this->_processBMContainers();
     $this->_createLayouts();
     $this->_convertOrders($default_company_id);
     $this->_processLanguageValues();
     $this->_processProducts($default_company_id);
     $this->_processShippings($default_company_id);
     General::updateStatusColors();
     General::processBMBlocksTemplates();
     General::processBMProductFiltersBlockContent();
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::updateAltLanguages('privilege_descriptions', 'privilege');
     General::updateAltLanguages('privilege_section_descriptions', 'section_id');
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::updateAltLanguages('country_descriptions', 'code');
     General::updateAltLanguages('bm_blocks_descriptions', 'block_id');
     General::updateAltLanguages('bm_locations_descriptions', 'location_id');
     General::updateAltLanguages('bm_blocks_content', array('snapping_id', 'object_id', 'object_type', 'block_id'));
     return true;
 }
Пример #14
0
 public function import($db_already_cloned)
 {
     Registry::set('runtime.simple_ultimate', true);
     Registry::del('runtime.forced_company_id');
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToImportedDB($this->store_data);
     $supplier_settings = $this->getSupplierSettings();
     General::setSupplierSettings($supplier_settings);
     $default_language = db_get_field("SELECT value FROM ?:settings WHERE option_name = 'customer_default_language' AND section_id = 'Appearance'");
     $settings_to_be_saved = array('use_email_as_login', 'admin_default_language', 'customer_default_language', 'disable_shipping', 'fedex_enabled', 'ups_enabled', 'usps_enabled', 'dhl_enabled', 'aup_enabled', 'can_enabled', 'swisspost_enabled', 'seo_product_type', 'seo_category_type', 'single_url', 'seo_language');
     $settings_to_be_saved_values = General::get22xSettings($settings_to_be_saved);
     $addons = General::get22xAddons();
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::processAddons($this->store_data, __CLASS__, array_keys($addons));
     if (!empty($addons)) {
         General::processAddonsSettings($addons);
     }
     General::enableInstalledAddons($addons);
     General::setEmptyProgressBar();
     $this->_importMenu();
     $this->_copyImages();
     $this->_copyFiles();
     $this->_patchProfileFields();
     $this->_normalizeProductViews();
     $this->_normalizeUserGroupIds();
     $this->_fixLanguagesMissedInImported($default_language);
     General::addStatusColors();
     General::copyProductsBlocks($this->store_data);
     General::restore22xSavedSetting($settings_to_be_saved_values);
     General::setEmptyProgressBar();
     return true;
 }
Пример #15
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #16
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::backupSettings();
     General::updateAltLanguages('language_values', 'name');
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #17
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     //        General::restoreSettings();
     db_query("ALTER TABLE ?:currencies CHANGE `decimals_separator` `decimals_separator` varchar(6) NOT NULL DEFAULT '.'");
     db_query("ALTER TABLE ?:currencies CHANGE `thousands_separator` `thousands_separator` varchar(6) NOT NULL DEFAULT ','");
     db_query("ALTER TABLE ?:bm_locations ADD `custom_html` TEXT NOT NULL");
     db_query("ALTER TABLE ?:order_data CHANGE `data` `data` LONGBLOB  NOT NULL");
     db_query("ALTER TABLE ?:order_details CHANGE `extra` `extra` LONGBLOB  NOT NULL");
     db_query("ALTER TABLE ?:order_transactions CHANGE `extra` `extra` LONGBLOB  NOT NULL");
     db_query('UPDATE ?:shipping_services SET `code` = "Media Mail Parcel" WHERE `module` = "usps" AND `code` = "Media Mail"');
     db_query('UPDATE ?:shipping_services SET `code` = "Library Mail Parcel" WHERE `module` = "usps" AND `code` = "Library Mail"');
     db_query("ALTER TABLE ?:categories ADD `level` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_path`");
     db_query("UPDATE ?:categories AS `c` SET `c`.`level` = ((length(`c`.`id_path`) - length(REPLACE(`c`.`id_path`, '/', ''))) + 1)");
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #18
0
 public function import($db_already_cloned)
 {
     Registry::set('runtime.simple_ultimate', true);
     Registry::del('runtime.forced_company_id');
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $default_company = General::getDefaultCompany();
     $supplier_settings = $this->getSupplierSettings();
     General::setSupplierSettings($supplier_settings);
     $enabledSuppliers = General::supplierSettings('enabled') ? true : false;
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     if ($enabledSuppliers) {
         $this->_importSuppliers();
     }
     General::processAddons($this->store_data, __CLASS__);
     General::setEmptyProgressBar();
     $this->_deleteAllCompanies();
     $default_company_id = (int) General::createDefaultCompany($default_company);
     $this->_fillSharingTable($default_company_id);
     $this->_updateCompanyId($default_company_id);
     $this->_setStorefromUrl($default_company_id, $this->store_data);
     General::setEmptyProgressBar();
     return true;
 }
Пример #19
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('privilege_descriptions', 'privilege');
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::setEmptyProgressBar();
     $fields = array('profile_show', 'checkout_show', 'partner_show');
     $billing = db_get_row("SELECT " . implode(', ', $fields) . " FROM ?:profile_fields WHERE field_name = 'email' AND section = 'B'");
     $shipping = array();
     foreach ($fields as $field) {
         $shipping[$field] = $billing[$field] == 'Y' ? 'N' : 'Y';
     }
     db_query("UPDATE ?:profile_fields SET ?u WHERE field_name = 'email' AND section = 'S'", $shipping);
     General::setEmptyProgressBar();
     return true;
 }
Пример #20
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     db_query("INSERT INTO ?:payment_processors (processor, processor_script, processor_template, admin_template, callback, `type`) VALUES ('Realex Payments Remote', 'realex_remote.php', 'views/orders/components/payments/cc.tpl', 'realex_remote.tpl', 'N', 'P')");
     db_query("INSERT INTO ?:payment_processors (processor, processor_script, processor_template, admin_template, callback, `type`) VALUES ('Realex Payments Redirect', 'realex_redirect.php', 'views/orders/components/payments/cc_outside.tpl', 'realex_redirect.tpl', 'N', 'P')");
     db_query("UPDATE ?:settings_sections SET `edition_type` = 'ROOT,VENDOR' WHERE `name` = 'Security' AND `type` = 'CORE'");
     General::addIpv6Support();
     $paypal_enabled = db_get_fields("SELECT payment_id FROM ?:payments WHERE processor_id IN (SELECT processor_id FROM ?:payment_processors WHERE processor_script IN ('paypal.php', 'payflow_pro.php', 'paypal_advanced.php', 'paypal_express.php', 'paypal_pro.php'))");
     if (!empty($paypal_enabled)) {
         db_query("INSERT INTO ?:addons (`addon`, `status`, `version`, `priority`, `dependencies`, `conflicts`, `separate`, `unmanaged`, `has_icon`) VALUES ('paypal', 'A', '1.0', 100, '', '', 0, 0, 0)");
         db_query("INSERT INTO ?:settings_sections (`parent_id`, `edition_type`, `name`, `position`, `type`) VALUES (0, 'ROOT,ULT:VENDOR', 'paypal', 0, 'ADDON')");
         $section_id = db_get_field("SELECT section_id FROM ?:settings_sections WHERE name = 'paypal' AND type = 'ADDON'");
         db_query("INSERT INTO ?:settings_sections (`parent_id`, `edition_type`, `name`, `position`, `type`) VALUES ({$section_id}, 'ROOT,ULT:VENDOR', 'general', 0, 'TAB')");
         $parent_id = db_get_field("SELECT section_id FROM ?:settings_sections WHERE parent_id = {$section_id}");
         db_query("INSERT INTO ?:settings_objects (`edition_type`, `name`, `section_id`, `section_tab_id`, `type`, `value`, `position`, `is_global`, `handler`, `parent_id`) VALUES\n                ('ROOT,ULT:VENDOR', 'paypal_ipn_settings', {$section_id}, {$parent_id}, 'H', '', 0, 'N', '', 0),\n                ('ROOT,ULT:VENDOR', 'override_customer_info', {$section_id}, {$parent_id}, 'C', 'Y', 10, 'N', '', 0),\n                ('ROOT', 'test_mode', {$section_id}, {$parent_id}, 'C', 'N', 20, 'N', '', 0),\n                ('ROOT,ULT:VENDOR', 'template', {$section_id}, {$parent_id}, 'Z', 'statuses_map.tpl', 30, 'N', '', 0),\n                ('ROOT,ULT:VENDOR', 'template', {$section_id}, {$parent_id}, 'Z', 'logo_uploader.tpl', 40, 'N', '', 0),\n                ('ROOT,ULT:VENDOR', 'pp_statuses', {$section_id}, {$parent_id}, 'D', 'a:10:{s:8:\"refunded\";s:1:\"I\";s:9:\"completed\";s:1:\"P\";s:7:\"pending\";s:1:\"O\";s:17:\"canceled_reversal\";s:1:\"I\";s:7:\"created\";s:1:\"O\";s:6:\"denied\";s:1:\"I\";s:7:\"expired\";s:1:\"F\";s:8:\"reversed\";s:1:\"I\";s:9:\"processed\";s:1:\"P\";s:6:\"voided\";s:1:\"P\";}', 50, 'N', '', 0)\n            ");
         $pp_standart_params = db_get_field("SELECT processor_params FROM ?:payments WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'paypal.php')");
         if (!empty($pp_standart_params)) {
             $pp_standart_params = unserialize($pp_standart_params);
             if (!empty($pp_standart_params['statuses'])) {
                 db_query("UPDATE ?:settings_objects SET value = ?s WHERE name = 'pp_statuses'", serialize($pp_standart_params['statuses']));
                 unset($pp_standart_params['statuses']);
                 $pp_standart_params = serialize($pp_standart_params);
                 db_query("UPDATE ?:payments SET processor_params = ?s WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'paypal.php')", $pp_standart_params);
             }
         }
         $languages = db_get_fields("SELECT lang_code FROM ?:languages");
         $addon_scheme = AddonSchemesManager::getScheme('paypal');
         $language_variables = $addon_scheme->getLanguageValues();
         if (!empty($language_variables)) {
             db_query('REPLACE INTO ?:language_values ?m', $language_variables);
         }
         $settings_descr = array('paypal_ipn_settings' => 'Instant payment notification settings', 'override_customer_info' => 'Override customer info', 'test_mode' => 'Test mode');
         foreach ($languages as $lang_code) {
             $description = $addon_scheme->getDescription($lang_code);
             $addon_name = $addon_scheme->getName($lang_code);
             db_query("INSERT INTO ?:addon_descriptions (addon, name, description, lang_code) VALUES ('paypal', ?s, ?s, ?s) ON DUPLICATE KEY UPDATE ?:addon_descriptions.addon = ?:addon_descriptions.addon", $addon_name, $description, $lang_code);
             foreach ($settings_descr as $setting_name => $descr) {
                 db_query("REPLACE INTO ?:settings_descriptions VALUES ((SELECT object_id FROM ?:settings_objects WHERE name = ?s), 'O', ?s, ?s, '')", $setting_name, $lang_code, $descr);
             }
         }
     } else {
         db_query("DELETE FROM ?:payment_processors WHERE processor_script IN ('paypal.php', 'payflow_pro.php', 'paypal_advanced.php', 'paypal_express.php', 'paypal_pro.php')");
     }
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #21
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     General::backupSettings();
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     $seo_status = db_get_field("SELECT status FROM ?:addons WHERE addon = 'seo'");
     if (!empty($seo_status)) {
         $seo_multi_language = db_get_field("SELECT value FROM ?:settings_objects_upg WHERE name = 'multi_language'");
         $seo_multi_language_vendor = db_get_hash_single_array("SELECT company_id, value FROM ?:settings_vendor_values_upg WHERE object_id = (SELECT object_id FROM ?:settings_objects_upg WHERE name = 'multi_language')", array('company_id', 'value'));
         db_query("UPDATE ?:settings_objects_upg SET value = 'category_nohtml' WHERE value = 'category' AND name = 'seo_category_type'");
         db_query("UPDATE ?:settings_vendor_values_upg SET value = 'category_nohtml' WHERE value = 'category' AND object_id = (SELECT object_id FROM ?:settings_objects_upg WHERE name = 'seo_category_type')");
         db_query("UPDATE ?:settings_objects_upg SET value = 'category' WHERE value = 'file' AND name = 'seo_category_type'");
         db_query("UPDATE ?:settings_vendor_values_upg SET value = 'category' WHERE value = 'file' AND object_id = (SELECT object_id FROM ?:settings_objects_upg WHERE name = 'seo_category_type')");
         $categories = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type='c' AND lang_code = (SELECT value FROM ?:settings_objects WHERE name='frontend_default_language')");
         if (!empty($categories)) {
             foreach ($categories as $category_id) {
                 $path = db_get_field("SELECT id_path FROM ?:categories WHERE category_id = ?i", $category_id);
                 $apath = explode('/', $path);
                 array_pop($apath);
                 db_query("UPDATE ?:seo_names SET path = ?s WHERE type='c' AND object_id = ?i", implode('/', $apath), $category_id);
             }
         }
         $products = db_get_fields("SELECT object_id FROM ?:seo_names RIGHT JOIN ?:products ON ?:seo_names.object_id = ?:products.product_id WHERE type='p' AND lang_code = (SELECT value FROM ?:settings_objects WHERE name='frontend_default_language')");
         if (!empty($products)) {
             $condition = '';
             if (fn_allowed_for('ULTIMATE')) {
                 $condition = fn_get_company_condition('c.company_id', false);
                 $condition = !empty($condition) ? " AND ({$condition} OR {$field} = 0)" : '';
             }
             foreach ($products as $product_id) {
                 $path = db_get_hash_single_array("SELECT c.id_path, p.link_type FROM ?:categories as c LEFT JOIN ?:products_categories as p ON p.category_id = c.category_id WHERE p.product_id = ?i ?p", array('link_type', 'id_path'), $product_id, $condition);
                 $_path = !empty($path['M']) ? $path['M'] : $path['A'];
                 db_query("UPDATE ?:seo_names SET path = ?s WHERE type='p' AND object_id = ?i", $_path, $product_id);
             }
         }
         $pages = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type='a' AND lang_code = (SELECT value FROM ?:settings_objects WHERE name='frontend_default_language')");
         if (!empty($pages)) {
             foreach ($pages as $page_id) {
                 $path = db_get_field("SELECT id_path FROM ?:pages WHERE page_id = ?i", $page_id);
                 $apath = explode('/', $path);
                 array_pop($apath);
                 db_query("UPDATE ?:seo_names SET path = ?s WHERE type='a' AND object_id = ?i", implode('/', $apath), $page_id);
             }
         }
     }
     General::restoreSettings();
     if (!empty($seo_status)) {
         db_query("UPDATE ?:settings_objects SET value = ?s WHERE name = 'non_latin_symbols'", $seo_multi_language);
         foreach ($seo_multi_language_vendor as $company_id => $value) {
             db_query("REPLACE INTO ?:settings_vendor_values VALUES ((SELECT object_id FROM ?:settings_objects WHERE name = 'non_latin_symbols'), ?i, ?s)", $company_id, $value);
         }
         $map = array('product_file' => 'file', 'product_category' => 'page');
         $setting = db_get_field("SELECT value FROM ?:settings_objects WHERE name = 'seo_product_type'");
         db_query("UPDATE ?:settings_objects SET value = ?s WHERE name = 'seo_page_type'", $map[$setting]);
         $obj_id = db_get_field("SELECT object_id FROM ?:settings_objects WHERE name = 'seo_page_type'");
         $settings = db_get_array("SELECT * FROM ?:settings_vendor_values WHERE object_id = (SELECT object_id FROM ?:settings_objects WHERE name = 'seo_product_type')");
         if (!empty($settings)) {
             foreach ($settings as $vendor_setting) {
                 db_query("UPDATE ?:settings_vendor_values SET value = ?s WHERE object_id = ?i AND company_id = ?i", $map[$vendor_setting['value']], $obj_id, $vendor_setting['company_id']);
             }
         }
         db_query("UPDATE ?:settings_objects SET value = 'file' WHERE name = 'seo_other_type'");
         db_query("UPDATE ?:settings_vendor_values SET value = 'file' WHERE object_id = (SELECT object_id FROM ?:settings_objects WHERE name = 'seo_other_type')");
         $empty_product_seo_names = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type = 'p' AND object_id NOT IN (SELECT product_id FROM ?:products)");
         if ($empty_product_seo_names) {
             db_query("DELETE FROM ?:seo_names WHERE object_id IN (?n)", $empty_product_seo_names);
         }
         $empty_pages_seo_names = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type = 'a' AND object_id NOT IN (SELECT page_id FROM ?:pages)");
         if ($empty_product_seo_names) {
             db_query("DELETE FROM ?:seo_names WHERE object_id IN (?n)", $empty_product_seo_names);
         }
         $empty_categories_seo_names = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type = 'c' AND object_id NOT IN (SELECT category_id FROM ?:categories)");
         if ($empty_categories_seo_names) {
             db_query("DELETE FROM ?:seo_names WHERE object_id IN (?n)", $empty_categories_seo_names);
         }
         $empty_features_seo_names = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type = 'e' AND object_id NOT IN (SELECT feature_id FROM ?:product_features)");
         if ($empty_features_seo_names) {
             db_query("DELETE FROM ?:seo_names WHERE object_id IN (?n)", $empty_features_seo_names);
         }
         $_empty_product_seo_names = db_get_array("\n                SELECT ?:seo_names.*\n                FROM ?:categories\n                RIGHT JOIN ?:products_categories ON ?:categories.category_id = ?:products_categories.category_id\n                RIGHT JOIN ?:seo_names ON ?:products_categories.product_id = ?:seo_names.object_id AND ?:categories.company_id = ?:seo_names.company_id\n                WHERE ?:categories.category_id IS NULL AND ?:seo_names.type = 'p'");
         foreach ($_empty_product_seo_names as $value) {
             db_query("DELETE FROM ?:seo_names WHERE object_id = ?i AND company_id = ?i AND type = 'p'", $value['object_id'], $value['company_id']);
         }
     }
     if (db_get_field("SELECT status FROM ?:addons WHERE addon = 'suppliers'")) {
         $query_parts = array();
         $shippings = fn_get_shippings(true);
         foreach ($shippings as $shipping_id => $shipping_name) {
             $query_parts[] = db_quote('(?i, ?i, ?s)', 0, $shipping_id, 'S');
         }
         if (!empty($query_parts)) {
             db_query('REPLACE INTO ?:supplier_links VALUES ' . implode(', ', $query_parts));
         }
     }
     $products_with_empty_categories = db_get_array("SELECT category_id, product_id FROM ?:products_categories WHERE category_id NOT IN (SELECT category_id FROM ?:categories)");
     db_query("DELETE FROM ?:products_categories WHERE category_id NOT IN (SELECT category_id FROM ?:categories)");
     foreach ($products_with_empty_categories as $k => $data) {
         $product_to_delete = db_get_field("SELECT product_id FROM ?:products_categories WHERE product_id = ?i", $data['product_id']);
         if (!$product_to_delete) {
             fn_delete_product($data['product_id']);
         } else {
             $product_category = db_get_field("SELECT category_id FROM ?:products_categories WHERE product_id = ?i", $product_to_delete);
             $company_id = db_get_field("SELECT company_id FROM ?:categories WHERE category_id = ?i", $product_category);
             db_query("UPDATE ?:products_categories SET link_type = 'A' WHERE product_id = ?i", $product_to_delete);
             db_query("UPDATE ?:products_categories SET link_type = 'M' WHERE product_id = ?i AND category_id = ?i", $product_to_delete, $product_category);
             db_query("UPDATE ?:products SET company_id = ?i WHERE product_id = ?i", $company_id, $product_to_delete);
         }
     }
     $products_with_category = db_get_hash_array("SELECT ?:products_categories.product_id, ?:categories.company_id  FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id LEFT JOIN ?:products ON ?:products.product_id = ?:products_categories.product_id WHERE ?:products.company_id = ?:categories.company_id", 'product_id');
     $products_with_foreign_category = db_get_array("SELECT ?:products_categories.product_id, ?:categories.company_id, ?:products.company_id as old_company_id  FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id LEFT JOIN ?:products ON ?:products.product_id = ?:products_categories.product_id WHERE ?:products.company_id != ?:categories.company_id AND ?:products_categories.product_id NOT IN (?n)", array_keys($products_with_category));
     if (!empty($products_with_foreign_category)) {
         foreach ($products_with_foreign_category as $key => $data) {
             db_query("UPDATE ?:products SET company_id = ?i WHERE product_id = ?i", $data['company_id'], $data['product_id']);
             if (!empty($seo_status)) {
                 db_query("DELETE FROM ?:seo_names WHERE type = 'p' AND object_id = ?i AND company_id = ?i", $data['product_id'], $data['old_company_id']);
             }
         }
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Пример #22
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     $this->_edpProducts();
     $this->_bmNewLinkField();
     $this->_addNewLocation();
     $this->_removeShippingSettings();
     $this->_convertImageVerification();
     $this->_mveConvertImageVerification();
     //        $this->_addNewSettingTimeframe();
     $this->_newFieldInProcessor();
     $this->_renameCategoryTableFields();
     $this->_updatePayPalPayments();
     $this->_addNewFieldToMenu();
     General::setCustomCssClassForResponsive();
     General::addCheckoutSection();
     General::coreCheckoutSettings();
     General::removeNullTextFields();
     General::filtersRefactoring();
     $this->_mveFiltersRefactoring();
     General::removeNewsLogger();
     General::convertNewsToBlog();
     General::pagesRemoveShowInPopup();
     General::removeTplDebugSetting();
     $this->_removeCheckoutStyleSetting();
     General::revertSearchFieldBlock();
     General::addFullHttps();
     General::removeUseEmailAsLoginSetting();
     General::removeUserLoginEximField();
     $this->coreLogosLinkedToStyles();
     db_query("ALTER TABLE ?:vendor_payouts CHANGE `comments` `comments` text");
     db_query("UPDATE ?:usergroup_privileges SET privilege = 'backup_restore' WHERE privilege = 'database_maintenance'");
     db_query("UPDATE ?:privileges SET privilege = 'backup_restore' WHERE privilege = 'database_maintenance'");
     //        General::restoreSettings();
     if (db_get_field("SELECT status FROM ?:addons WHERE addon = 'searchanise'") != 'D') {
         db_query("UPDATE ?:addons SET status = 'D' WHERE addon = 'searchanise'");
         fn_set_notification('W', __('warning'), General::getUnavailableLangVar('uc_searchanise_disabled'));
     }
     General::setActualLangValues();
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }