/** * The summary of all settings available. * * The menu items displayed here are collected from each application's * application controller and all plugin's definitions. * * @since 2.0.0 * @access public */ public function index() { $this->ApplicationFolder = 'dashboard'; $this->MasterView = 'setup'; // Fatal error if Garden has already been installed. $Installed = c('Garden.Installed'); if ($Installed) { $this->View = "AlreadyInstalled"; $this->render(); return; } if (!$this->_CheckPrerequisites()) { $this->View = 'prerequisites'; } else { $this->View = 'configure'; // Make sure the user has copied the htaccess file over. if (!file_exists(PATH_ROOT . '/.htaccess') && !$this->Form->getFormValue('SkipHtaccess')) { $this->setData('NoHtaccess', true); $this->Form->addError(t('You are missing Vanilla\'s .htaccess file.', 'You are missing Vanilla\'s <b>.htaccess</b> file. Sometimes this file isn\'t copied if you are using ftp to upload your files because this file is hidden. Make sure you\'ve copied the <b>.htaccess</b> file before continuing.')); } $ApplicationManager = new Gdn_ApplicationManager(); // Need to go through all of the setups for each application. Garden, if ($this->configure() && $this->Form->isPostBack()) { // Get list of applications to enable during install // Override by creating the config and adding this setting before install begins $AppNames = c('Garden.Install.Applications', array('Conversations', 'Vanilla')); try { // Step through the available applications, enabling each of them. foreach ($AppNames as $AppName) { $Validation = new Gdn_Validation(); $ApplicationManager->RegisterPermissions($AppName, $Validation); $ApplicationManager->EnableApplication($AppName, $Validation); } Gdn::pluginManager()->start(true); } catch (Exception $ex) { $this->Form->addError($ex); } if ($this->Form->errorCount() == 0) { // Save a variable so that the application knows it has been installed. // Now that the application is installed, select a more user friendly error page. $Config = array('Garden.Installed' => true); saveToConfig($Config); $this->fireEvent('Installed'); PermissionModel::ResetAllRoles(); // Go to the dashboard redirect('/settings/gettingstarted'); } } } $this->render(); }
/** * Enable applications and create permisisions for roles. * * @return void */ protected function enableApplications() { $ApplicationManager = new Gdn_ApplicationManager(); $AppNames = c('Garden.Install.Applications', ['Conversations', 'Vanilla']); foreach ($AppNames as $AppName) { $Validation = new Gdn_Validation(); $ApplicationManager->RegisterPermissions($AppName, $Validation); $ApplicationManager->EnableApplication($AppName, $Validation); } Gdn::pluginManager()->start(true); // Flag the application as installed saveToConfig('Garden.Installed', true); // Setup default permissions for all roles PermissionModel::ResetAllRoles(); }