table_common_cron.php 977 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: table_common_cron.php 30314 2012-05-22 03:12:44Z monkey $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_common_cron extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'common_cron';
  15. $this->_pk = 'cronid';
  16. parent::__construct();
  17. }
  18. public function fetch_nextrun($timestamp) {
  19. $timestamp = intval($timestamp);
  20. return DB::fetch_first('SELECT * FROM '.DB::table($this->_table)." WHERE available>'0' AND nextrun<='$timestamp' ORDER BY nextrun LIMIT 1");
  21. }
  22. public function fetch_nextcron() {
  23. return DB::fetch_first('SELECT * FROM '.DB::table($this->_table)." WHERE available>'0' ORDER BY nextrun LIMIT 1");
  24. }
  25. public function get_cronid_by_filename($filename) {
  26. return DB::result_first('SELECT cronid FROM '.DB::table($this->_table)." WHERE filename='$filename'");
  27. }
  28. }
  29. ?>