b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.9) [ class tree: main ] [ index: main ] [ all elements ]

Source for file _post_notifications.job.php

Documentation is available at _post_notifications.job.php

  1. <?php
  2. /**
  3.  * This file implements the post notifications Cron controller
  4.  *
  5.  * @author fplanque: Francois PLANQUE
  6.  *
  7.  * @version $Id: _post_notifications.job.php,v 1.1.2.6 2006/11/27 19:12:50 fplanque Exp $
  8.  */
  9. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  10.  
  11. global $Settings;
  12.  
  13. global $model_path;
  14.  
  15.  
  16. if$Settings->get'outbound_notifications_mode' != 'cron' )
  17. // Autopruning is NOT requested
  18.     $result_message T_('Post notifications are not set to run as a scheduled task');
  19.     return 2;
  20. }
  21.  
  22. // Get the ID of the post we are supposed to post-process:
  23. ifempty$job_params['item_ID') )
  24. {
  25.     $result_message 'No item_ID parameter received.'// No trans.
  26.     return 3;
  27. }
  28.  
  29. $item_ID $job_params['item_ID'];
  30.  
  31.  
  32. // Notify that we are going to take care of that post's post processing:
  33. $DB->query'UPDATE T_posts
  34.                                 SET post_notifications_status = "started"
  35.                             WHERE post_ID = '.$item_ID.'
  36.                               AND post_notifications_status = "todo"
  37.                               AND post_notifications_ctsk_ID = '.$job_params['ctsk_ID');
  38. if$DB->rows_affected != )
  39. {    // We would not "lock" the requested post
  40.     $result_message sprintfT_('Could not lock post #%d. It may already be processed.')$item_ID );
  41.     return 4;
  42. }
  43.  
  44. // Get the Item:
  45. require_once $model_path.'items/_itemcache.class.php';
  46. $ItemCache new ItemCache();
  47. $edited_Item $ItemCache->get_by_ID$item_ID );
  48.  
  49. // send outbound pings:
  50. $edited_Item->send_outbound_pingsfalse );
  51.  
  52. // Send email notifications now!
  53. $edited_Item->send_email_notificationsfalse );
  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.2.6  2006/11/27 19:12:50  fplanque
  68.  * 1.9 POT has gone public. No more unnecessary changes.
  69.  * 1.9.x language packs should work for ALL 1.9.x versions.
  70.  * Adding strings is okay. Removing strings/changing strings for fun is not OK.
  71.  * Move to 1.10 or 2.0
  72.  *
  73.  * Revision 1.1.2.4  2006/11/25 07:41:21  fplanque
  74.  * Backporting: the best way to W.A.S.T.E. time.
  75.  *
  76.  * Revision 1.1.2.3  2006/10/14 04:23:31  blueyed
  77.  * Fixed E_FATAL / used get_Cache()
  78.  *
  79.  * Revision 1.1.2.2  2006/10/12 20:38:14  blueyed
  80.  * Merged Pingers-as-plugins etc from HEAD
  81.  *
  82.  * Revision 1.1  2006/08/24 00:43:28  fplanque
  83.  * scheduled pings part 2
  84.  *
  85.  * Revision 1.1  2006/07/06 19:59:08  fplanque
  86.  * better logs, better stats, better pruning
  87.  *
  88.  */
  89. ?>

Documentation generated on Tue, 18 Dec 2007 22:51:05 +0100 by phpDocumentor 1.4.0