Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #018492: default ini settings: value for PreCacheSiteaccessArray #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 56 additions & 78 deletions kernel/setup/steps/ezstep_create_sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand All @@ -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'];
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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] ) )
Expand Down
6 changes: 4 additions & 2 deletions settings/site.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down