| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/Topogeo/ojs/classes/install/ |
Upload File : |
<?php
/**
* @file classes/install/Install.inc.php
*
* Copyright (c) 2003-2012 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class Install
* @ingroup install
* @see Installer, InstallForm
*
* @brief Perform system installation.
*
* This script will:
* - Create the database (optionally), and install the database tables and initial data.
* - Update the config file with installation parameters.
*/
// Default installation data
define('INSTALLER_DEFAULT_SITE_TITLE', 'common.openJournalSystems');
define('INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH', 6);
import('lib.pkp.classes.install.PKPInstall');
class Install extends PKPInstall {
/**
* Constructor.
* @see install.form.InstallForm for the expected parameters
* @param $params array installer parameters
* @param $descriptor string descriptor path
* @param $isPlugin boolean true iff a plugin is being installed
*/
function Install($params, $descriptor = 'install.xml', $isPlugin = false) {
parent::PKPInstall($descriptor, $params, $isPlugin);
}
//
// Installer actions
//
/**
* Get the names of the directories to create.
* @return array
*/
function getCreateDirectories() {
$directories = parent::getCreateDirectories();
$directories[] = 'journals';
return $directories;
}
/**
* Create initial required data.
* @return boolean
*/
function createData() {
// Add initial site data
$locale = $this->getParam('locale');
$siteDao =& DAORegistry::getDAO('SiteDAO', $this->dbconn);
$site = new Site();
$site->setRedirect(0);
$site->setMinPasswordLength(INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH);
$site->setPrimaryLocale($locale);
$site->setInstalledLocales($this->installedLocales);
$site->setSupportedLocales($this->installedLocales);
if (!$siteDao->insertSite($site)) {
$this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
return false;
}
$siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
$siteSettingsDao->updateSetting('title', array($locale => __(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
$siteSettingsDao->updateSetting('contactName', array($locale => __(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
$siteSettingsDao->updateSetting('contactEmail', array($locale => $this->getParam('adminEmail')), null, true);
// Add initial site administrator user
$userDao =& DAORegistry::getDAO('UserDAO', $this->dbconn);
$user = new User();
$user->setUsername($this->getParam('adminUsername'));
$user->setPassword(Validation::encryptCredentials($this->getParam('adminUsername'), $this->getParam('adminPassword'), $this->getParam('encryption')));
$user->setFirstName($user->getUsername());
$user->setLastName('');
$user->setEmail($this->getParam('adminEmail'));
if (!$userDao->insertUser($user)) {
$this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
return false;
}
$roleDao =& DAORegistry::getDao('RoleDAO', $this->dbconn);
$role = new Role();
$role->setJournalId(0);
$role->setUserId($user->getId());
$role->setRoleId(ROLE_ID_SITE_ADMIN);
if (!$roleDao->insertRole($role)) {
$this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
return false;
}
// Install email template list and data for each locale
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
$emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename());
foreach ($this->installedLocales as $locale) {
$emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale));
}
// Install filters and filter templates.
$this->installFilterTemplates();
return true;
}
}
?>