[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <11-Aug-2003 18:12:39 amos> 4 // 5 // SOFTWARE NAME: eZ publish 6 // SOFTWARE RELEASE: 3.9.0 7 // BUILD VERSION: 17785 8 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 9 // SOFTWARE LICENSE: GNU General Public License v2.0 10 // NOTICE: > 11 // This program is free software; you can redistribute it and/or 12 // modify it under the terms of version 2.0 of the GNU General 13 // Public License as published by the Free Software Foundation. 14 // 15 // This program is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of version 2.0 of the GNU General 21 // Public License along with this program; if not, write to the Free 22 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 // MA 02110-1301, USA. 24 // 25 // 26 27 include_once ( "kernel/common/template.php" ); 28 include_once ( "kernel/classes/ezpackage.php" ); 29 30 $http =& eZHTTPTool::instance(); 31 32 $module =& $Params['Module']; 33 $packageName =& $Params['PackageName']; 34 $currentItem = 0; 35 $doItemInstall = false; 36 37 if ( $http->hasSessionVariable( 'eZPackageInstallerData' ) ) 38 { 39 $persistentData = $http->sessionVariable( 'eZPackageInstallerData' ); 40 if ( isset( $persistentData['currentItem'] ) ) 41 $currentItem = $persistentData['currentItem']; 42 } 43 else 44 { 45 $persistentData = array(); 46 $persistentData['currentItem'] = $currentItem; 47 $persistentData['error'] = array(); 48 $persistentData['error_default_actions'] = array(); 49 } 50 51 if ( !eZPackage::canUsePolicyFunction( 'install' ) ) 52 return $module->handleError( EZ_ERROR_KERNEL_ACCESS_DENIED, 'kernel' ); 53 54 $package = eZPackage::fetch( $packageName ); 55 if ( !$package ) 56 return $module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' ); 57 58 if ( $module->isCurrentAction( 'SkipPackage' ) ) 59 { 60 $http->removeSessionVariable( 'eZPackageInstallerData' ); 61 return $module->redirectToView( 'view', array( 'full', $package->attribute( 'name' ) ) ); 62 } 63 64 $tpl =& templateInit(); 65 66 // Get all uninstall items and reverse array 67 $uninstallItems = array_reverse( $package->installItemsList( false, false, false, false ) ); 68 69 if ( $module->isCurrentAction( 'HandleError' ) ) 70 { 71 // Choosing error action 72 if ( $module->hasActionParameter( 'ActionID' ) ) 73 { 74 $choosenAction = $module->actionParameter( 'ActionID' ); 75 $persistentData['error']['choosen_action'] = $choosenAction; 76 if ( $module->hasActionParameter( 'RememberAction' ) ) 77 { 78 $errorCode = $persistentData['error']['error_code']; 79 $itemType = $uninstallItems[$currentItem]['type']; 80 if ( !isset( $persistentData['error_default_actions'][$itemType] ) ) 81 $persistentData['error_default_actions'][$itemType] = array(); 82 $persistentData['error_default_actions'][$itemType][$errorCode] = $choosenAction; 83 } 84 } 85 elseif ( !isset( $persistentData['error']['error_code'] ) ) 86 { 87 // If this is an unhandled error, we are skipping this item 88 $currentItem++; 89 } 90 $doItemInstall = true; 91 } 92 elseif ( $module->isCurrentAction( 'UninstallPackage' ) ) 93 { 94 $doItemInstall = true; 95 } 96 else 97 { 98 $uninstallElements = array(); 99 foreach ( $uninstallItems as $uninstallItem ) 100 { 101 $handler =& eZPackage::packageHandler( $uninstallItem['type'] ); 102 if ( $handler ) 103 { 104 $uninstallElement = $handler->explainInstallItem( $package, $uninstallItem, true ); 105 106 if ( $uninstallElement ) 107 { 108 if ( isset( $uninstallElement[0] ) ) 109 $uninstallElements = array_merge( $uninstallElements, $uninstallElement ); 110 else 111 $uninstallElements[] = $uninstallElement; 112 } 113 } 114 } 115 116 $templateName = "design:package/uninstall.tpl"; 117 $tpl->setVariable( 'uninstall_elements', $uninstallElements ); 118 } 119 120 if ( $doItemInstall ) 121 { 122 while( $currentItem < count( $uninstallItems ) ) 123 { 124 $uninstallItem = $uninstallItems[$currentItem]; 125 $result = $package->uninstallItem( $uninstallItem, $persistentData ); 126 127 if ( !$result ) 128 { 129 $templateName = "design:package/uninstall_error.tpl"; 130 break; 131 } 132 else 133 { 134 $persistentData['error'] = array(); 135 $currentItem++; 136 } 137 } 138 } 139 140 if ( $currentItem >= count( $uninstallItems ) ) 141 { 142 $package->setInstalled( false ); 143 $http->removeSessionVariable( 'eZPackageInstallerData' ); 144 return $module->redirectToView( 'view', array( 'full', $package->attribute( 'name' ) ) ); 145 } 146 147 $persistentData['currentItem'] = $currentItem; 148 $http->setSessionVariable( 'eZPackageInstallerData', $persistentData ); 149 $tpl->setVariable( 'persistent_data', $persistentData ); 150 $tpl->setVariable( 'package', $package ); 151 152 $Result = array(); 153 $Result['content'] =& $tpl->fetch( $templateName ); 154 $Result['path'] = array( array( 'url' => 'package/list', 155 'text' => ezi18n( 'kernel/package', 'Packages' ) ), 156 array( 'url' => false, 157 'text' => ezi18n( 'kernel/package', 'Uninstall' ) ) ); 158 159 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |