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

Injected PathPrefix not respected when rootDir is used in eZINI::instance

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: High High
    • Customer request
    • 5.4.6
    • Legacy bridge
    • None

    Description

      Injected PathPrefix is not properly loaded if siteaccess settings is selected through the use of rootDir parameter in eZINI::instance (or new EZINI)

      steps to reproduce
      • Install an updated eZ Publish 5.4
      • Setup a couple of front end siteacceses (ex: eng and ger)
      • Create a couple of folders to be used as home location for each siteaccess
      • Configure content.tree_root.location_id with different values for both siteaccesses
      • create a script to test new eZINI behavior (see below)
      • execute the script for each siteaccess -siteaccess=eng and -siteaccess=ger
        => The PathPrefix value does not reflect the siteaccess identified in rootDir (it always reflect the siteaccess passed in command line
      testcase.php
      <?php
          set_time_limit( 0 );
          require 'autoload.php';
          $cli = eZCLI::instance();
          $script = eZScript::instance( array( 'debug-message' => '',
                                               'description' => ( "Test Settings" ),
                                               'use-session' => false,
                                               'use-modules' => true,
                                               'use-extensions' => true
          ) );
          $script->startup();
          $options = $script->getOptions();
          $script->initialize();
          $siteaccess = $script->usedSiteAccess();
          $cli->output( 'Starting settings test with siteaccess ' . $siteaccess );
          
          $ini = new eZINI( 'site.ini' );
          $ini_from_eng = new eZINI( 'site.ini', 'settings/siteaccess/eng' );
          $ini_from_ger = new eZINI( 'site.ini', 'settings/siteaccess/ger' );
          
          $pathPrefix= $ini->variable('SiteAccessSettings', 'PathPrefix');
          $pathPrefix_from_eng = $ini_from_eng->variable('SiteAccessSettings', 'PathPrefix');
          $pathPrefix_from_ger = $ini_from_ger->variable('SiteAccessSettings', 'PathPrefix');
          
          $cli->output( "");
          $cli->output( "PathPrefix from current siteaccess: $pathPrefix" );
          $cli->output( "PathPrefix from eng: $pathPrefix_from_eng" );
          $cli->output( "PathPrefix from ger: $pathPrefix_from_ger" );
          
          $cli->output( 'execution done' );    
          
          $script->shutdown();
      
      ezpublish.yml
          system:
              eng:
                  content:
                      tree_root:
                          location_id: 126
              ger:
                  content:
                      tree_root:
                          location_id: 127
      

      Related to this issue, another odd behavior has been described in EZP-25827
      Use case that can be tested, relating it to this issue

      steps to reproduce
      • In the above setup, define PathPrefix at legacy level, in settings/siteaccess/eng/site.ini.append.php and settings/siteaccess/ger/site.ini.append.php
      • execute the same script
        => PathPrefix is now empty, for variables pulled from eZINI with rootDir parameter set

      If the script is changed as follows (instead of using 'site.ini' as filename, we'll now use 'site.ini.append.php'), the legacy defined values are handled as expected

      <?php
          set_time_limit( 0 );
          require 'autoload.php';
          $cli = eZCLI::instance();
          $script = eZScript::instance( array( 'debug-message' => '',
                                               'description' => ( "Test Settings" ),
                                               'use-session' => false,
                                               'use-modules' => true,
                                               'use-extensions' => true
          ) );
          $script->startup();
          $options = $script->getOptions();
          $script->initialize();
          $siteaccess = $script->usedSiteAccess();
          $cli->output( 'Starting settings test with siteaccess ' . $siteaccess );
          
          $ini = new eZINI( 'site.ini' );
          $ini_from_eng = new eZINI( 'site.ini.append.php', 'settings/siteaccess/eng' );
          $ini_from_ger = new eZINI( 'site.ini.append.php', 'settings/siteaccess/ger' );
          
          $pathPrefix= $ini->variable('SiteAccessSettings', 'PathPrefix');
          $pathPrefix_from_eng = $ini_from_eng->variable('SiteAccessSettings', 'PathPrefix');
          $pathPrefix_from_ger = $ini_from_ger->variable('SiteAccessSettings', 'PathPrefix');
          
          $cli->output( "");
          $cli->output( "PathPrefix from current siteaccess: $pathPrefix" );
          $cli->output( "PathPrefix from eng: $pathPrefix_from_eng" );
          $cli->output( "PathPrefix from ger: $pathPrefix_from_ger" );
          
          $cli->output( 'execution done' );    
          
          $script->shutdown();
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            joaquim.cavalleri-obsolete@ez.no Joaquim Cavalleri (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: