install
[ class tree: install ] [ index: install ] [ all elements ]

Source for file install_version.php

Documentation is available at install_version.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. // assign next step in installation process
  9. $gBitSmarty->assign( 'next_step', $step );
  10.  
  11. // check if database version is up to date
  12. if( version_compare( $gBitSystem->getBitVersion(), $gBitSystem->getVersion(), '==' )) {
  13.     $upToDate = TRUE;
  14.     $gBitSmarty->assign( 'upToDate', $upToDate );
  15. }
  16.  
  17. // updating to version 2.1.0-beta
  18. if( version_compare( '2.1.0-beta', $gBitSystem->getVersion(), '>' )) {
  19.     // get a list of all groups and their permissions
  20.     $listHash = array(
  21.         'only_root_groups' => TRUE,
  22.         'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc'
  23.     );
  24.     $allGroups = $gBitUser->getAllGroups( $listHash );
  25.     $allPerms = $gBitUser->getGroupPermissions( $_REQUEST );
  26.  
  27.     $gBitSmarty->assign( 'allPerms', $allPerms );
  28.     $gBitSmarty->assign( 'allGroups', $allGroups );
  29.     $gBitSmarty->assign( 'version_210beta', TRUE );
  30.  
  31.     $versionUpdate = TRUE;
  32.  
  33.     // deal with assigning permissions to various groups
  34.     if( !empty( $_REQUEST['fix_version_210beta'] )) {
  35.         foreach( array_keys( $allGroups ) as $groupId ) {
  36.             foreach( array_keys( $allPerms ) as $perm ) {
  37.                 if( !empty( $_REQUEST['perms'][$groupId][$perm] )) {
  38.                     $gBitUser->assignPermissionToGroup( $perm, $groupId );
  39.                 } else {
  40.                     $gBitUser->removePermissionFromGroup( $perm, $groupId );
  41.                 }
  42.             }
  43.         }
  44.     }
  45. }
  46.  
  47. // ===================== Update version to current one =====================
  48. // Only update the version when the form has been submitted
  49. if( !empty( $_REQUEST['update_version'] )) {
  50.     if( !empty( $upToDate ) || !empty( $_REQUEST['skip'] )) {
  51.         // if we're already up to date, we'll simply move on to the next page
  52.         bit_redirect( $_SERVER['SCRIPT_NAME']."?step=".++$step );
  53.     } else {
  54.         // set the version of bitweaver in the database
  55.         if( $gBitSystem->storeVersion( NULL, $gBitSystem->getBitVersion() )) {
  56.             // display the confirmation page
  57.             $gBitSmarty->assign( 'next_step', $step + 1 );
  58.             $app = '_done';
  59.         }
  60.     }
  61. }
  62. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:45 +0000 by phpDocumentor 1.5.0-lsces