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

Better detect the config dir in Drupal installations.

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: 4.1.2
    • Fix Version/s: Unscheduled
    • Component/s: Core CiviCRM
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      From IRC, my monologue:

      00:51 < Yaroon> Oh, guys, I noticed my cron jobs werent running...
      00:52 < Yaroon> And I think I got another improvement in how civicrm works within Drupal.
      00:52 < Yaroon> CiviCRM only suggests civicrm be installed in sites/all/modules
      00:52 < Yaroon> But it's often a good idea (as we always do here at Krimson) to install modules either in contrib/ or custom/
      00:53 < Yaroon> So we deploy everything under sites/all/modules/contrib/ and thus sites/all/modules/contrib/civicrm
      00:54 < Yaroon> But this is what cli.php does to find the config dir:
      00:54 < Yaroon> if ( strpos( $currentDir, 'sites' . DIRECTORY_SEPARATOR . 'all' . DIRECTORY_SEPARATOR . 'modules' ) !== false ) {
      00:54 < Yaroon> $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';
      00:54 < Yaroon> So it checks to see if sites/all/modules is in the path...
      00:54 < Yaroon> And then it decides the confdir is up 3 folders... not caring about however far down the path your civicrm might be installed.
      00:55 < Yaroon> In our case it's under modules/contrib and not modules... so CiviCRM doesn't go up far enough.
      00:55 < Yaroon> This is better I think:
      00:55 < Yaroon> $confdir = preg_replace('/sites
      ' . DIRECTORY_SEPARATOR . 'all
      ' . DIRECTORY_SEPARATOR . 'modules.*/', 'sites', $currentDir);
      00:56 < Yaroon> Replace the sites/all/moduleswhateverelsefollowsinthepath with: sites
      00:56 < Yaroon> And you'll get the path down to sites (in which it goes down into default/ a bit further on and finds civicrm.settings.php)

      So! in bin/cli.php change line 72 and 73 from:

      // seems like this is in drupal5 dir location
      $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';

      to:

      // seems like this is in drupal installation, the confdir will be /your/path/to/drupal/sites/
      $confdir = preg_replace('/sites
      ' . DIRECTORY_SEPARATOR . 'all
      ' . DIRECTORY_SEPARATOR . 'modules.*/', 'sites', $currentDir);

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jeroen Jeroen Bensch
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: