table_common_patch.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_patch.php 27449 2012-02-01 05:32:35Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_common_patch extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'common_patch';
  15. $this->_pk = 'serial';
  16. parent::__construct();
  17. }
  18. public function fetch_all() {
  19. return DB::fetch_all("SELECT * FROM ".DB::table($this->_table));
  20. }
  21. public function fetch_max_serial() {
  22. return DB::result_first("SELECT serial FROM ".DB::table($this->_table)." ORDER BY serial DESC LIMIT 1");
  23. }
  24. public function update_status_by_serial($status, $serial, $condition = '') {
  25. return DB::query("UPDATE ".DB::table($this->_table)." SET ".DB::field('status', $status)." WHERE ".DB::field('serial', $serial, $condition));
  26. }
  27. public function fetch_needfix_patch($serials) {
  28. return DB::fetch_all("SELECT * FROM ".DB::table($this->_table)." WHERE ".DB::field('serial', $serials)." AND status<=0");
  29. }
  30. public function fetch_patch_by_status($status) {
  31. return DB::fetch_all("SELECT * FROM ".DB::table($this->_table)." WHERE ".DB::field('status', $status));
  32. }
  33. }
  34. ?>