Hi,

I'm using scheduler module to publish some content on an Acquia environment with Acquia purge module configured. We have set paths to be flushed appropriately. For queues to be processed in a request, we have set the variable "acquia_purge_lateruntime" to TRUE, which triggers the AcquiaPurgeRuntimeProcessor for processing the queues when a request is made through hook_exit in Acquia purge module.

So, I'm getting this fatal error "Call to undefined function drupal_get_path_alias()" in the logs always, when a request is made. I believe this is due to path.inc not getting included in the subsequent code flow, in acquia_purge.diagnostics.inc

function _acquia_purge_get_diagnosis_domains($t) {
  $allriskmode = _acquia_purge_variable('acquia_purge_allriskmode');
  $domains_link = drupal_get_path('module', 'acquia_purge') . '/DOMAINS.txt';
  $domains_link = url($domains_link);
  $domains = _acquia_purge_get_domains();
  $domains_c = count($domains);
  $test = array(
    'value' => implode(', ', $domains),
    'title' => $t('Purged domains'),
    'description' => $t('The domains for which content gets cleared from your'
      . ' load balancers. Every domain name multiplies the purging work to be'
      . ' done, it is therefore important to <a href="!link" target="_blank">'
      . 'specify your domains</a> when the automatically detected list exceeds'
      . ' 4 domains or when it is incorrect.', array('!link' => $domains_link)),
  );

Here, the url() function calls drupal_get_path_alias which is in path.inc, and that file is not included in the request. I think we should include that file and cache.inc in the function _acquia_purge_load in acquia_purge.module, which gets called when processor objects are loaded.

Current Code:

function _acquia_purge_load($path) {

  // Initialize our module path just once, to avoid doing this many times.
  static $module_path;
  if (is_null($module_path)) {
    //Loading include paths for functions to later use in the processing
    require_once DRUPAL_ROOT . '/includes/common.inc';
    $module_path = drupal_get_path('module', 'acquia_purge');
  }

We should change it to become:

function _acquia_purge_load($path) {

  // Initialize our module path just once, to avoid doing this many times.
  static $module_path;
  if (is_null($module_path)) {
    //Loading include paths for functions to later use in the processing
    require_once DRUPAL_ROOT . '/includes/common.inc';
    require_once DRUPAL_ROOT . '/includes/path.inc';
    require_once DRUPAL_ROOT . '/includes/cache.inc';
    $module_path = drupal_get_path('module', 'acquia_purge');
  }

Let me know your thoughts

CommentFileSizeAuthor
#2 2550497-call-to-undefined-function.patch561 bytessnufkin

Comments

aditya.ghan created an issue. See original summary.

snufkin’s picture

Status: Active » Needs review
StatusFileSize
new561 bytes

Here is a patch, we are having this issue as well, so I hope to give you some feedback whether or not this solves the problem for us.

snufkin’s picture

We have also ran into a new error (which has a fix for now in the dev branch):

E_ERROR: Call to undefined function drupal_strtolower()
Stack trace
in _acquia_purge_get_domains_add called at /mnt/www/html/project/docroot/sites/all/modules/contrib/acquia_purge/acquia_purge.module (794)
in _acquia_purge_get_domains_add called at /mnt/www/html/project/docroot/sites/all/modules/contrib/acquia_purge/acquia_purge.module (736)
in _acquia_purge_get_domains called at /mnt/www/html/project/docroot/sites/all/modules/contrib/acquia_purge/acquia_purge.diagnostics.inc (151)
in _acquia_purge_get_diagnosis_domains called at /mnt/www/html/project/docroot/sites/all/modules/contrib/acquia_purge/acquia_purge.module (639)
in _acquia_purge_get_diagnosis called at /mnt/www/html/project/docroot/sites/all/modules/contrib/acquia_purge/acquia_purge.module (401)
…/sites/all/modules/contrib/acquia_purge/processor/
AcquiaPurgeProcessorBase.php (39)
…modules/contrib/acquia_purge/processor/backend/acq
AcquiaPurgeRuntimeProcessor.php (55)
…modules/contrib/acquia_purge/processor/backend/
AcquiaPurgeRuntimeProcessor.php (66)
…es/all/modules/contrib/acquia_purge/processor/
AcquiaPurgeProcessorsService.php (94)
in AcquiaPurgeProcessorsService::emit called at /mnt/www/html/project/docroot/sites/all/modules/contrib/acquia_purge/acquia_purge.module (363)
in acquia_purge_exit called at ? 
in call_user_func_array called at /mnt/www/html/project/docroot/includes/module.inc (866)
in module_invoke called at /mnt/www/html/project/docroot/includes/bootstrap.inc (1091)
in bootstrap_invoke_all called at /mnt/www/html/project/docroot/includes/bootstrap.inc (2406)
in _drupal_bootstrap_page_cache called at /mnt/www/html/project/docroot/includes/bootstrap.inc (2236)
in drupal_bootstrap called at /mnt/www/html/project/docroot/index.php (20)

For reference we are using the following settings:


$conf['acquia_purge_cron'] = TRUE;
$conf['acquia_purge_smartqueue'] = TRUE;
$conf['acquia_purge_lateruntime'] = TRUE;

aditya.ghan’s picture

Does the this patch and the latest dev code solve this issue?

If not, we can add unicode.inc also

function _acquia_purge_load($path) {
  // Initialize our module path just once, to avoid doing this many times.
  static $module_path;
  if (is_null($module_path)) {
    //Loading include paths for functions to later use in the processing
    require_once DRUPAL_ROOT . '/includes/common.inc';
    require_once DRUPAL_ROOT . '/includes/path.inc';
    require_once DRUPAL_ROOT . '/includes/cache.inc';
    require_once DRUPAL_ROOT . '/includes/unicode.inc';
    $module_path = drupal_get_path('module', 'acquia_purge');
  }

  • nielsvm committed 61c0838 on 7.x-1.x authored by snufkin
    Issue #2550497 by snufkin, aditya.ghan: Call to undefined function...
nielsvm’s picture

Status: Needs review » Fixed

Thanks, fixed in next release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.