function run($max_time) { global $cfg; $i18n = new Internationalization($cfg->get('system_language', 'en_US')); $sequences = $i18n->getTemplate('sequence.yaml')->getData(); foreach ($sequences as $s) { Sequence::create($s)->save(); } db_query('UPDATE '.SEQUENCE_TABLE.' SET `next`= ' .'(SELECT MAX(ticket_id)+1 FROM '.TICKET_TABLE.') ' .'WHERE `id`=1'); require_once(INCLUDE_DIR . 'class.list.php'); $lists = $i18n->getTemplate('list.yaml')->getData(); foreach ($lists as $l) { DynamicList::create($l); } $statuses = $i18n->getTemplate('ticket_status.yaml')->getData(); foreach ($statuses as $s) { TicketStatus::__create($s); } // Initialize MYSQL search backend MysqlSearchBackend::__init(); }
$queue[] = $record; } elseif (!$queue) { return; } if (!$force_flush && count($queue) < $this::$BATCH_SIZE) { return true; } foreach ($queue as &$r) { $r = sprintf('(%s)', implode(',', db_input($r))); } unset($r); $sql = 'INSERT INTO `' . TABLE_PREFIX . '_search` (`object_type`, `object_id`, `title`, `content`) VALUES ' . implode(',', $queue); if (!db_query($sql, false) || count($queue) != db_affected_rows()) { throw new Exception('Unable to index content'); } $this->_reindexed += count($queue); $queue = array(); if (!--$this->max_batches) { return null; } return true; } static function __init() { self::createSearchTable(); } } Signal::connect('system.install', array('MysqlSearchBackend', '__init')); MysqlSearchBackend::register();