Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
recreate_rollback_triggers.php
1 <?php
24 error_reporting(E_ALL);
25 if ((php_sapi_name() != 'cli')) trigger_error("You can only run this script from the command line\n", E_USER_ERROR);
26 
27 $SYSTEM_ROOT = (isset($_SERVER['argv'][1])) ? $_SERVER['argv'][1] : '';
28 if (empty($SYSTEM_ROOT)) {
29  echo "ERROR: You need to supply the path to the System Root as the first argument\n";
30  exit();
31 }
32 
33 if (!is_dir($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT.'/core/include/init.inc')) {
34  echo "ERROR: Path provided doesn't point to a Matrix installation's System Root. Please provide correct path and try again.\n";
35  exit();
36 }
37 
38 require_once $SYSTEM_ROOT.'/core/include/init.inc';
39 require_once $SYSTEM_ROOT.'/core/lib/db_install/db_install.inc';
40 require $SYSTEM_ROOT.'/data/private/db/table_columns.inc';
41 
42 $GLOBALS['SQ_SYSTEM']->changeDatabaseConnection('db2');
43 $GLOBALS['SQ_SYSTEM']->doTransaction('BEGIN');
44 
45 install_rollback_triggers($tables, true, true);
46 
47 $GLOBALS['SQ_SYSTEM']->doTransaction('COMMIT');
48 $GLOBALS['SQ_SYSTEM']->restoreDatabaseConnection();
49 
50 ?>