// however it's a DDL command, and so if we're using slony we can't use it. if ($pgdb && !$no_ddl) { $sql = "COPY sq_ast_lnk_tree (treeid, linkid, num_kids) FROM stdin;\n" . '-' . "\t" . '1' . "\t" . (string) count($index[1]); } else { $sql = 'INSERT INTO sq_ast_lnk_tree (treeid, linkid, num_kids) VALUES (' . MatrixDAL::quote('-') . ', ' . MatrixDAL::quote(1) . ', ' . MatrixDAL::quote(count($index[1])) . ');'; } echo $sql, "\n"; $echo_i = 0; recurse_tree_create(1, ''); fwrite(STDERR, "\n"); if ($pgdb && !$no_ddl) { echo "\\.\n"; } else { echo "COMMIT;\n"; } echo_headline($echo_i . ' TREE ENTRIES CREATED'); // as a part of bug fix #3864 Rebuilding Link Tree breaks triggers , ask user runnin the script to // also run regenerate_treeids_for_triggers.php script as well fwrite(STDERR, "\n\n*************************************************************************\n PLEASE RUN regenerate_treeids_for_triggers.php SCRIPT AFTER RECREATING\n LINK TREE IF YOU HAVE ANY TRIGGERS INSTALLED ON THE SYSTEM\n*************************************************************************\n\n"); $script_end = time(); $script_duration = $script_end - $script_start; echo '-- Script Start : ', $script_start, ' Script End : ', $script_end, "\n"; echo '-- Script Duration: ' . floor($script_duration / 60) . 'mins ' . $script_duration % 60 . "seconds\n"; fwrite(STDERR, '-- Script Duration: ' . floor($script_duration / 60) . 'mins ' . $script_duration % 60 . "seconds\n"); //-- FUNCTIONS --// /** * Print a headline to STDERR * * @param string $s the headline * * @return void
$script_start = time(); echo_headline(' GETTING ALL THE TRIGGERS INSTALLED ON THE SYSTEM'); // get trigger manager and all the triggers installed on the system $tm =& $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('trigger_manager'); $trigger_list = MatrixDAL::executeAll('core', 'getTriggerList'); foreach ($trigger_list as $index => $trigger_data) { echo_headline(" REGENERATING TRIGGER " . $tm->id . ":" . $trigger_data['id']); // load the trigger and regenerate it, same as clicking commit on the backend :) $trigger = $tm->_loadTrigger($trigger_data['id']); $result = $tm->_saveTrigger($trigger); if (!$result) { echo_headline(' ERROR OCCURED WHILE TRYING TO SAVE TRIGGER ' . $tm->id . ':' . $trigger_data['id']); } } fwrite(STDERR, "\n"); echo_headline(' TREE ENTRIES CREATED'); $script_end = time(); $script_duration = $script_end - $script_start; echo '-- Script Start : ', $script_start, ' Script End : ', $script_end, "\n"; echo '-- Script Duration: ' . floor($script_duration / 60) . ' mins ' . $script_duration % 60 . " seconds\n"; fwrite(STDERR, '-- Script Duration: ' . floor($script_duration / 60) . ' mins ' . $script_duration % 60 . " seconds\n"); //-- FUNCTIONS --// /** * Print a headline to STDERR * * @param string $s the headline * * @return void * @access public */ function echo_headline($s, $echo_time = FALSE)