| 1 |
<?php
|
| 2 |
/**
|
| 3 |
* $Id: cacherouter.module,v 1.1.2.2 2008/12/26 02:23:54 slantview Exp $
|
| 4 |
*
|
| 5 |
* @file cacherouter.module
|
| 6 |
* @author Steve Rude <steve@slantview.com>
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_user
|
| 11 |
*
|
| 12 |
* When logged in you don't want to hit the page_fast_cache or else you will serve
|
| 13 |
* a cached page to a logged in user.
|
| 14 |
*/
|
| 15 |
function cacherouter_user($op, &$edit, &$account, $category = NULL) {
|
| 16 |
if (!variable_get('page_cache_fastpath', TRUE)) {
|
| 17 |
return;
|
| 18 |
}
|
| 19 |
|
| 20 |
switch ($op) {
|
| 21 |
case 'login':
|
| 22 |
setcookie('cacherouter', TRUE, time() + (60 * 60 * 24 * 30), '/');
|
| 23 |
break;
|
| 24 |
case 'logout':
|
| 25 |
//Set in past to delete cookie
|
| 26 |
setcookie('cacherouter', TRUE, time() - 3600, '/');
|
| 27 |
break;
|
| 28 |
}
|
| 29 |
}
|
| 30 |
|
| 31 |
function cacherouter_menu() {
|
| 32 |
$items = array();
|
| 33 |
|
| 34 |
$items['admin/settings/cacherouter'] = array(
|
| 35 |
'title' => t('CacheRouter Admin'),
|
| 36 |
'description' => t("View CacheRouter Usage Information."),
|
| 37 |
'page callback' => 'cacherouter_admin_stats_page',
|
| 38 |
'page arguments' => array(3),
|
| 39 |
'access arguments' => array('view cacherouter stats'),
|
| 40 |
'file' => 'cacherouter.admin.inc',
|
| 41 |
);
|
| 42 |
|
| 43 |
return $items;
|
| 44 |
}
|
| 45 |
|
| 46 |
function cacherouter_perm() {
|
| 47 |
return array('view cacherouter stats');
|
| 48 |
}
|