/[drupal]/contributions/modules/commentcloser/comment_closer.module
ViewVC logotype

Diff of /contributions/modules/commentcloser/comment_closer.module

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

revision 1.10.2.2.2.5, Sun Jun 29 19:38:25 2008 UTC revision 1.10.2.2.2.6, Sat Jan 10 18:50:02 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: comment_closer.module,v 1.10.2.2.2.5 2008/06/29 19:38:25 rmiddle Exp $
3  /**  /**
4   * @file   * @file
5   * comment_closer.module   * comment_closer.module
# Line 66  function comment_closer_settings() { Line 66  function comment_closer_settings() {
66    return system_settings_form($cc_form);    return system_settings_form($cc_form);
67  }  }
68    
 function _comment_closer_node_select($nodetypes) {  
   foreach ($nodetypes as $nodetype_index) {  
     $node_condition[] = '(type=\''.$nodetype_index.'\')';  
   }  
   return implode(' OR ', $node_condition);  
 }  
   
69  function comment_closer_cron() {  function comment_closer_cron() {
70    
71    $now = time();    $now = time();
# Line 105  function comment_closer_cron() { Line 98  function comment_closer_cron() {
98        $oldest_allowed = mktime($current_date['hours'], $current_date['minutes'], $current_date['seconds'], $current_date['mon'], $current_date['mday'], $current_date['year']);        $oldest_allowed = mktime($current_date['hours'], $current_date['minutes'], $current_date['seconds'], $current_date['mon'], $current_date['mday'], $current_date['year']);
99    
100        // knock it out        // knock it out
101          $args = array();
102          $query = "UPDATE {node} SET comment = 1 WHERE (created < %d)";
103          $args[] = $oldest_allowed;
104          if (!empty($process_node_type_list) && is_array($process_node_type_list)) {
105            $query .= " AND type IN (" . db_placeholders($process_node_type_list) . ")";
106            $args = array_merge($args, $process_node_type_list);
107          }
108        cache_clear_all();        cache_clear_all();
109          $result = db_query($query, $args);
       $sql = sprintf("UPDATE {node} SET comment = 1 WHERE (created < '%d') AND (%s)", // Can't escape the %s it breaks the SQL.  
         $oldest_allowed,  
         _comment_closer_node_select($process_node_type_list)  
       );  
       $result = db_query($sql);  
110        $msg = 'sql = %sql';        $msg = 'sql = %sql';
111        $vars = array( '%sql' => $sql );        $vars = array( '%sql' => $query );
112        watchdog('comment_closer',$msg, $vars, WATCHDOG_DEBUG);        watchdog('comment_closer',$msg, $vars, WATCHDOG_DEBUG);
113        // clean it up        // clean it up
114       $current_date = getdate();       $current_date = getdate();

Legend:
Removed from v.1.10.2.2.2.5  
changed lines
  Added in v.1.10.2.2.2.6

  ViewVC Help
Powered by ViewVC 1.1.2