[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/cron/jobs/ -> _post_notifications.job.php (source)

   1  <?php
   2  /**

   3   * This file implements the post notifications Cron controller

   4   *

   5   * @author fplanque: Francois PLANQUE

   6   *

   7   * @todo dh> Should this also handle feedback notifications (according to the "outbound_notifications_mode" setting)?

   8   * fp> No. The feedback notifications should have their own job.

   9   *

  10   * @version $Id: _post_notifications.job.php,v 1.1 2007/06/25 10:59:46 fplanque Exp $

  11   */
  12  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  13  
  14  global $Settings;
  15  
  16  
  17  if( $Settings->get( 'outbound_notifications_mode' ) != 'cron' )
  18  { // Autopruning is NOT requested
  19      $result_message = T_('Post notifications are not set to run as a scheduled task.');
  20      return 2;
  21  }
  22  
  23  // Get the ID of the post we are supposed to post-process:

  24  if( empty( $job_params['item_ID'] ) )
  25  {
  26      $result_message = 'No item_ID parameter received.'; // No trans.

  27      return 3;
  28  }
  29  
  30  $item_ID = $job_params['item_ID'];
  31  
  32  
  33  // Notify that we are going to take care of that post's post processing:

  34  $DB->query( 'UPDATE T_items__item
  35                                  SET post_notifications_status = "started"
  36                              WHERE post_ID = '.$item_ID.'
  37                                AND post_notifications_status = "todo"
  38                                AND post_notifications_ctsk_ID = '.$job_params['ctsk_ID'] );
  39  if( $DB->rows_affected != 1 )
  40  {    // We would not "lock" the requested post
  41      $result_message = sprintf( T_('Could not lock post #%d. It may already be processed.'), $item_ID );
  42      return 4;
  43  }
  44  
  45  // Get the Item:

  46  $ItemCache = & get_Cache( 'ItemCache' );
  47  $edited_Item = & $ItemCache->get_by_ID( $item_ID );
  48  
  49  // send outbound pings:

  50  $edited_Item->send_outbound_pings();
  51  
  52  // Send email notifications now!

  53  $edited_Item->send_email_notifications( false );
  54  
  55  // Record that processing has been done:

  56  $edited_Item->set( 'notifications_status', 'finished' );
  57  
  58  // Save the new processing status to DB

  59  $edited_Item->dbupdate();
  60  
  61  $result_message = T_('Done.');
  62  
  63  return 1; /* ok */
  64  
  65  /*

  66   * $Log: _post_notifications.job.php,v $

  67   * Revision 1.1  2007/06/25 10:59:46  fplanque

  68   * MODULES (refactored MVC)

  69   *

  70   * Revision 1.6  2007/05/14 02:43:03  fplanque

  71   * Started renaming tables. There probably won't be a better time than 2.0.

  72   *

  73   * Revision 1.5  2007/02/26 03:41:16  fplanque

  74   * doc

  75   *

  76   * Revision 1.4  2007/02/13 01:30:31  blueyed

  77   * TODO: do not notify about not published comments / use "outbound_notifications_mode" setting for comments, too

  78   *

  79   * Revision 1.3  2006/12/12 02:53:56  fplanque

  80   * Activated new item/comments controllers + new editing navigation

  81   * Some things are unfinished yet. Other things may need more testing.

  82   *

  83   * Revision 1.2  2006/11/26 22:25:12  blueyed

  84   * MFB: Normalized messages (dot at end of full sentences)

  85   *

  86   * Revision 1.1  2006/08/24 00:43:28  fplanque

  87   * scheduled pings part 2

  88   *

  89   * Revision 1.1  2006/07/06 19:59:08  fplanque

  90   * better logs, better stats, better pruning

  91   *

  92   */
  93  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics