summaryrefslogtreecommitdiff
path: root/install_packages.php
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2005-06-28 07:45:45 +0000
committerChristian Fowler <spider@viovio.com>2005-06-28 07:45:45 +0000
commit54937494744116492a4392f0cfb7fb9b625b124c (patch)
tree63ce18cfeb3b51f286538bde85ef19371e68adcf /install_packages.php
parent0e99211955eb1a6ca4a09e79506faf4d80cabac0 (diff)
downloadinstall-54937494744116492a4392f0cfb7fb9b625b124c.tar.gz
install-54937494744116492a4392f0cfb7fb9b625b124c.tar.bz2
install-54937494744116492a4392f0cfb7fb9b625b124c.zip
Merge recent changes from R1 into HEAD
Diffstat (limited to 'install_packages.php')
-rw-r--r--install_packages.php47
1 files changed, 36 insertions, 11 deletions
diff --git a/install_packages.php b/install_packages.php
index b5fe4ca..05b27be 100644
--- a/install_packages.php
+++ b/install_packages.php
@@ -1,6 +1,9 @@
<?php
-
-// $Header: /cvsroot/bitweaver/_bit_install/install_packages.php,v 1.3 2005/06/21 17:02:21 spiderr Exp $
+/**
+ * @version $Header: /cvsroot/bitweaver/_bit_install/install_packages.php,v 1.4 2005/06/28 07:45:45 spiderr Exp $
+ * @package install
+ * @subpackage functions
+ */
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
@@ -18,7 +21,14 @@ ini_set("max_execution_time", "86400");
$smarty->assign( 'next_step',$step );
// pass all package data to template
-$smarty->assign_by_ref( 'schema', $gBitInstaller->mPackages );
+$schema = $gBitInstaller->mPackages;
+ksort( $schema );
+$smarty->assign_by_ref( 'schema', $schema );
+
+// confirm that we have all the admin data in the session before proceeding
+if( empty( $_SESSION['login'] ) || empty( $_SESSION['password'] ) || empty( $_SESSION['email'] ) ) {
+ $smarty->assign( 'error', $error = TRUE );
+}
if( isset( $_REQUEST['fSubmitDbCreate'] ) ) {
if( $gBitDbType == 'sybase' ) {
@@ -47,10 +57,12 @@ if( isset( $_REQUEST['fSubmitDbCreate'] ) ) {
// value into other packages tables - typically users_permissions, bit_preferences, etc...
sort( $_REQUEST['PACKAGE'] );
// 1. let's generate all the tables's
- if ( $_SESSION['first_install'] )
+ if ( $_SESSION['first_install'] ) {
$build = array( 'NEW' );
- else
+ } else {
$build = array( 'REPLACE' );
+ }
+
foreach( array_keys( $gBitInstaller->mPackages ) as $package ) {
if( in_array( $package, $_REQUEST['PACKAGE'] ) || ( empty( $gBitInstaller->mPackages[$package]['installed'] ) && !empty( $gBitInstaller->mPackages[$package]['required'] ) ) ) {
// Install tables
@@ -70,13 +82,14 @@ if( isset( $_REQUEST['fSubmitDbCreate'] ) ) {
//vd( $sql );
if( $sql && ($dict->ExecuteSQLArray( $sql ) > 0 ) ) {
} else {
- print '<dd><font color="red">Failed to create '.$completeTableName.'</font>';
+ print '<span class="error">Failed to create '.$completeTableName.'</span>';
array_push( $failedcommands, $sql );
}
}
}
}
}
+
// 2. let's generate all the indexes, and sequences
foreach( array_keys( $gBitInstaller->mPackages ) as $package ) {
$schemaQuote = strrpos( BIT_DB_PREFIX, '`' );
@@ -90,7 +103,7 @@ if( isset( $_REQUEST['fSubmitDbCreate'] ) ) {
$sql = $dict->CreateIndexSQL( $tableIdx, $completeTableName, $gBitInstaller->mPackages[$package]['indexes'][$tableIdx]['cols'], $gBitInstaller->mPackages[$package]['indexes'][$tableIdx]['opts'] );
if( $sql && ($dict->ExecuteSQLArray( $sql ) > 0 ) ) {
} else {
- print '<dd><font color="red">Failed to create '.$completeTableName.'</font>';
+ print '<span class="error">Failed to create '.$completeTableName.'</span>';
array_push( $failedcommands, $sql );
}
}
@@ -102,9 +115,11 @@ if( isset( $_REQUEST['fSubmitDbCreate'] ) ) {
}
}
}
+
// Force a reload of all our preferences
$gBitInstaller->mPrefs = '';
$gBitInstaller->loadPreferences();
+
// 3. activate all selected & required packages
foreach( array_keys( $gBitInstaller->mPackages ) as $package ) {
if( in_array( $package, $_REQUEST['PACKAGE'] ) || !empty( $gBitInstaller->mPackages[$package]['required'] ) ) {
@@ -115,14 +130,17 @@ if( isset( $_REQUEST['fSubmitDbCreate'] ) ) {
}
}
}
+
// and let's turn on phpBB so people can find it easily.
if( defined( 'PHPBB_PKG_NAME' ) ) {
$gBitInstaller->storePreference( 'package_phpbb', 'y' );
}
+
// and let's turn OFF tinymce cause it is annoying if you want to use the wiki
if( defined( 'TINYMCE_PKG_NAME' ) ) {
$gBitInstaller->storePreference( 'package_tinymce', 'n' );
}
+
// 4. run the defaults through afterwards so we can be sure all tables needed have been created
foreach( array_keys( $gBitInstaller->mPackages ) as $package ) {
if( in_array( $package, $_REQUEST['PACKAGE'] ) || ( empty( $gBitInstaller->mPackages[$package]['installed'] ) && !empty( $gBitInstaller->mPackages[$package]['required'] ) ) ) {
@@ -136,9 +154,12 @@ if( isset( $_REQUEST['fSubmitDbCreate'] ) ) {
}
}
}
+
// only install modules during the first install
if( isset( $_SESSION['first_install'] ) && $_SESSION['first_install'] == TRUE ) {
- // Some packages have some special things to take care of here.
+ /**
+ * Some packages have some special things to take care of here.
+ */
require_once( KERNEL_PKG_PATH.'mod_lib.php' );
foreach( $gBitInstaller->mInstallModules as $mod ) {
$mod['user_id'] = ROOT_USER_ID;
@@ -188,15 +209,19 @@ if( isset( $_REQUEST['fSubmitDbCreate'] ) ) {
unset( $_SESSION['password'] );
unset( $_SESSION['email'] );
}
-
+
+ /**
+ * setup categories
+ */
if( in_array( 'categories', $_REQUEST['PACKAGE'] ) ) {
// Installing categories has some special things to take care of here and needs a separate check.
require_once( CATEGORIES_PKG_PATH.'categ_lib.php' );
$categlib->add_category( NULL, 'TOP', NULL, 0 );
}
}
- $smarty->assign( 'next_step',$step + 1 );
- $smarty->assign( 'package_list',$package_list );
+ $smarty->assign( 'next_step', $step + 1 );
+ $smarty->assign( 'package_list', $package_list );
+ $smarty->assign( 'failedcommands', !empty( $failedcommands ) ? $failedcommands : NULL );
// display the confirmation page
$app = '_done';
} else {