Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
regen_system_assets_config.php
1 <?php
25 error_reporting(E_ALL);
26 $SYSTEM_ROOT = '';
27 // from cmd line
28 if ((php_sapi_name() == 'cli')) {
29  if (isset($_SERVER['argv'][1])) $SYSTEM_ROOT = $_SERVER['argv'][1];
30  $err_msg = "ERROR: You need to supply the path to the System Root as the first argument\n";
31 
32 } else {
33  if (isset($_GET['SYSTEM_ROOT'])) $SYSTEM_ROOT = $_GET['SYSTEM_ROOT'];
34  $err_msg = '
35  <div style="background-color: red; color: white; font-weight: bold;">
36  You need to supply the path to the System Root as a query string variable called SYSTEM_ROOT
37  </div>
38  ';
39 }
40 if (empty($SYSTEM_ROOT)) {
41  echo $err_msg;
42  exit();
43 }
44 
45 if (!is_dir($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT.'/core/include/init.inc')) {
46  echo "ERROR: Path provided doesn't point to a Matrix installation's System Root. Please provide correct path and try again.\n";
47  exit();
48 }
49 
50 require_once $SYSTEM_ROOT.'/core/include/init.inc';
51 
52 // re-generate the System Config to make sure that we get any new defines that may have been issued
53 require_once SQ_INCLUDE_PATH.'/system_asset_config.inc';
54 $GLOBALS['SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
55  $sys_asset_cfg = new System_Asset_Config();
56  $sys_asset_cfg->save(Array(), true);
57 $GLOBALS['SQ_SYSTEM']->restoreRunLevel(SQ_RUN_LEVEL_FORCED);
58 
59 ?>