b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _cronjob.class.php

Documentation is available at _cronjob.class.php

  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-2010 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.6 2010/02/08 17:52:14 efy-yury 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''DataObject' );
  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$parvalue050 )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.6  2010/02/08 17:52:14  efy-yury
  123.  * copyright 2009 -> 2010
  124.  *
  125.  * Revision 1.5  2009/09/14 12:53:57  efy-arrin
  126.  * Included the ClassName in load_class() call with proper UpperCase
  127.  *
  128.  * Revision 1.4  2009/03/08 23:57:42  fplanque
  129.  * 2009
  130.  *
  131.  * Revision 1.3  2008/01/21 09:35:28  fplanque
  132.  * (c) 2008
  133.  *
  134.  * Revision 1.2  2007/09/04 22:08:31  fplanque
  135.  * fixes
  136.  *
  137.  * Revision 1.1  2007/06/25 10:59:47  fplanque
  138.  * MODULES (refactored MVC)
  139.  *
  140.  * Revision 1.4  2007/04/26 00:11:09  fplanque
  141.  * (c) 2007
  142.  *
  143.  * Revision 1.3  2006/11/24 18:27:24  blueyed
  144.  * Fixed link to b2evo CVS browsing interface in file docblocks
  145.  *
  146.  * Revision 1.2  2006/09/21 15:26:28  blueyed
  147.  * Fixed dependency (and tests)
  148.  *
  149.  * Revision 1.1  2006/08/24 00:43:28  fplanque
  150.  * scheduled pings part 2
  151.  *
  152.  */
  153. ?>

Documentation generated on Sat, 06 Mar 2010 04:07:07 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).