| 1 |
<?php |
<?php |
| 2 |
// $Id: path_redirect.module,v 1.3.2.7.2.57 2009/11/04 05:49:46 davereid Exp $ |
// $Id: path_redirect.module,v 1.3.2.7.2.58 2009/11/04 06:00:11 davereid Exp $ |
|
|
|
|
if (!defined('REQUEST_TIME')) { |
|
|
define('REQUEST_TIME', time()); |
|
|
} |
|
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 134 |
$redirect['location'] = url($redirect['redirect'], $redirect['url_options']); |
$redirect['location'] = url($redirect['redirect'], $redirect['url_options']); |
| 135 |
|
|
| 136 |
// Update the last used timestamp so that unused redirects can be purged. |
// Update the last used timestamp so that unused redirects can be purged. |
| 137 |
db_query("UPDATE {path_redirect} SET last_used = %d WHERE rid = %d", REQUEST_TIME, $redirect['rid']); |
db_query("UPDATE {path_redirect} SET last_used = %d WHERE rid = %d", time(), $redirect['rid']); |
| 138 |
|
|
| 139 |
if (url($redirect['redirect']) == url($_GET['q'])) { |
if (url($redirect['redirect']) == url($_GET['q'])) { |
| 140 |
// Prevent infinite loop redirection. |
// Prevent infinite loop redirection. |
| 163 |
function path_redirect_cron() { |
function path_redirect_cron() { |
| 164 |
// Purge inactive redirects from the database. |
// Purge inactive redirects from the database. |
| 165 |
if ($purge = path_redirect_var('purge_inactive')) { |
if ($purge = path_redirect_var('purge_inactive')) { |
| 166 |
db_query("DELETE FROM {path_redirect} WHERE last_used < %d", array(':timestamp' => REQUEST_TIME - $purge)); |
db_query("DELETE FROM {path_redirect} WHERE last_used < %d", array(':timestamp' => time() - $purge)); |
| 167 |
if ($count = db_affected_rows()) { |
if ($count = db_affected_rows()) { |
| 168 |
watchdog('path_redirect', format_plural($count, 'Removed 1 inactive redirect from the database.', 'Removed @count inactive redirects from the database.')); |
watchdog('path_redirect', format_plural($count, 'Removed 1 inactive redirect from the database.', 'Removed @count inactive redirects from the database.')); |
| 169 |
} |
} |
| 222 |
'fragment' => '', |
'fragment' => '', |
| 223 |
'language' => '', |
'language' => '', |
| 224 |
'type' => path_redirect_var('default_status'), |
'type' => path_redirect_var('default_status'), |
| 225 |
'last_used' => REQUEST_TIME, |
'last_used' => time(), |
| 226 |
); |
); |
| 227 |
|
|
| 228 |
// Allow spaces in "from" path |
// Allow spaces in "from" path |