CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Calling a civicrm code from the shell ?
Pages: [1]

Author Topic: Calling a civicrm code from the shell ?  (Read 1298 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Calling a civicrm code from the shell ?
April 23, 2008, 03:10:17 pm
Hello,

For some cases, like the cron calls,

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviMail+Installation#CiviMailInstallation-SettingUptheCronJob

it would make more sense to call a php from the shell instead of wget it via the webserver.

I saw various bin (/extern) programs. I tried to run them in a multisite config

I modified settings_location.php to set the proper drupal dir, but it looks on default. I want to be able to set the site as a param, but didn't succeed.

am I missing something ? What is the proper syntax ?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Calling a civicrm code from the shell ?
April 23, 2008, 04:08:32 pm
And to answer my own question, I've hacked the settings_location.php that way:

Code: [Select]
// the directory name for your 'sites' location in drupal. We use the below location
// along with drupal 'conf_init()' function to figure out where the settings files
// are located. This is primarily used when we hit CiviCRM outside of 'Drupal' (via mail/soap
// etc)

//you can pass an extra param, the site name for the multisite drupal config
//SYNTAX: php soap.php example.com
//example.com being your site and the config to take into account being below it

$site="";

if ( array_key_exists ('argc',$_SERVER) && $_SERVER['argc'] >= 1) {
  $site= "/".$_SERVER['argv'][1];
}

define( 'CIVICRM_CONFDIR', '/var/www/drupal.5/sites'. $site );

?>


Do you think that's too much of a hack ? I'd investigate to use it for the crons as well if you think its worthwhile

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Calling a civicrm code from the shell ?

This forum was archived on 2017-11-26.