Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
step_01.php
1 <?php
27 ini_set('memory_limit', -1);
28 error_reporting(E_ALL);
29 $SYSTEM_ROOT = '';
30 
31 if ((php_sapi_name() == 'cli')) {
32  if (isset($_SERVER['argv'][1])) {
33  $SYSTEM_ROOT = $_SERVER['argv'][1];
34  }
35 
36  $err_msg = "ERROR: You need to supply the path to the System Root as the first argument.\n";
37 
38 } else {
39  if (isset($_GET['SYSTEM_ROOT'])) {
40  $SYSTEM_ROOT = $_GET['SYSTEM_ROOT'];
41  }
42 
43  $err_msg = '
44  <div style="background-color: red; color: white; font-weight: bold;">
45  You need to supply the path to the System Root as a query string variable called SYSTEM_ROOT
46  </div>
47  ';
48 }
49 
50 if (empty($SYSTEM_ROOT)) {
51  $err_msg .= "Usage: php install/step_01.php <PATH_TO_MATRIX>\n";
52  echo $err_msg;
53  exit();
54 }
55 
56 if (!is_dir($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT.'/core/include/init.inc')) {
57  $err_msg = "ERROR: Path provided doesn't point to a Matrix installation's System Root. Please provide correct path and try again.\n";
58  $err_msg .= "Usage: php install/step_01.php <PATH_TO_MATRIX>\n";
59  echo $err_msg;
60  exit();
61 }
62 
63 define('SQ_SYSTEM_ROOT', $SYSTEM_ROOT);
64 define('SQ_INCLUDE_PATH', SQ_SYSTEM_ROOT.'/core/include');
65 define('SQ_LIB_PATH', SQ_SYSTEM_ROOT.'/core/lib');
66 define('SQ_DATA_PATH', SQ_SYSTEM_ROOT.'/data');
67 define('SQ_FUDGE_PATH', SQ_SYSTEM_ROOT.'/fudge');
68 define('SQ_PHP_CLI', (php_sapi_name() == 'cli'));
69 
70 require_once SQ_INCLUDE_PATH.'/mysource_object.inc';
71 require_once SQ_INCLUDE_PATH.'/system_config.inc';
72 
73 // override some of the default config values
74 define('SQ_CONF_PEAR_PATH', SQ_SYSTEM_ROOT.'/php_includes');
75 
76 $cfg = new System_Config();
77 $cfg->save(Array(), TRUE);
78 
79 // Copy the DB config sample to the data directory
80 // Only overwrite the file if there is no file exists already
81 if (!file_exists(SQ_DATA_PATH.'/private/conf/db.inc')) {
82  copy(dirname(__FILE__).'/db-inc.sample', SQ_DATA_PATH.'/private/conf/db.inc');
83 }
84 
85 // Do the same with the memcache config file
86 if (!file_exists(SQ_DATA_PATH.'/private/conf/memcache.inc')) {
87  copy(dirname(__FILE__).'/memcache-inc.sample', SQ_DATA_PATH.'/private/conf/memcache.inc');
88 }
89 
90 // reminder for chmod
91 echo 'Remember to give your system\'s Apache user write access to'."\n";
92 echo 'the cache and data directories of your Matrix install...'."\n";
93 
94 ?>