summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-07-16 16:39:03 -0400
committerEudyptula <eitan@mosenkis.net>2009-07-16 16:39:03 -0400
commitb04ca72439752a5c964c75b18994311d0aef5618 (patch)
tree13a190764f26bffea538ea77aaa7a15108c454cd /setup.php
parentAdd dev-manager support to gentoo/portage modules (diff)
downloadingenue-b04ca72439752a5c964c75b18994311d0aef5618.tar.gz
ingenue-b04ca72439752a5c964c75b18994311d0aef5618.tar.bz2
ingenue-b04ca72439752a5c964c75b18994311d0aef5618.zip
Added predefined package sets; separated gentoo-specific setup into gentoo_setup.php
Diffstat (limited to 'setup.php')
-rwxr-xr-xsetup.php20
1 files changed, 7 insertions, 13 deletions
diff --git a/setup.php b/setup.php
index 532bf9f..fc4e001 100755
--- a/setup.php
+++ b/setup.php
@@ -2,19 +2,19 @@
<?php
require_once(dirname(__FILE__).'/shared/include/includes.php'); // USE __DIR__ in 5.3.0
function echo_and_query($q) {
- global $pdo;
+ global $S;
echo $q."\n";
- return $pdo->query($q);
+ return $S['pdo']->query($q);
}
$interactive=posix_isatty(STDIN);
$opts=getopt('R');
-$pdo=new PDO('mysql:host='.$conf['sqlhost'], $conf['sqluser'], $conf['sqlpass']);
+$S['pdo']=new PDO('mysql:host='.$conf['sqlhost'], $conf['sqluser'], $conf['sqlpass']);
if (isset($opts['R'])) {
echo_and_query('DROP DATABASE IF EXISTS `'.$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'].'`');
-sql_row_obj::set_pdo_obj($pdo);
+sql_row_obj::set_pdo_obj($S['pdo']);
foreach (get_declared_classes() as $class) {
if (!is_subclass_of($class, 'sql_row_obj')) {
continue;
@@ -28,15 +28,6 @@ foreach (get_declared_classes() as $class) {
}
echo_and_query($o->create_table());
}
-foreach (get_pkgdirs() as $dir) {
- echo 'Creating profile for '.$conf['pkgdir_root'].'/'.$dir.'...';
- $profile=new sql_gentoo_profile();
- $profile->pkgdir=$dir;
- echo "done\n";
- echo 'Loading data from '.$conf['pkgdir_root'].'/'.$dir.'/Packages...';
- $profile->read_Packages();
- echo "done\n";
-}
do {
if ($user->email) {
echo 'Invalid entry: '.$user->email."\n";
@@ -77,4 +68,7 @@ if ($interactive) {
$user->passhash=substr($pass, 0, 5)=='sha1:'?substr($pass, 5):sha1($pass);
$user->flags='a'; // Admin
$user->write();
+foreach (glob(dirname(__FILE__).'/*_setup.php') as $file) { // __DIR__ 5.3.0
+ require($file);
+}
?>