ocs  2.3.6
About: OCS (Open Conference System) is a Web publishing tool that will create a complete Web presence for your scholarly conference.
  Fossies Dox: ocs-2.3.6.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

ScheduledTaskDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
20 // $Id$
21 
22 
23 import('scheduledTask.ScheduledTask');
24 
25 class ScheduledTaskDAO extends DAO {
31  function getLastRunTime($className) {
32  $result =& $this->retrieve(
33  'SELECT last_run FROM scheduled_tasks WHERE class_name = ?',
34  array($className)
35  );
36 
37  if ($result->RecordCount() == 0) {
38  $returner = 0;
39  } else {
40  $returner = strtotime($this->datetimeFromDB($result->fields[0]));
41  }
42 
43  $result->Close();
44  unset($result);
45 
46  return $returner;
47  }
48 
54  function updateLastRunTime($className, $timestamp = null) {
55  $result =& $this->retrieve(
56  'SELECT COUNT(*) FROM scheduled_tasks WHERE class_name = ?',
57  array($className)
58  );
59 
60  if (isset($result->fields[0]) && $result->fields[0] != 0) {
61  if (isset($timestamp)) {
62  $returner = $this->update(
63  'UPDATE scheduled_tasks SET last_run = ' . $this->datetimeToDB($timestamp) . ' WHERE class_name = ?',
64  array($className)
65  );
66  } else {
67  $returner = $this->update(
68  'UPDATE scheduled_tasks SET last_run = NOW() WHERE class_name = ?',
69  array($className)
70  );
71  }
72 
73  } else {
74  if (isset($timestamp)) {
75  $returner = $this->update(
76  sprintf('INSERT INTO scheduled_tasks (class_name, last_run)
77  VALUES (?, %s)', $this->datetimeToDB($timestamp)),
78  array($className)
79  );
80  } else {
81  $returner = $this->update(
82  'INSERT INTO scheduled_tasks (class_name, last_run)
83  VALUES (?, NOW())',
84  array($className)
85  );
86  }
87  }
88 
89  $result->Close();
90  unset($result);
91 
92  return $returner;
93  }
94 }
95 
96 ?>
config TEMPLATE inc php
Definition: config.inc.php:4
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:62
Operations for retrieving and modifying Scheduled Task data.
updateLastRunTime($className, $timestamp=null)
datetimeFromDB($dt)
Definition: DAO.inc.php:276
datetimeToDB($dt)
Definition: DAO.inc.php:258
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:186