Mage_Install_WizardController Class Reference

Inheritance diagram for Mage_Install_WizardController:

Mage_Install_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 preDispatch ()
 indexAction ()
 beginAction ()
 beginPostAction ()
 localeAction ()
 localeChangeAction ()
 localePostAction ()
 downloadAction ()
 downloadPostAction ()
 downloadAutoAction ()
 installAction ()
 installSuccessCallback ()
 installFailureCallback ()
 downloadManualAction ()
 configAction ()
 configPostAction ()
 installDbAction ()
 administratorAction ()
 administratorPostAction ()
 endAction ()
 checkHostAction ()
 checkSecureHostAction ()

Protected Member Functions

 _getInstaller ()
 _getWizard ()
 _prepareLayout ()
 _checkIfInstalled ()


Detailed Description

Installation wizard controller

Definition at line 30 of file WizardController.php.


Member Function Documentation

_checkIfInstalled (  )  [protected]

Checking installation status

Returns:
unknown

Definition at line 81 of file WizardController.php.

00082     {
00083         if ($this->_getInstaller()->isApplicationInstalled()) {
00084             $this->getResponse()->setRedirect(Mage::getBaseUrl())->sendResponse();
00085             exit;
00086         }
00087         return true;
00088     }

_getInstaller (  )  [protected]

Retrieve installer object

Returns:
Mage_Install_Model_Installer

Definition at line 43 of file WizardController.php.

00044     {
00045         return Mage::getSingleton('install/installer');
00046     }

_getWizard (  )  [protected]

Retrieve wizard

Returns:
Mage_Install_Model_Wizard

Definition at line 53 of file WizardController.php.

00054     {
00055         return Mage::getSingleton('install/wizard');
00056     }

_prepareLayout (  )  [protected]

Prepare layout

Returns:
unknown

Definition at line 63 of file WizardController.php.

00064     {
00065         $this->loadLayout('install_wizard');
00066         $step = $this->_getWizard()->getStepByRequest($this->getRequest());
00067         if ($step) {
00068             $step->setActive(true);
00069         }
00070 
00071         $leftBlock = $this->getLayout()->createBlock('install/state', 'install.state');
00072         $this->getLayout()->getBlock('left')->append($leftBlock);
00073         return $this;
00074     }

administratorAction (  ) 

Install admininstrator account

Definition at line 363 of file WizardController.php.

00364     {
00365         $this->_checkIfInstalled();
00366 
00367         $this->_prepareLayout();
00368         $this->_initLayoutMessages('install/session');
00369 
00370         $this->getLayout()->getBlock('content')->append(
00371             $this->getLayout()->createBlock('install/admin', 'install.administrator')
00372         );
00373         $this->renderLayout();
00374     }

administratorPostAction (  ) 

Process administrator instalation POST data

Definition at line 379 of file WizardController.php.

00380     {
00381         $this->_checkIfInstalled();
00382 
00383         $step = Mage::getSingleton('install/wizard')->getStepByName('administrator');
00384         $adminData      = $this->getRequest()->getPost('admin');
00385         $encryptionKey  = $this->getRequest()->getPost('encryption_key');
00386 
00387         try {
00388             $this->_getInstaller()->createAdministrator($adminData)
00389                 ->installEnryptionKey($encryptionKey);
00390         }
00391         catch (Exception $e){
00392             Mage::getSingleton('install/session')
00393                 ->setAdminData($adminData)
00394                 ->addError($e->getMessage());
00395             $this->getResponse()->setRedirect($step->getUrl());
00396             return false;
00397         }
00398         $this->getResponse()->setRedirect($step->getNextUrl());
00399     }

beginAction (  ) 

Begin installation action

Definition at line 101 of file WizardController.php.

00102     {
00103         $this->_checkIfInstalled();
00104 
00105         $this->setFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT, true);
00106         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
00107 
00108         $this->_prepareLayout();
00109         $this->_initLayoutMessages('install/session');
00110 
00111         $this->getLayout()->getBlock('content')->append(
00112             $this->getLayout()->createBlock('install/begin', 'install.begin')
00113         );
00114 
00115         $this->renderLayout();
00116     }

beginPostAction (  ) 

Process begin step POST data

Definition at line 121 of file WizardController.php.

00122     {
00123         $this->_checkIfInstalled();
00124 
00125         $agree = $this->getRequest()->getPost('agree');
00126         if ($agree && $step = $this->_getWizard()->getStepByName('begin')) {
00127             $this->getResponse()->setRedirect($step->getNextUrl());
00128         }
00129         else {
00130             $this->_redirect('install');
00131         }
00132     }

checkHostAction (  ) 

Host validation response

Definition at line 429 of file WizardController.php.

00430     {
00431         $this->getResponse()->setHeader('Transfer-encoding', '', true);
00432         $this->getResponse()->setBody(Mage_Install_Model_Installer::INSTALLER_HOST_RESPONSE);
00433     }

checkSecureHostAction (  ) 

Host validation response

Definition at line 438 of file WizardController.php.

00439     {
00440         $this->getResponse()->setHeader('Transfer-encoding', '', true);
00441         $this->getResponse()->setBody(Mage_Install_Model_Installer::INSTALLER_HOST_RESPONSE);
00442     }

configAction (  ) 

Configuration data installation

Definition at line 278 of file WizardController.php.

00279     {
00280         $this->_checkIfInstalled();
00281         $this->_getInstaller()->checkServer();
00282 
00283         $this->setFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT, true);
00284         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
00285 
00286         if ($data = $this->getRequest()->getQuery('config')) {
00287             Mage::getSingleton('install/session')->setLocaleData($data);
00288         }
00289 
00290         $this->_prepareLayout();
00291         $this->_initLayoutMessages('install/session');
00292         $this->getLayout()->getBlock('content')->append(
00293             $this->getLayout()->createBlock('install/config', 'install.config')
00294         );
00295 
00296         $this->renderLayout();
00297     }

configPostAction (  ) 

Process configuration POST data

Definition at line 302 of file WizardController.php.

00303     {
00304         $this->_checkIfInstalled();
00305         $step = $this->_getWizard()->getStepByName('config');
00306 
00307         if ($data = $this->getRequest()->getPost('config')) {
00308             //make all table prefix to lower letter
00309             if ($data['db_prefix'] !='') {
00310                $data['db_prefix'] = strtolower($data['db_prefix']);
00311             }
00312 
00313             Mage::getSingleton('install/session')
00314                 ->setConfigData($data)
00315                 ->setSkipUrlValidation($this->getRequest()->getPost('skip_url_validation'))
00316                 ->setSkipBaseUrlValidation($this->getRequest()->getPost('skip_base_url_validation'));
00317             try {
00318                 if($data['db_prefix']!='') {
00319                     if(!preg_match('/^[a-z]+[a-z0-9_]*$/',$data['db_prefix'])) {
00320                         Mage::throwException(
00321                             Mage::helper('install')->__('Table prefix should contain only letters (a-z), numbers (0-9) or underscore(_), first character should be a letter'));
00322                     }
00323                 }
00324                 $this->_getInstaller()->installConfig($data);
00325                 $this->_redirect('*/*/installDb');
00326                 return $this;
00327             }
00328             catch (Exception $e){
00329                 Mage::getSingleton('install/session')->addError($e->getMessage());
00330                 $this->getResponse()->setRedirect($step->getUrl());
00331             }
00332         }
00333         $this->getResponse()->setRedirect($step->getUrl());
00334     }

downloadAction (  ) 

Definition at line 186 of file WizardController.php.

00187     {
00188         $this->_checkIfInstalled();
00189         $this->setFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT, true);
00190         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
00191 
00192         $this->_prepareLayout();
00193         $this->_initLayoutMessages('install/session');
00194         $this->getLayout()->getBlock('content')->append(
00195             $this->getLayout()->createBlock('install/download', 'install.download')
00196         );
00197 
00198         $this->renderLayout();
00199     }

downloadAutoAction (  ) 

Definition at line 223 of file WizardController.php.

00224     {
00225         $step = $this->_getWizard()->getStepByName('download');
00226         $this->getResponse()->setRedirect($step->getNextUrl());
00227     }

downloadManualAction (  ) 

Definition at line 265 of file WizardController.php.

00266     {
00267         $step = $this->_getWizard()->getStepByName('download');
00268         #if (!$this->_getInstaller()->checkDownloads()) {
00269         #    $this->getResponse()->setRedirect($step->getUrl());
00270         #} else {
00271         $this->getResponse()->setRedirect($step->getNextUrl());
00272         #}
00273     }

downloadPostAction (  ) 

Definition at line 201 of file WizardController.php.

00202     {
00203         $this->_checkIfInstalled();
00204         switch ($this->getRequest()->getPost('continue')) {
00205             case 'auto':
00206                 $this->_forward('downloadAuto');
00207                 break;
00208 
00209             case 'manual':
00210                 $this->_forward('downloadManual');
00211                 break;
00212 
00213             case 'svn':
00214                 $step = $this->_getWizard()->getStepByName('download');
00215                 $this->getResponse()->setRedirect($step->getNextUrl());
00216                 break;
00217 
00218             default:
00219                 $this->_redirect('*/*/download');
00220         }
00221     }

endAction (  ) 

End installation

Definition at line 404 of file WizardController.php.

00405     {
00406         $this->_checkIfInstalled();
00407 
00408         $date = (string)Mage::getConfig()->getNode('global/install/date');
00409         if ($date !== Mage_Install_Model_Installer_Config::TMP_INSTALL_DATE_VALUE) {
00410             $this->_redirect('*/*');
00411             return;
00412         }
00413 
00414         $this->_getInstaller()->finish();
00415 
00416         $this->_prepareLayout();
00417         $this->_initLayoutMessages('install/session');
00418 
00419         $this->getLayout()->getBlock('content')->append(
00420             $this->getLayout()->createBlock('install/end', 'install.end')
00421         );
00422         $this->renderLayout();
00423         Mage::getSingleton('install/session')->clear();
00424     }

indexAction (  ) 

Index action

Definition at line 93 of file WizardController.php.

00094     {
00095         $this->_forward('begin');
00096     }

installAction (  ) 

Definition at line 229 of file WizardController.php.

00230     {
00231         $pear = Varien_Pear::getInstance();
00232         $params = array('comment'=>Mage::helper('install')->__("Downloading and installing Magento, please wait...")."\r\n\r\n");
00233         if ($this->getRequest()->getParam('do')) {
00234             if ($state = $this->getRequest()->getParam('state', 'beta')) {
00235                 $result = $pear->runHtmlConsole(array(
00236                 'comment'   => Mage::helper('install')->__("Setting preferred state to: %s", $state)."\r\n\r\n",
00237                 'command'   => 'config-set',
00238                 'params'    => array('preferred_state', $state)
00239                 ));
00240                 if ($result instanceof PEAR_Error) {
00241                     $this->installFailureCallback();
00242                     exit;
00243                 }
00244             }
00245             $params['command'] = 'install';
00246             $params['options'] = array('onlyreqdeps'=>1);
00247             $params['params'] = Mage::getModel('install/installer_pear')->getPackages();
00248             $params['success_callback'] = array($this, 'installSuccessCallback');
00249             $params['failure_callback'] = array($this, 'installFailureCallback');
00250         }
00251         $pear->runHtmlConsole($params);
00252         Mage::app()->getFrontController()->getResponse()->clearAllHeaders();
00253     }

installDbAction (  ) 

Install DB

Clear session config data

Definition at line 339 of file WizardController.php.

00340     {
00341         $this->_checkIfInstalled();
00342         $step = $this->_getWizard()->getStepByName('config');
00343         try {
00344             $this->_getInstaller()->installDb();
00345             /**
00346              * Clear session config data
00347              */
00348             Mage::getSingleton('install/session')->getConfigData(true);
00349 
00350             Mage::app()->getStore()->resetConfig();
00351 
00352             $this->getResponse()->setRedirect(Mage::getUrl($step->getNextUrlPath()));
00353         }
00354         catch (Exception $e){
00355             Mage::getSingleton('install/session')->addError($e->getMessage());
00356             $this->getResponse()->setRedirect($step->getUrl());
00357         }
00358     }

installFailureCallback (  ) 

Definition at line 260 of file WizardController.php.

00261     {
00262         echo 'parent.installFailure()';
00263     }

installSuccessCallback (  ) 

Definition at line 255 of file WizardController.php.

00256     {
00257         echo 'parent.installSuccess()';
00258     }

localeAction (  ) 

Localization settings

Definition at line 137 of file WizardController.php.

00138     {
00139         $this->_checkIfInstalled();
00140         $this->setFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT, true);
00141         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
00142 
00143         $this->_prepareLayout();
00144         $this->_initLayoutMessages('install/session');
00145         $this->getLayout()->getBlock('content')->append(
00146             $this->getLayout()->createBlock('install/locale', 'install.locale')
00147         );
00148 
00149         $this->renderLayout();
00150     }

localeChangeAction (  ) 

Change current locale

Definition at line 155 of file WizardController.php.

00156     {
00157         $this->_checkIfInstalled();
00158 
00159         $locale = $this->getRequest()->getParam('locale');
00160         $timezone = $this->getRequest()->getParam('timezone');
00161         $currency = $this->getRequest()->getParam('currency');
00162         if ($locale) {
00163             Mage::getSingleton('install/session')->setLocale($locale);
00164             Mage::getSingleton('install/session')->setTimezone($timezone);
00165             Mage::getSingleton('install/session')->setCurrency($currency);
00166         }
00167 
00168         $this->_redirect('*/*/locale');
00169     }

localePostAction (  ) 

Saving localization settings

Definition at line 174 of file WizardController.php.

00175     {
00176         $this->_checkIfInstalled();
00177         $step = $this->_getWizard()->getStepByName('locale');
00178 
00179         if ($data = $this->getRequest()->getPost('config')) {
00180             Mage::getSingleton('install/session')->setLocaleData($data);
00181         }
00182 
00183         $this->getResponse()->setRedirect($step->getNextUrl());
00184     }

preDispatch (  ) 

Dispatches event before action

Reimplemented from Mage_Core_Controller_Varien_Action.

Definition at line 32 of file WizardController.php.

00033     {
00034         $this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, true);
00035         return parent::preDispatch();
00036     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:28 2009 for Magento by  doxygen 1.5.8