Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-19181

cronjob ignores site.ini settings $ini->variable( 'RegionalSettings', 'SiteLanguageList' )

    XMLWordPrintable

    Details

      Description

      I don't know if this is a bug or a feature

      I using cronjobs with the -s siteaccess parameter

      php runcronjobs.php -s sa_en my_cronjob
      or
      php runcronjobs.php -s sa_de my_cronjob
      

      this cronjob is ussing content fetch function like tree count.

      The site.ini settings for
      SA sa_en: (only english objects should be shown)

      [SiteSettings]
      SiteURL=test.com/en
      
      [RegionalSettings]
      Locale=eng-US
      ContentObjectLocale=eng-GB
      ShowUntranslatedObjects=disabled
      SiteLanguageList[]
      SiteLanguageList[]=eng-GB
      

      SA sa_de: (only german objects should be shown)

      [SiteSettings]
      SiteURL=test.com/de
      
      [RegionalSettings]
      Locale=ger-DE
      ContentObjectLocale=ger-DE
      ShowUntranslatedObjects=disabled
      SiteLanguageList[]
      SiteLanguageList[]=ger-DE
      

      => the siteaccess switch was successfull
      => but the setting $siteIni->variable( 'RegionalSettings', 'SiteLanguageList' ) is ignored

      WHY?

      I figured out that if the global variable

      $GLOBALS['eZContentLanguageCronjobMode']

      is set all contentLanguages of the system (DB) is used!!

      // if true all languages will be fetched
      // @see eZContentLanguage::prioritizedLanguages();
      
        if ( ( !$languageListAsParameter && $ini->variable( 'RegionalSettings', 'ShowUntranslatedObjects' ) == 'enabled' ) ||
              ( isset( $GLOBALS['eZContentLanguageCronjobMode'] ) && $GLOBALS['eZContentLanguageCronjobMode'] ) )
         {
             $completeList = eZContentLanguage::fetchList();
             foreach ( $completeList as $language )
             {
                 if ( !in_array( $language->attribute( 'locale' ), $languageList ) )
                 {
                     $GLOBALS['eZContentLanguagePrioritizedLanguages'][] = $language;
                 }
             }
          }
      

      I don't expect this setting. So you can not count only german objects ... but i thought this when running the siteaccess with german sitaccess.

      here is an example cronjob that reset the $GLOBALS['eZContentLanguageCronjobMode'] so the content fetch uses the ini settings for languages:

      // in cronjobmode => true
      // var_dump ( $GLOBALS['eZContentLanguageCronjobMode'] );
      
      // disable ignoring ShowUntranslatedObjects objects setting 
      // when this is true all Languages will be used for content fetch
      $GLOBALS['eZContentLanguageCronjobMode'] = false;
      
      $script = eZScript::instance();
      
      $ini = eZINI::instance();
      //var_dump ( $GLOBALS['eZContentLanguageCronjobMode'] );
      //var_dump ( $ini->variable( 'RegionalSettings', 'SiteLanguageList' ) );
      

      What do you think - is this a bug or a feature?

      If it is a feature it should be documented.

        Attachments

          Activity

            People

            • Assignee:
              unknown unknown
              Reporter:
              felix.jac Felix Woldt
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: