/[drupal]/contributions/modules/path_redirect/path_redirect.module
ViewVC logotype

Diff of /contributions/modules/path_redirect/path_redirect.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3.2.7.2.58, Wed Nov 4 06:00:11 2009 UTC revision 1.3.2.7.2.59, Wed Nov 4 06:29:09 2009 UTC
# Line 1  Line 1 
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().
# Line 138  function path_redirect_init() { Line 134  function path_redirect_init() {
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.
# Line 167  function path_redirect_init() { Line 163  function path_redirect_init() {
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      }      }
# Line 226  function path_redirect_save($redirect) { Line 222  function path_redirect_save($redirect) {
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

Legend:
Removed from v.1.3.2.7.2.58  
changed lines
  Added in v.1.3.2.7.2.59

  ViewVC Help
Powered by ViewVC 1.1.2