/** * Installs given table * * @access public * @return void */ public function install() { // Call parent install parent::install(); // Add indexes to table ee()->db->query("ALTER TABLE {$this->table()} ADD INDEX (`site_id`)"); }
/** * Installs given table * * @access public * @return void */ public function install() { // Call parent install parent::install(); // Add indexes to table foreach (array('site_id') as $key) { ee()->db->query("ALTER TABLE {$this->table()} ADD INDEX (`{$key}`)"); } }
/** * Installs given table and adds indexes to it * * @access public * @return void */ public function install() { // Call parent install parent::install(); // Force MyISAM ee()->db->query("ALTER TABLE {$this->table()} ENGINE = MYISAM"); // Add indexes to table ee()->db->query("ALTER TABLE {$this->table()} ADD INDEX (`collection_id`)"); ee()->db->query("ALTER TABLE {$this->table()} ADD INDEX (`site_id`)"); ee()->db->query("ALTER TABLE {$this->table()} ADD FULLTEXT (`index_text`)"); }
/** * Get all collections and cache them * * @access public * @param int Channel ID * @return array */ public function get_all() { static $all; // Get all from parent class if (is_null($all)) { ee()->db->order_by('collection_label', 'asc'); $all = parent::get_all(); foreach ($all as &$row) { $row['settings'] = low_search_decode($row['settings'], FALSE); } $all = low_associate_results($all, 'collection_id'); } return $all; }
/** * Get one saved search * * @access public * @return void */ public function get_one($id, $attr = FALSE) { static $cache = array(); // Make sure $attr is set if (!$attr) { $attr = $this->pk(); } // Compose cache key $key = $attr . ':' . $id; // Check cache if (!array_key_exists($key, $cache)) { // For this site only ee()->db->where('site_id', $this->site_id); if ($row = parent::get_one($id, $attr)) { $row['parameters'] = low_search_decode($row['parameters'], FALSE); } $cache[$key] = $row; } return $cache[$key]; }