26 error_reporting(E_ALL);
27 if (php_sapi_name() !=
'cli') {
28 trigger_error(
"You can only run this script from the command line\n", E_USER_ERROR);
31 $SYSTEM_ROOT = (isset($_SERVER[
'argv'][1])) ? $_SERVER[
'argv'][1] :
'';
32 if (empty($SYSTEM_ROOT)) {
33 echo
"ERROR: You need to supply the path to the System Root as the first argument\n";
37 if (!is_dir($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT.
'/core/include/init.inc')) {
38 echo
"ERROR: Path provided doesn't point to a Matrix installation's System Root. Please provide correct path and try again.\n";
42 require_once $SYSTEM_ROOT.
'/core/include/init.inc';
44 error_reporting(E_ALL);
45 if (ini_get(
'memory_limit') !=
'-1') ini_set(
'memory_limit',
'-1');
47 $root_user = &$GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
48 if (!$GLOBALS[
'SQ_SYSTEM']->setCurrentUser($root_user)) {
49 echo
"ERROR: Failed logging in as root user\n";
56 $script_start = time();
58 echo_headline(
' GETTING ALL THE TRIGGERS INSTALLED ON THE SYSTEM');
61 $tm =& $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'trigger_manager');
64 foreach ($trigger_list as $index => $trigger_data) {
65 echo_headline(
" REGENERATING TRIGGER ".$tm->id.
":".$trigger_data[
'id']);
67 $trigger = $tm->_loadTrigger($trigger_data[
'id']);
68 $result = $tm->_saveTrigger($trigger);
70 if (!$result) echo_headline(
' ERROR OCCURED WHILE TRYING TO SAVE TRIGGER '.$tm->id.
':'.$trigger_data[
'id']);
77 echo_headline(
' TREE ENTRIES CREATED');
80 $script_duration = $script_end - $script_start;
81 echo
'-- Script Start : ', $script_start,
' Script End : ', $script_end,
"\n";
82 echo
'-- Script Duration: '.floor($script_duration / 60).
' mins '.($script_duration % 60).
" seconds\n";
83 fwrite(STDERR,
'-- Script Duration: '.floor($script_duration / 60).
' mins '.($script_duration % 60).
" seconds\n");
97 function echo_headline($s , $echo_time = FALSE)
101 if ($start && $echo_time) {
103 $duration = $end - $start;
104 fwrite(STDERR,
'-- Duration: '.floor($duration / 60).
'mins '.($duration % 60).
"seconds\n");
107 fwrite(STDERR,
"--------------------------------------\n$s\n--------------------------------------\n");