$customFileLoc = create_custom_directory('Extension/application/Ext/LogicHooks/SugarFTSHooks.php'); $fp = sugar_fopen($customFileLoc, 'wb'); $contents = <<<CIA <?php if (!isset(\$hook_array) || !is_array(\$hook_array)) { \$hook_array = array(); } if (!isset(\$hook_array['after_save']) || !is_array(\$hook_array['after_save'])) { \$hook_array['after_save'] = array(); } \$hook_array['after_save'][] = array(1, 'fts', 'include/SugarSearchEngine/SugarSearchEngineQueueManager.php', 'SugarSearchEngineQueueManager', 'populateIndexQueue'); CIA; fwrite($fp, $contents); fclose($fp); } else { createFTSLogicHook('Extension/application/Ext/LogicHooks/SugarFTSHooks.php'); } //First repair the databse to ensure it is up to date with the new vardefs/tabledefs logThis('About to repair the database.', $path); //Use Repair and rebuild to update the database. global $dictionary; require_once "modules/Administration/QuickRepairAndRebuild.php"; $rac = new RepairAndClear(); $rac->clearVardefs(); $rac->rebuildExtensions(); //bug: 44431 - defensive check to ensure the method exists since upgrades to 6.2.0 may not have this method define yet. if (method_exists($rac, 'clearExternalAPICache')) { $rac->clearExternalAPICache(); } $repairedTables = array(); foreach ($beanFiles as $bean => $file) {
/** * Creating FTS logic hook */ protected function create() { createFTSLogicHook(); }