permission->is_admin(); //$this->output->enable_profiler(TRUE); $this->load->model('Area_model'); $this->load->model('Import_model'); $this->load->model('InfoContents_model'); $this->load->model('InfoStructures_model'); } public function index() { //@set_time_limit(0); ini_set('max_execution_time', '0'); // $this->Import_model->import_from_other_database(69690,63564); //$this->Import_model->import_clear(); //$this->Import_model->import_info(); //$this->Import_model->import_xxoo(); //$this->Import_model->update_root(); /*$data = $this->Import_model->import_test(); foreach ($data as $item) { for ($i = 0; $i <= $item->is_level; $i++) { echo '  '; } echo $item->ic_url_title . '
'; }*/ } public function clear_site(){ $this->Import_model->import_clear_site();echo 'clear_site'; } public function reset_path() { @set_time_limit(0); return false; $this->Import_model->reset_all_path(); } public function to_sqlite() { $this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file')); $this->HT = $this->load->database('HT', TRUE); $sql_array = array(); $sql_ht = "SELECT ic.ic_id, \n" . " ic.ic_url, \n" . " ic.ic_url_title, \n" . " ic.ic_type, \n" . " ic.ic_title, \n" . " ic.ic_content, \n" . " ic.ic_summary, \n" . " ic.ic_seo_title, \n" . " ic.ic_seo_description, \n" . " ic.ic_seo_keywords, \n" . " ic.ic_show_bread_crumbs, \n" . " ic.ic_status, \n" . " ic.ic_template, \n" . " ic.ic_photo, \n" . " ic.ic_photo_width, \n" . " ic.ic_photo_height, \n" . " ic.ic_sitecode, \n" . " ic.ic_recommend_tours, \n" . " ic.ic_recommend_packages, \n" . " ic.ic_datetime, \n" . " ic.ic_ht_area_id, \n" . " ic.ic_ht_area_type, \n" . " ic.ic_ht_product_id, \n" . " ic.ic_ht_product_type, \n" . " is1.is_id, \n" . " is1.is_parent_id, \n" . " is1.is_path, \n" . " is1.is_level, \n" . " is1.is_sort, \n" . " is1.is_sitecode, \n" . " is1.is_datetime, \n" . " is1.is_ic_id \n" . "FROM infoContents ic \n" . " INNER JOIN infoStructures is1 ON is1.is_ic_id = ic.ic_id \n" . " AND is1.is_sitecode = 'cht' \n" . "WHERE ic.ic_ht_area_type = 'c' \n" . " AND ic.ic_ht_area_id IN (177, 54, 1, 3, 7)"; $sql_ht_query = $this->HT->query($sql_ht); foreach ($sql_ht_query->result() as $item) { $sql_content = "INSERT INTO information \n" . " ( \n" . " ic_id, ic_url_title, ic_type,ic_content, ic_title, \n" . " ic_show_bread_crumbs,ic_status, ic_template,ic_photo, ic_photo_width, \n" . " ic_photo_height,ic_datetime,ic_ht_area_id, ic_ht_area_type, \n" . " is_id, is_parent_id, is_path, is_level, is_sort \n" . " ) \n" . "VALUES \n" . " ( \n" . $this->HT->escape($item->ic_id) . ' , ' . $this->HT->escape($item->ic_url_title) . ' , ' . $this->HT->escape($item->ic_type) . ' , ' . $this->HT->escape($item->ic_content) . ' , ' . $this->HT->escape($item->ic_title) . ' , ' . $this->HT->escape($item->ic_show_bread_crumbs) . ' , ' . $this->HT->escape($item->ic_status) . ' , ' . $this->HT->escape($item->ic_template) . ' , ' . $this->HT->escape($item->ic_photo) . ' , ' . $this->HT->escape($item->ic_photo_width) . ' , ' . $this->HT->escape($item->ic_photo_height) . ' , ' . $this->HT->escape($item->ic_datetime) . ' , ' . $this->HT->escape($item->ic_ht_area_id) . ' , ' . $this->HT->escape($item->ic_ht_area_type) . ' , ' . $this->HT->escape($item->is_id) . ' , ' . $this->HT->escape($item->is_parent_id) . ' , ' . $this->HT->escape($item->is_path) . ' , ' . $this->HT->escape($item->is_level) . ' , ' . $this->HT->escape($item->is_sort) . " );"; $sql_array[] = $sql_content; // echo $sql_content.';'; //$this->cache->save(md5($item->ic_id), $item->ic_content, 60 * 60 * 24 * 30); } file_put_contents('import.sql', implode("\n", $sql_array)); //print_r($sql_array); } }