[ 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/model/ -> _cronjob.class.php (source)

   1  <?php
   2  /**

   3   * This file implements the Cronjob class, which manages a single cron job as registered in the DB.

   4   *

   5   * This file is part of the evoCore framework - {@link http://evocore.net/}

   6   * See also {@link http://sourceforge.net/projects/evocms/}.

   7   *

   8   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

   9   *

  10   * {@internal License choice

  11   * - If you have received this file as part of a package, please find the license.txt file in

  12   *   the same folder or the closest folder above for complete license terms.

  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  14   *   then you must choose one of the following licenses before using the file:

  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  17   * }}

  18   *

  19   * {@internal Open Source relicensing agreement:

  20   * }}

  21   *

  22   * @package evocore

  23   *

  24   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  25   * @author fplanque: Francois PLANQUE.

  26   *

  27   * @version $Id: _cronjob.class.php,v 1.2 2007/09/04 22:08:31 fplanque Exp $

  28   */
  29  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  30  
  31  load_class('_core/model/dataobjects/_dataobject.class.php');
  32  
  33  /**

  34   * Cronjob

  35   *

  36   * Manages a single cron job as registered in the DB.

  37   *

  38   * @package evocore

  39   */
  40  class Cronjob extends DataObject
  41  {
  42      var $start_datetime;
  43      var $repeat_after = NULL;
  44      var $name;
  45      var $controller;
  46  
  47      /**

  48       * @var array

  49       */
  50      var $params;
  51  
  52      /**

  53       * Constructor

  54       *

  55       * @param table Database row

  56       */
  57  	function Cronjob( $db_row = NULL )
  58      {
  59          // Call parent constructor:

  60          parent::DataObject( 'T_cron__task', 'ctsk_', 'ctsk_ID', '', '', '', '' );
  61  
  62          if( $db_row != NULL )
  63          {    // Loading an object from DB:
  64              $this->ID              = $db_row->ctsk_ID;
  65              $this->start_datetime  = $db_row->ctsk_start_datetime;
  66              $this->repeat_after    = $db_row->ctsk_repeat_after;
  67              $this->name            = $db_row->ctsk_name;
  68              $this->controller      = $db_row->ctsk_controller;
  69              $this->params          = $db_row->ctsk_params;
  70          }
  71          else
  72          {    // New object:
  73  
  74          }
  75      }
  76  
  77      /**

  78       * Set param value

  79       *

  80       * By default, all values will be considered strings

  81       *

  82       * @param string parameter name

  83       * @param mixed parameter value

  84       * @param boolean true to set to NULL if empty value

  85       * @return boolean true, if a value has been set; false if it has not changed

  86       */
  87  	function set( $parname, $parvalue, $make_null = false )
  88      {
  89          switch( $parname )
  90          {
  91              case 'params':
  92                  return $this->set_param( 'params', 'string', serialize($parvalue), false );
  93  
  94              case 'name':
  95                  return $this->set_param( $parname, 'string', substr( $parvalue, 0, 50 ), false );
  96          }
  97  
  98          return $this->set_param( $parname, 'string', $parvalue, $make_null );
  99      }
 100  
 101  
 102      /**

 103       * Get a member param by its name

 104       *

 105       * @param mixed Name of parameter

 106       * @return mixed Value of parameter

 107       */
 108  	function get( $parname )
 109      {
 110          switch( $parname )
 111          {
 112              case 'params':
 113                  return unserialize( $this->params );
 114          }
 115  
 116          return parent::get( $parname );
 117      }
 118  }
 119  
 120  /*

 121   * $Log: _cronjob.class.php,v $

 122   * Revision 1.2  2007/09/04 22:08:31  fplanque

 123   * fixes

 124   *

 125   * Revision 1.1  2007/06/25 10:59:47  fplanque

 126   * MODULES (refactored MVC)

 127   *

 128   * Revision 1.4  2007/04/26 00:11:09  fplanque

 129   * (c) 2007

 130   *

 131   * Revision 1.3  2006/11/24 18:27:24  blueyed

 132   * Fixed link to b2evo CVS browsing interface in file docblocks

 133   *

 134   * Revision 1.2  2006/09/21 15:26:28  blueyed

 135   * Fixed dependency (and tests)

 136   *

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

 138   * scheduled pings part 2

 139   *

 140   */
 141  ?>


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