summaryrefslogtreecommitdiff
path: root/install_version.php
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2008-10-03 10:14:15 +0000
committerMax Kremmel <xing@synapse.plus.com>2008-10-03 10:14:15 +0000
commit71c71a48826b45babc0321a268e528d485737f5d (patch)
treecc18642f169935fa9dfb9fdad7568aed6bc6380e /install_version.php
parent92432ee79a46c8804422ff1daae3df207c1581d8 (diff)
downloadinstall-71c71a48826b45babc0321a268e528d485737f5d.tar.gz
install-71c71a48826b45babc0321a268e528d485737f5d.tar.bz2
install-71c71a48826b45babc0321a268e528d485737f5d.zip
add code to allow for a version check and force a visit to the installer when a given version hasn't been reached yet.
Diffstat (limited to 'install_version.php')
-rw-r--r--install_version.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/install_version.php b/install_version.php
new file mode 100644
index 0000000..83aff72
--- /dev/null
+++ b/install_version.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * @version $Header: /cvsroot/bitweaver/_bit_install/install_version.php,v 1.1 2008/10/03 10:14:15 squareing Exp $
+ * @package install
+ * @subpackage functions
+ */
+
+// assign next step in installation process
+$gBitSmarty->assign( 'next_step', $step );
+
+// check if database version is up to date
+if( version_compare( BIT_MAJOR_VERSION.".".BIT_MINOR_VERSION.".".BIT_SUB_VERSION."-".BIT_LEVEL, $gBitSystem->getVersion(), '==' )) {
+ $upToDate = TRUE;
+ $gBitSmarty->assign( 'upToDate', $upToDate );
+}
+
+// updating to version 2.1.0-beta
+if( version_compare( '2.1.0-beta', $gBitSystem->getVersion(), '>' )) {
+ // get a list of all groups and their permissions
+ $listHash = array(
+ 'only_root_groups' => TRUE,
+ 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc'
+ );
+ $allGroups = $gBitUser->getAllGroups( $listHash );
+ $allPerms = $gBitUser->getGroupPermissions( $_REQUEST );
+
+ $gBitSmarty->assign( 'allPerms', $allPerms );
+ $gBitSmarty->assign( 'allGroups', $allGroups );
+ $gBitSmarty->assign( 'version_210beta', TRUE );
+
+ $versionUpdate = TRUE;
+
+ // deal with assigning permissions to various groups
+ if( !empty( $_REQUEST['fix_version_210beta'] )) {
+ foreach( array_keys( $allGroups ) as $groupId ) {
+ foreach( array_keys( $allPerms ) as $perm ) {
+ if( !empty( $_REQUEST['perms'][$groupId][$perm] )) {
+ $gBitUser->assignPermissionToGroup( $perm, $groupId );
+ } else {
+ $gBitUser->removePermissionFromGroup( $perm, $groupId );
+ }
+ }
+ }
+ }
+}
+
+// ===================== Update version to current one =====================
+// Only update the version when the form has been submitted
+if( !empty( $_REQUEST['update_version'] )) {
+ if( !empty( $upToDate ) || !empty( $_REQUEST['skip'] )) {
+ // if we're already up to date, we'll simply move on to the next page
+ bit_redirect( $_SERVER['PHP_SELF']."?step=".++$step );
+ } elseif( $gBitSystem->storeVersion( NULL, BIT_MAJOR_VERSION.".".BIT_MINOR_VERSION.".".BIT_SUB_VERSION."-".BIT_LEVEL )) {
+ // display the confirmation page
+ $gBitSmarty->assign( 'next_step', $step + 1 );
+ $app = '_done';
+ }
+}
+?>