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) »
  • Support »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • cli cron: Class 'CRM_Utils_System_Drupal' not found
Pages: 1 [2] 3

Author Topic: cli cron: Class 'CRM_Utils_System_Drupal' not found  (Read 9056 times)

Carlo Landmeter

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 3
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 26, 2012, 03:34:26 pm
applied the patch and now I get:

PHP Fatal error: Call to undefined method CRM_Utils_System_Drupal6::loadUser() cli.php on line 167

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 26, 2012, 03:49:15 pm
Does adding this to the drupal6 class fix that?

    static function loadUser( $username ) {
        global $user;
        // fixme: this should be broken out into the appropriate d6, d7 framework
        if(function_exists('user_load_by_name')) {
            // >= d7 approach
            $user = user_load_by_name($username);
        }
       
        if(empty($user->uid)) return false;

        require_once('CRM/Core/BAO/UFMatch.php');
        $contact_id = CRM_Core_BAO_UFMatch::getContactId( $uid );

        // lets store contact id and user id in session
        $session = CRM_Core_Session::singleton( );
        $session->set( 'ufID'  , $uid );
        $session->set( 'userID', $contact_id );
        return true;
    }
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Carlo Landmeter

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 3
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 26, 2012, 04:28:10 pm
removes the class error, but tells me:

Failed to login as carlo (im pretty sure i provided the correct details).

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 26, 2012, 04:56:08 pm
The code around authenticate seems a bit odd. It runs 'authenticate' for a 'job' but 'load user' otherwise. Try this patch.

Code: [Select]
Index: bin/cli.php
===================================================================
--- bin/cli.php (revision 38899)
+++ bin/cli.php (working copy)
@@ -156,7 +156,7 @@
             return false;
         }
 
-        if( strtolower($this->_entity) == 'job' ) {
+        if( strtolower($this->_entity) == 'job' || isset($this->_password) ) {
             if( ! $cms->authenticate( $this->_user, $this->_password, false, $civicrm_root ) ) {
               $this->_log( ts("Jobs called from cli.php require valid user and password as parameter", array('1' => $this->_user )));
               return false;
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

planigan

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
    • Allegheny CleanWays
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 6.24
  • MySQL version: 5.0.90
  • PHP version: 5.2.13
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 26, 2012, 08:01:47 pm
Applied the patch above and I still get "failed to login as <user>". I also confirmed that both _user and _password variables were set correctly.

Code: [Select]
        global $user;
        // fixme: this should be broken out into the appropriate d6, d7 framework
        if(function_exists('user_load_by_name')) {
            // >= d7 approach
            $user = user_load_by_name($username);
        }
       
        if(empty($user->uid)) return false;

Does the snippet above from loadUser need to change for D6? Because the comments and suggest that load_user_by_name does not exist in D6, so the loadUser function will always return false.
« Last Edit: February 26, 2012, 08:10:24 pm by planigan »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 26, 2012, 10:00:08 pm
yes, it seems that the user isn't loaded by authenticate like I thought it would be. Perhaps the answer is to do what the Joomla class does ... - the function loaduser just returns true.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 26, 2012, 11:34:22 pm
Hi,

I'm pretty sure it was working on 4.0 on joomla.

Could someone confirm it has been tested and seen working on joomla? Most of the dev was done on drupal for the 4.1 cron.

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

Carlo Landmeter

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 3
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 27, 2012, 04:12:36 am
I guess we can use load_user when user_load_by_name does not exist?
After i change it I don't receive any error except the folloing which is caused by -j (log).

PHP Fatal error:  Call to a member function saveLastRun() on a non-object in civicrm/CRM/Core/JobManager.php on line 118

Code: [Select]
    static function loadUser( $username ) {
        global $user;
        // fixme: this should be broken out into the appropriate d6, d7 framework
        if(function_exists('user_load_by_name')) {
            // >= d7 approach
            $user = user_load_by_name($username);
        } else {
            // drupal 6
            $user = user_load(array('name' => $username));
        }
        if(empty($user->uid)) return false;

        require_once('CRM/Core/BAO/UFMatch.php');
        $contact_id = CRM_Core_BAO_UFMatch::getContactId( $uid );

        // lets store contact id and user id in session
        $session = CRM_Core_Session::singleton( );
        $session->set( 'ufID'  , $uid );
        $session->set( 'userID', $contact_id );
        return true;
    }


Carlo Landmeter

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 3
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 27, 2012, 04:45:31 am
I would also like to know if http://issues.civicrm.org/jira/browse/CRM-9732 is related to this bugs?

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 27, 2012, 01:16:15 pm
The other bug seems to relate to the email processor which should

1) process bounces
2) potentially respond to replies & forward them.

Is #1 working & not #2?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 27, 2012, 01:51:24 pm
I have committed your d6 version (well slightly changed but almost)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 27, 2012, 01:56:09 pm
Re the other error - it's calling 'execute' without having loaded a job object - you might want to stick a backtrace in & figure out why.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Carlo Landmeter

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 3
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 27, 2012, 11:40:30 pm
Quote from: Eileen on February 27, 2012, 01:16:15 pm
The other bug seems to relate to the email processor which should

1) process bounces
2) potentially respond to replies & forward them.

Is #1 working & not #2?

I just tried it again, and both 1 and 2 do not work. I can see email's being fetched from IMAP, but after that nothing happens.

Carlo Landmeter

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 3
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 28, 2012, 01:02:04 am
Quote from: Eileen on February 27, 2012, 01:56:09 pm
Re the other error - it's calling 'execute' without having loaded a job object - you might want to stick a backtrace in & figure out why.

How to get a backtrace from cli?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: cli cron: Class 'CRM_Utils_System_Drupal' not found
February 28, 2012, 01:30:08 am
stick on the line before you get the error
Code: [Select]
    var_dump(debug_backtrace());

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

Pages: 1 [2] 3
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • cli cron: Class 'CRM_Utils_System_Drupal' not found

This forum was archived on 2017-11-26.