Fatal error: Call to undefined function drupal_map_assoc() in /sites/all/modules/authcache/authcache.module on line 700

https://drupal.org/project/shurly

how can i use certain rules to exclude all the urls by shurly, is there a function or hook to do this?

Comments

simg’s picture

I need to familiarise myself with Authcache 7.x-2.x but in previous versions there was a textbox on the config page that let you specify urls (and I think patterns of urls) to not cache ?

funature’s picture

yes, you are right. but the shurly module creates short urls like www.example.com/xyz without any prefix. that means, i can not block those links in the setting form with pattern. there are thousands of them, it is of course not possible to add them to the list one by one.

simg’s picture

hmm, good point.

from memory (it's been a while since I've worked on Authcache) there's a global variable called _authcache_is_cacheable. You could try having a module set this variable when you don't want to cache. There's also a function called authcache_is_cacheable which you could "hack" to do what you need.

There really needs to be a better solution than this (and maybe there already is, but I don't have time to look into it right now). A hook would certainly be a worthwhile enhancement.

simg’s picture

>There probably already is

There is ! https://drupal.org/node/1904316

funature’s picture

thanks, i tried this with no success, finally i found out because the redirect happens already in shurly_boot(), so i added drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); then it works. but i'm not sure if there is a disadvantage to do like this

/**
 * Implements hook_boot().
 */
function shurly_boot() {
  // if the path has any unallowed characters in it (such as slashes),
  // it's not a short URL, so we can bail out and save ourselves a database call
  if (isset($_GET['q']) && shurly_validate_custom($_GET['q'])) {
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    $row = db_query("SELECT rid, destination FROM {shurly} WHERE BINARY source = :q AND active = 1", array(':q' => $_GET['q']))->fetchObject();
    if ($row) {
      shurly_goto($row);
    }
  }
}

/**
 * Implements hook_authcache_request_exclude().
 */
function shurly_authcache_request_exclude() {
	if (isset($_GET['q']) && shurly_validate_custom($_GET['q'])) {
		return t('URL is from shurly');
	}
}

znerol’s picture

Title: Fatal error when i call a url created by shurly module » Fatal error if authcache_exit is invoked when not fully bootstrapped
Category: support » bug

@funature: Thanks for your investigations. There is an hook_exit invocation in shurly_goto. At this point Drupal is not yet fully booted because the latter function is called from within shurly_boot.

I think that I need to rewrite authcache_exit in such a way, that it also works with lower bootstrapping phases.

znerol’s picture

Status: Active » Fixed

Fix committed in 489f572, let's see whether the test results turn to green again...

funature’s picture

thanks, it works great.

Status: Fixed » Closed (fixed)

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