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) »
  • Civix require_once(): Failed opening required Upgrader/Base.php
Pages: [1]

Author Topic: Civix require_once(): Failed opening required Upgrader/Base.php  (Read 1021 times)

j.vos

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5
Civix require_once(): Failed opening required Upgrader/Base.php
August 26, 2014, 01:30:04 am
Hello everyone,

First of all sorry for my english.

I have created a extension with civix, al went well. Now i want to create a upgrader in the same extension with civix. This also went well. Except when i go to civicrm/admin/extensions?reset=1 i get a error :

Fatal error: require_once(): Failed opening required 'CRM/Leaveregistration/Upgrader/Base.php' (include_path='/var/www/html/mysite.com/sites/all/modules/custom/civicrm/php/:.:/var/www/html/mysite.com/sites/all/modules/contrib/civicrm:/var/www/html/mysite.com/sites/all/modules/contrib/civicrm/packages:.:/usr/share/php:/usr/share/pear') in /var/www/html/mysite.com/sites/all/modules/contrib/civicrm/CRM/Core/ClassLoader.php on line 126

The files are created in the in the extension directory, the Upgrader.php is included in the right way except for the Base.php. It looks like it is looking in de wrong directory, namely the php directory instate of the extension directory.

Does anyone now how to fix this.

thanks

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Civix require_once(): Failed opening required Upgrader/Base.php
August 26, 2014, 02:14:20 am
(Note: Based on the folder name "CRM/Leaveregistration", I'm guessing the extension's short-name is something like "leaveregistration" and the long-name is like "org.example.leaveregistration".)

Few questions:
 * Is the code to leaveregistration published online?
 * What version of Civi are you using?
 * What CMS (Drupal/Joomla/WP)? What version?

FWIW, the "include_path" doesn't look right. There should be an item pointing to the leaveregistration folder. (I'm not sure what that folder is on your system -- maybe something like /var/www/html/mysite.com/sites/default/extensions/com.example.leaveregistration ?) It might be help to trace the code which adds leaveregistration to the include-path:

 * In leaveregistration.php, there should be "function leaveregistration_civicrm_config(&$config)" which delegates to _leaveregistration_civix_civicrm_config().
 * In leaveregistration.civix.php, there should be "function _leaveregistration_civix_civicrm_config(&$config)" which updates the include-path.

For comparison, here's the code which handles registration in org.civicrm.hrjob:

https://github.com/civicrm/civihr/blob/master/hrjob/hrjob.php#L33
https://github.com/civicrm/civihr/blob/master/hrjob/hrjob.civix.php#L10

j.vos

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5
Re: Civix require_once(): Failed opening required Upgrader/Base.php
August 28, 2014, 12:25:30 am
Hello,

Thanks for your answer.

My extension name is something like com.mysite.leaveregistration, the path to the extension directory is /var/www/html/mysite.com/sites/all/modules/custom/civicrm/extension/, the path to the php directory is /var/www/html/mysite.com/sites/all/modules/custom/civicrm/php/, and the path to template directory is /var/www/html/mysite.com/sites/all/modules/custom/civicrm/templates/.

The code is not published online, the version of civicrm is 4.4.5, and i use drupal.

The code in my leaveregistration.php is :
/**
 * Implementation of hook_civicrm_config
 */
function leaveregistration_civicrm_config(&$config) {
  _leaveregistration_civix_civicrm_config($config);
}


And my code in leaveregistration.civix.php is:

/**
 * (Delegated) Implementation of hook_civicrm_config
 *
 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
 */
function _leaveregistration_civix_civicrm_config(&$config = NULL) {
  static $configured = FALSE;
  if ($configured) return;
  $configured = TRUE;

  $template =& CRM_Core_Smarty::singleton();

  $extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
  $extDir = $extRoot . 'templates';

  if ( is_array( $template->template_dir ) ) {
      array_unshift( $template->template_dir, $extDir );
  } else {
      $template->template_dir = array( $extDir, $template->template_dir );
  }

  $include_path = $extRoot . PATH_SEPARATOR . get_include_path( );
  set_include_path( $include_path );
}


The code in my leaveregistration.php and leaveregistration.civix.php looks the same, maby you spot a difference.

j.vos

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5
Re: Civix require_once(): Failed opening required Upgrader/Base.php
August 28, 2014, 12:57:43 am
Hello,

Maybe it is in the code, in my leaveregistration.civix.php the error occured on line 118, and this is the code :
/**
 * @return CRM_Leaveregistration_Upgrader
 */
function _leaveregistration_civix_upgrader() {
  if (!file_exists(__DIR__.'/CRM/Leaveregistration/Upgrader.php')) {
    return NULL;
  } else {
    return CRM_Leaveregistration_Upgrader_Base::instance();
  }
}

j.vos

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5
Re: Civix require_once(): Failed opening required Upgrader/Base.php
August 28, 2014, 05:03:50 am
The problem is solved !

It is real weird. My database collation was latin1_swedish_ci and i changed it to utf8_unicode_ci, and now it works. What the problem was i don`t no but it is solved !!

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Civix require_once(): Failed opening required Upgrader/Base.php
August 28, 2014, 02:46:53 pm
Thanks for the updates! Glad you found a solution.

j.vos

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5
Re: Civix require_once(): Failed opening required Upgrader/Base.php
August 29, 2014, 01:22:56 am
Thank for your help !

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Civix require_once(): Failed opening required Upgrader/Base.php

This forum was archived on 2017-11-26.