diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-08-04 17:58:55 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-08-04 17:58:55 -0400 |
commit | d3da989d3e2d2cb03cdc4bd2e23783f716ef5035 (patch) | |
tree | 2f9f8c413d2800a3f72282dec0f86170a00ff4f6 /setup.php | |
parent | Add visibility column to builds, configurations (diff) | |
download | ingenue-d3da989d3e2d2cb03cdc4bd2e23783f716ef5035.tar.gz ingenue-d3da989d3e2d2cb03cdc4bd2e23783f716ef5035.tar.bz2 ingenue-d3da989d3e2d2cb03cdc4bd2e23783f716ef5035.zip |
Widespread cleanup - moved $conf, $death into $S; $S is given as arg to init_x() and body_x(); $request removed in favor of $_REQUEST; query() replaces $S[pdo]->query(); etc.
Diffstat (limited to 'setup.php')
-rwxr-xr-x | setup.php | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -1,19 +1,15 @@ #!/usr/bin/php <?php require_once(dirname(__FILE__).'/shared/include/includes.php'); // USE __DIR__ in 5.3.0 -function echo_and_query($q) { - global $S; - echo $q."\n"; - return $S['pdo']->query($q); -} +$S['conf']['debug']=true; $interactive=posix_isatty(STDIN); $opts=getopt('R'); -$S['pdo']=new PDO('mysql:host='.$conf['sqlhost'], $conf['sqluser'], $conf['sqlpass']); +$S['pdo']=new PDO('mysql:host='.$S['conf']['sqlhost'], $S['conf']['sqluser'], $S['conf']['sqlpass']); if (isset($opts['R'])) { - echo_and_query('DROP DATABASE IF EXISTS `'.$conf['sqldb'].'`'); + query('DROP DATABASE IF EXISTS `'.$S['conf']['sqldb'].'`'); } -echo_and_query('CREATE DATABASE IF NOT EXISTS `'.$conf['sqldb'].'`'); // We can add charset and collate here if we want -echo_and_query('USE `'.$conf['sqldb'].'`'); +query('CREATE DATABASE IF NOT EXISTS `'.$S['conf']['sqldb'].'`'); // We can add charset and collate here if we want +query('USE `'.$S['conf']['sqldb'].'`'); sql_row_obj::set_pdo_obj($S['pdo']); foreach (get_declared_classes() as $class) { if (!is_subclass_of($class, 'sql_row_obj')) { @@ -24,9 +20,9 @@ foreach (get_declared_classes() as $class) { unset($r); $o=new $class(); // TODO this will be static once 5.3.0 is out if (isset($opts['R'])) { - echo_and_query($o->drop_table()); + query($o->drop_table()); } - echo_and_query($o->create_table()); + query($o->create_table()); } do { if ($user->email) { |