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

Source for file install_cleanup.php

Documentation is available at install_cleanup.php

  1. <?php
  2. /**
  3.  * @version $Header: /cvsroot/bitweaver/_bit_install/install_cleanup.php,v 1.5 2006/03/01 20:16:12 spiderr Exp $
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. // assign next step in installation process
  9. $gBitSmarty->assign'next_step'$step );
  10.  
  11. $schema $gBitInstaller->mPackages;
  12. ksort$schema );
  13. $gBitSmarty->assign_by_ref'schema'$schema );
  14.  
  15. // check all permissions, compare them to each other and see if there are old permissions and ones that need to be inserted
  16. $query "SELECT * FROM `".BIT_DB_PREFIX."users_permissions` ORDER BY `package` ASC";
  17. $result $gBitInstaller->mDb->query$query );
  18. while!$result->EOF {
  19.     foreach$result->fields as $r {
  20.         $bitPrefs[$result->fields['perm_name']][$r;
  21.     }
  22.     $bitPrefs[$result->fields['perm_name']]['sql'"DELETE FROM `".BIT_DB_PREFIX."users_permissions` WHERE `perm_name`='".$result->fields['perm_name']."'";
  23.     $result->MoveNext();
  24. }
  25.  
  26. // compare both perm arrays and work out what needs to be done
  27. $insPerms $delPerms array();
  28. foreacharray_keys$gBitInstaller->mPermHash as $perm {
  29.     if!in_array$permarray_keys$bitPrefs ) ) ) {
  30.         if@$schema[$gBitInstaller->mPermHash[$perm][3]]['installed'{
  31.             $insPerms[$perm$gBitInstaller->mPermHash[$perm];
  32.         }
  33.     }
  34. }
  35.  
  36. foreacharray_keys$bitPrefs as $perm {
  37.     if!in_array$permarray_keys$gBitInstaller->mPermHash ) ) ) {
  38.         $delPerms[$perm$bitPrefs[$perm];
  39.     }
  40. }
  41. $gBitSmarty->assign'delPerms'$delPerms );
  42. $gBitSmarty->assign'insPerms'$insPerms );
  43.  
  44. // check if we have installed more than one service of any given type
  45. $serviceList array();
  46. if!empty$gLibertySystem->mServices ) ) {
  47.     foreach$gLibertySystem->mServices as $service_name => $service {
  48.         ifcount$service {
  49.             $serviceList[$service_name$service;
  50.         }
  51.     }
  52. }
  53.  
  54. // if any of the serviceList items have been unchecked, disable the appropriate packages
  55. if!empty(  $_REQUEST['resolve_conflicts') ) {
  56.     if!empty$gDebug || !empty$_REQUEST['debug') ) {
  57.         $gBitInstaller->debug();
  58.         $gBitInstallDb->debug 99;
  59.     }
  60.     $fix array_merge$delPerms$insPerms );
  61.     $fixedPermissions array();
  62.     if!empty$_REQUEST['perms') ) {
  63.         foreach$_REQUEST['perms'as $perm {
  64.             $gBitInstaller->mDb->query$fix[$perm]['sql');
  65.             $fixedPermissions[$fix[$perm];
  66.         }
  67.     }
  68.     $gBitSmarty->assign'fixedPermissions'$fixedPermissions );
  69.  
  70.     $deActivated array();
  71.     foreach$serviceList as $service {
  72.         foreacharray_keys$service as $package {
  73.             if!in_array$package$_REQUEST['packages') ) {
  74.                 $gBitSystem->storeConfig'package_'.$package'n'KERNEL_PKG_NAME );
  75.                 $deActivated[$package;
  76.             }
  77.         }
  78.     }
  79.  
  80.     $gBitSmarty->assign'next_step'$step );
  81.     $gBitSmarty->assign'deActivated'$deActivated );
  82.     // display the confirmation page
  83.     $app '_done';
  84. elseif!empty(  $_REQUEST['skip') ) {
  85.     // if there were no conflicts, we move on to the next page
  86.     header"Location: ".$_SERVER['PHP_SELF']."?step=".++$step );
  87. }
  88.  
  89. $gBitSmarty->assign'serviceList'$serviceList );
  90. ?>

Documentation generated on Thu, 15 Feb 2007 20:41:27 +0000 by phpDocumentor 1.3.0