[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // eZSetup 4 // 5 // Created on: <08-Nov-2002 11:00:54 kd> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 $siteBasics =& $GLOBALS['eZSiteBasics']; 30 $siteBasics['no-cache-adviced'] = true; 31 32 include_once ( "lib/eztemplate/classes/eztemplate.php" ); 33 include_once ( "lib/eztemplate/classes/eztemplatesectionfunction.php" ); 34 include_once ( "lib/eztemplate/classes/eztemplateincludefunction.php" ); 35 36 include_once ( "lib/ezutils/classes/ezhttptool.php" ); 37 38 39 // Include common functions 40 include_once ( "kernel/setup/ezsetupcommon.php" ); 41 include_once ( 'kernel/setup/steps/ezstep_data.php' ); 42 include_once ( 'kernel/setup/ezsetup_summary.php' ); 43 44 // Initialize template 45 $tpl =& eZTemplate::instance(); 46 //$tpl->registerFunction( "section", new eZTemplateSectionFunction( "section" ) ); 47 //$tpl->registerFunction( "include", new eZTemplateIncludeFunction() ); 48 49 include_once ( 'kernel/common/eztemplatedesignresource.php' ); 50 include_once ( 'lib/ezutils/classes/ezini.php' ); 51 include_once ( "lib/ezutils/classes/ezdebug.php" ); 52 $ini =& eZINI::instance(); 53 if ( $ini->variable( 'TemplateSettings', 'Debug' ) == 'enabled' ) 54 eZTemplate::setIsDebugEnabled( true ); 55 //eZDebug::setLogOnly( true ); 56 57 //$ini->setVariable( 'RegionalSettings', 'TextTranslation', 'disabled' ); 58 59 60 $Module =& $Params['Module']; 61 62 $tpl->setAutoloadPathList( $ini->variable( 'TemplateSettings', 'AutoloadPathList' ) ); 63 $tpl->autoload(); 64 65 $tpl->registerResource( eZTemplateDesignResource::instance() ); 66 67 // Initialize HTTP variables 68 $http =& eZHttpTool::instance(); 69 70 $baseDir = 'kernel/setup/'; 71 72 // Load step list data. See this file for install step references. 73 $stepDataFile = $baseDir . "steps/ezstep_data.php"; 74 $stepData = null; 75 if ( file_exists( $stepDataFile ) ) 76 { 77 include_once( $stepDataFile ); 78 $stepData = new eZStepData(); 79 } 80 if ( $stepData == null ) 81 { 82 print "<h1>Setup step data file not found. Setup is exiting...</h1>"; //TODO : i18n translate 83 eZDisplayResult( $templateResult, eZDisplayDebug() ); 84 eZExecution::cleanExit(); 85 } 86 87 $persistenceList = eZSetupFetchPersistenceList(); 88 $result = null; 89 90 // process previous step 91 $previousStepClass = null; 92 $step = null; 93 $currentStep = null; 94 95 if ( $http->hasPostVariable( 'eZSetup_back_button' ) ) // previous step selected 96 { 97 $previousStep = $http->postVariable( 'eZSetup_current_step' ); 98 $step =& $stepData->previousStep( $previousStep ); 99 $goBack = true; 100 while ( $goBack ) 101 { 102 $includeFile = $baseDir .'steps/ezstep_'.$step['file'].'.php'; 103 104 if ( file_exists( $includeFile ) ) 105 { 106 include_once( $includeFile ); 107 $className = 'eZStep'.$step['class']; 108 $stepObject = new $className( $tpl, $http, $ini, $persistenceList ); 109 110 if ( $stepObject->init() === true ) 111 { 112 $step =& $stepData->previousStep( $step ); 113 continue; 114 } 115 } 116 117 $goBack = false; 118 } 119 120 } 121 else if ( $http->hasPostVariable( 'eZSetup_refresh_button' ) ) // refresh selected step 122 { 123 $step =& $stepData->step( $http->postVariable( 'eZSetup_current_step' ) ); 124 } 125 else if ( $http->hasPostVariable( 'eZSetup_next_button' ) || $http->hasPostVariable( 'eZSetup_current_step' ) ) // next step selected, 126 { 127 // first, input from step must be processed/checked (processPostData()) 128 $currentStep = $stepData->step( $http->postVariable( 'eZSetup_current_step' ) ); 129 130 $includeFile = $baseDir .'steps/ezstep_'.$currentStep['file'].'.php'; 131 $result = array(); 132 133 if ( file_exists( $includeFile ) ) 134 { 135 include_once( $includeFile ); 136 $className = 'eZStep'.$currentStep['class']; 137 $previousStepClass = new $className( $tpl, $http, $ini, $persistenceList ); 138 139 $processPostDataResult = $previousStepClass->processPostData(); 140 $persistenceList = $previousStepClass->PersistenceList; 141 142 if ( $processPostDataResult === false ) // processing previous input failed, step must be redone 143 { 144 $step = $currentStep; 145 } 146 else if ( $processPostDataResult !== true ) // step to redo specified 147 { 148 $step =& $stepData->step( $processPostDataResult ); 149 } 150 else 151 { 152 $step =& $stepData->nextStep( $currentStep ); 153 } 154 } 155 156 } 157 else //First step, no params set. 158 { 159 $step = $stepData->step(0); //step contains file and class 160 } 161 162 $done = false; 163 $result = null; 164 165 while( !$done && $step != null ) 166 { 167 // Some common variables for all steps 168 $tpl->setVariable( "script", eZSys::serverVariable( 'PHP_SELF' ) ); 169 170 $siteBasics =& $GLOBALS['eZSiteBasics']; 171 $useIndex = $siteBasics['validity-check-required']; 172 173 if ( $useIndex ) 174 $script = eZSys::wwwDir() . eZSys::indexFileName(); 175 else 176 $script = eZSys::indexFile() . "/setup/$partName"; 177 $tpl->setVariable( 'script', $script ); 178 179 include_once ( 'lib/version.php' ); 180 $tpl->setVariable( "version", array( "text" => eZPublishSDK::version(), 181 "major" => eZPublishSDK::majorVersion(), 182 "minor" => eZPublishSDK::minorVersion(), 183 "release" => eZPublishSDK::release(), 184 "alias" => eZPublishSDK::alias() ) ); 185 186 if ( $persistenceList === null ) 187 $persistenceList = eZSetupFetchPersistenceList(); 188 $tpl->setVariableRef( 'persistence_list', $persistenceList ); 189 190 // Try to include the relevant file 191 $includeFile = $baseDir . 'steps/ezstep_'.$step['file'].'.php'; 192 $stepClass = false; 193 if ( file_exists( $includeFile ) ) 194 { 195 include_once( $includeFile ); 196 $className = 'eZStep'.$step['class']; 197 198 if ( $step == $currentStep ) // if processing post data of current step failed, use same class object. 199 { 200 $stepInstaller = $previousStepClass; 201 } 202 else 203 { 204 $stepInstaller = new $className( $tpl, $http, $ini, $persistenceList ); 205 } 206 207 $result = $stepInstaller->init(); 208 209 if( $result === true ) 210 { 211 $step =& $stepData->nextStep( $step ); 212 } 213 else if( is_int( $result ) || is_string( $result ) ) 214 { 215 $step = $stepData->step( $result ); 216 } 217 else 218 { 219 $tpl->setVariable( 'setup_current_step', $step['class'] ); // set current step 220 $result = $stepInstaller->display(); 221 $result['help'] =& $tpl->fetch( 'design:setup/init/'.$step['file'].'_help.tpl' ); 222 $done = true; 223 } 224 } 225 else 226 { 227 print( '<h1>Step '.$step['class'].' is not valid, no such file '.$includeFile.'. I\'m exiting...</h1>' ); //TODO : i18n 228 eZDisplayResult( $templateResult, eZDisplayDebug() ); 229 eZExecution::cleanExit(); 230 } 231 } 232 233 // generate summary 234 $summary = new eZSetupSummary( $tpl, $persistenceList ); 235 $result['summary'] = $summary->summary(); 236 237 // Compute install progress 238 $result['progress'] = $stepData->progress( $step ); 239 240 // Print debug information and exit. 241 eZDebug::addTimingPoint( "End" ); 242 243 return $result; 244 245 //eZDisplayResult( $templateResult, eZDisplayDebug() ); 246 247 //require_once( "lib/ezutils/classes/ezexecution.php" ); 248 //eZExecution::cleanExit(); 249 ?>
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 |