From 728d8f95fbdd328f25342de976467df152574ba7 Mon Sep 17 00:00:00 2001 From: crevillo Date: Fri, 19 Aug 2011 14:41:01 +0200 Subject: [PATCH] Fixed #018492: default ini settings: value for PreCacheSiteaccessArray Also cleaned some already commented code and a bit of CS. --- kernel/setup/steps/ezstep_create_sites.php | 134 +++++++++------------ settings/site.ini | 6 +- 2 files changed, 60 insertions(+), 80 deletions(-) diff --git a/kernel/setup/steps/ezstep_create_sites.php b/kernel/setup/steps/ezstep_create_sites.php index 550a7876b55..dfc875e84db 100644 --- a/kernel/setup/steps/ezstep_create_sites.php +++ b/kernel/setup/steps/ezstep_create_sites.php @@ -93,25 +93,6 @@ function init() $extraLanguageCodes = isset( $this->PersistenceList['regional_info']['languages'] ) ? $this->PersistenceList['regional_info']['languages'] : array(); $extraLanguageCodes = array_diff( $extraLanguageCodes, array( $primaryLanguageCode ) ); - /* - if ( isset( $this->PersistenceList['regional_info']['variations'] ) ) - { - $variations = $this->PersistenceList['regional_info']['variations']; - foreach ( $variations as $variation ) - { - $locale = eZLocale::create( $variation ); - if ( $locale->localeCode() == $primaryLanguageCode ) - { - $primaryLanguage = $locale; - } - else - { - $variationsLanguages[] = $locale; - } - } - } - */ - if ( $primaryLanguage === null ) $primaryLanguage = eZLocale::create( $primaryLanguageCode ); @@ -124,7 +105,7 @@ function init() } // If we have already figured out charset we used that - if ( isset( $this->PersistenceList['regional_info']['site_charset'] ) and + if ( isset( $this->PersistenceList['regional_info']['site_charset'] ) && strlen( $this->PersistenceList['regional_info']['site_charset'] ) > 0 ) { $charset = $this->PersistenceList['regional_info']['site_charset']; @@ -156,58 +137,67 @@ function init() $siteINISettings = array(); $result = true; - $accessType = $siteType['access_type']; - $resultArray = array( 'errors' => array() ); + $accessType = $siteType['access_type']; + $resultArray = array( 'errors' => array() ); + + $result = $this->initializePackage( + $siteType, + $accessMap, + $charset, + $allLanguageCodes, + $allLanguages, + $primaryLanguage, + $this->PersistenceList['admin'], + $resultArray + ); + + if ( !$result ) + { + $this->Error['errors'] = array_merge( $this->Error['errors'], $resultArray['errors'] ); + $this->Error['errors'][] = array( + 'code' => 'EZSW-040', + 'text' => "Failed to initialize site package '" . $siteType['identifier'] . "'" + ); - $result = $this->initializePackage( $siteType, $accessMap, $charset, - $allLanguageCodes, $allLanguages, $primaryLanguage, $this->PersistenceList['admin'], - $resultArray ); - if ( !$result ) - { - $this->Error['errors'] = array_merge( $this->Error['errors'], $resultArray['errors'] ); - $this->Error['errors'][] = array( 'code' => 'EZSW-040', - 'text' => "Failed to initialize site package '" . $siteType['identifier'] . "'" ); - //$result = false; - return false; - } + return false; + } - if ( $resultArray['common_settings'] ) + if ( $resultArray['common_settings'] ) + { + $extraCommonSettings = $resultArray['common_settings']; + foreach ( $extraCommonSettings as $extraSetting ) { - $extraCommonSettings = $resultArray['common_settings']; - - foreach ( $extraCommonSettings as $extraSetting ) - { - if ( $extraSetting === false ) - continue; + if ( $extraSetting === false ) + continue; - $iniName = $extraSetting['name']; - $settings = $extraSetting['settings']; - $resetArray = false; - if ( isset( $extraSetting['reset_arrays'] ) ) - $resetArray = $extraSetting['reset_arrays']; + $iniName = $extraSetting['name']; + $settings = $extraSetting['settings']; + $resetArray = false; + if ( isset( $extraSetting['reset_arrays'] ) ) + $resetArray = $extraSetting['reset_arrays']; - if ( $iniName == 'site.ini' ) - { - $siteINISettings[] = $settings; - continue; - } + if ( $iniName == 'site.ini' ) + { + $siteINISettings[] = $settings; + continue; + } - if ( file_exists( 'settings/override/' . $iniName . '.append' ) || - file_exists( 'settings/override/' . $iniName . '.append.php' ) ) - { - $tmpINI = eZINI::instance( $iniName, 'settings/override', null, null, false, true ); - } - else - { - $tmpINI = eZINI::create( $iniName ); - } + if ( file_exists( 'settings/override/' . $iniName . '.append' ) || + file_exists( 'settings/override/' . $iniName . '.append.php' ) ) + { + $tmpINI = eZINI::instance( $iniName, 'settings/override', null, null, false, true ); + } + else + { + $tmpINI = eZINI::create( $iniName ); + } // Set ReadOnlySettingsCheck to false: towards // Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables. - $tmpINI->setReadOnlySettingsCheck( false ); - $tmpINI->setVariables( $settings ); - $tmpINI->save( false, '.append.php', false, true, "settings/override", $resetArray ); - } + $tmpINI->setReadOnlySettingsCheck( false ); + $tmpINI->setVariables( $settings ); + $tmpINI->save( false, '.append.php', false, true, "settings/override", $resetArray ); } + } if ( !$result ) { @@ -242,21 +232,7 @@ function init() $saveResult = true; if ( $saveData ) $saveResult = $imageINI->save( false, '.php', 'append', true ); - - if ( $saveResult and - $charset !== false ) - { - /*$i18nINI = eZINI::create( 'i18n.ini' ); - // Set ReadOnlySettingsCheck to false: towards - // Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables. - $i18nINI->setReadOnlySettingsCheck( false ); - - $i18nINI->setVariable( 'CharacterSettings', 'Charset', $charset ); - if ( $saveData ) - $saveResult = $i18nINI->save( false, '.php', 'append', true ); - */ - } - + switch ( $accessType ) { case 'port': @@ -289,12 +265,14 @@ function init() { $ini->setVariable( 'PortAccessSettings', $port, $siteAccessName ); } + $ini->setVariable( 'SiteSettings', 'SiteList', $accessMap['sites'] ); $ini->setVariable( 'SiteAccessSettings', 'AvailableSiteAccessList', $accessMap['accesses'] ); $ini->setVariable( "SiteAccessSettings", "CheckValidity", "false" ); $ini->setVariable( 'Session', 'SessionNameHandler', 'custom' ); $ini->setVariable( 'MailSettings', 'AdminEmail', $this->PersistenceList['admin']['email'] ); $ini->setVariable( 'MailSettings', 'EmailSender', false ); + $ini->setVariable( 'ContentSettings', 'PreCacheSiteaccessArray', $accessMap['accesses'] ); $defaultAccess = 'admin'; if ( isset( $accessMap['accesses'][0] ) ) diff --git a/settings/site.ini b/settings/site.ini index de7d7397a61..99a481ad319 100755 --- a/settings/site.ini +++ b/settings/site.ini @@ -1139,8 +1139,10 @@ EditDirtyObjectAction=showversions # Set to 'enabled' to make eZ Publish pre-cache the view cache files on publishing PreViewCache=disabled # List of siteaccesses that will have preview cache generated on publish. -PreCacheSiteaccessArray[]=admin -PreCacheSiteaccessArray[]=base +# e.g. +# PreCacheSiteaccessArray[]=news +# PreCacheSiteaccessArray[]=plain +PreCacheSiteaccessArray[] # A list of users to pre-generate the content cache for # The list should contain the User ID or a special identifier, possible identifiers are: # - 'anonymous' for the anonymous user.