Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8917

cli.php failures due to bug in multi-site handling (fix available)

    Details

    • Type: Patch
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.0.5
    • Fix Version/s: 4.1.0
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      The CLI.php ability of CiviCRM to make CLI php calls to jobs like civimail.cronjob.php fails on multi-site installations due to a lack of support of multi-sites. This is a cascading side affect of a bug related to configuration loading.

      The cause is that the database lookups occuring are only using the default drupal tables. They are not taking into account that this is a different site as indicated by the "-s" parameter on the command line.
      This is because the site lookup which is mapped to find a Drupal settings.php file is failing. It was due to the PHP-CLI exe setting the $_SERVER['SCRIPT_NAME'] to something like "bin/foo.php". The code which searches through the possible config directories requires that the SCRIPT_NAME start with a slash.

      The patch is to add one line of code in cli.php. The line should occur after current line 106

      $_SERVER['PHP_SELF' ] ="/index.php";
      $_SERVER['HTTP_HOST']= $this->site;
      $_SERVER['REMOTE_ADDR'] = "127.0.0.1";
      if (ord($_SERVER['SCRIPT_NAME']) != 47) $_SERVER['SCRIPT_NAME'] = '/'. $_SERVER['SCRIPT_NAME']; // ************ this is patch code to insert ******************
      if (! function_exists( 'drush_get_context' ) ) {

        Attachments

          Activity

            People

            • Assignee:
              mover Michał Mach
              Reporter:
              diablodale Dale Phurrough (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: