[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Installation 5 * @subpackage Controller 6 * 7 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\CMS\Installation\Controller; 12 13 use Joomla\CMS\MVC\Controller\BaseController; 14 use Joomla\CMS\MVC\View\AbstractView; 15 16 // phpcs:disable PSR1.Files.SideEffects 17 \defined('_JEXEC') or die; 18 // phpcs:enable PSR1.Files.SideEffects 19 20 /** 21 * Display controller class for the Joomla Installer. 22 * 23 * @since 3.1 24 */ 25 class DisplayController extends BaseController 26 { 27 /** 28 * Method to display a view. 29 * 30 * @param boolean $cachable If true, the view output will be cached. 31 * @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. 32 * 33 * @return \Joomla\CMS\MVC\Controller\BaseController This object to support chaining. 34 * 35 * @since 1.5 36 */ 37 public function display($cachable = false, $urlparams = false) 38 { 39 $app = $this->app; 40 41 $defaultView = 'setup'; 42 43 // If the app has already been installed, default to the remove view 44 if ( 45 file_exists(JPATH_CONFIGURATION . '/configuration.php') 46 && filesize(JPATH_CONFIGURATION . '/configuration.php') > 10 47 && file_exists(JPATH_INSTALLATION . '/index.php') 48 ) { 49 $defaultView = 'remove'; 50 } 51 52 /** @var \Joomla\CMS\Installation\Model\ChecksModel $model */ 53 $model = $this->getModel('Checks'); 54 55 $vName = $this->input->getWord('view', $defaultView); 56 57 if (!$model->getPhpOptionsSufficient() && $defaultView !== 'remove') { 58 if ($vName !== 'preinstall') { 59 $app->redirect('index.php?view=preinstall'); 60 } 61 62 $vName = 'preinstall'; 63 } else { 64 if ($vName === 'preinstall') { 65 $app->redirect('index.php?view=setup'); 66 } 67 68 if ($vName === 'remove' && !file_exists(JPATH_CONFIGURATION . '/configuration.php')) { 69 $app->redirect('index.php?view=setup'); 70 } 71 72 if ($vName !== $defaultView && !$model->getOptions() && $defaultView !== 'remove') { 73 $app->redirect('index.php'); 74 } 75 } 76 77 $this->input->set('view', $vName); 78 79 return parent::display($cachable, $urlparams); 80 } 81 82 /** 83 * Method to get a reference to the current view and load it if necessary. 84 * 85 * @param string $name The view name. Optional, defaults to the controller name. 86 * @param string $type The view type. Optional. 87 * @param string $prefix The class prefix. Optional. 88 * @param array $config Configuration array for view. Optional. 89 * 90 * @return AbstractView Reference to the view or an error. 91 * 92 * @since 3.0 93 * @throws \Exception 94 */ 95 public function getView($name = '', $type = '', $prefix = '', $config = array()) 96 { 97 $view = parent::getView($name, $type, $prefix, $config); 98 99 if ($view instanceof AbstractView) { 100 // Set some models, used by various views 101 $view->setModel($this->getModel('Checks')); 102 $view->setModel($this->getModel('Languages')); 103 } 104 105 return $view; 106 } 107 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |