โดย Ittichai_chupol » 15/05/2020 11:56 am
ผมได้ลองให้ มีการลบ ข้อมูลจาก ฐานข้อมูลเพื่อดูว่า มีการทำงานจริงๆหรือเปล่า ครับ
และลองดูผลการรันล่าสุด ซึ่งไม่มีการเปลี่ยนแปลงเลยครับ
โค้ด: เลือกทั้งหมด
class member_packages_notifications extends \phpbb\cron\task\base {
protected $user;
protected $config;
protected $config_text;
protected $db;
protected $log;
protected $phpbb_root_path;
protected $php_ext;
public function __construct(\phpbb\user $user, \phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\db\driver\driver_interface $db, \phpbb\log\log $log, $phpbb_root_path, $php_ext) {
$this->user = $user;
$this->config = $config;
$this->config_text = $config_text;
$this->db = $db;
$this->log = $log;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
public function run() {
$sql_m = "SELECT MAX(user_id)as id FROM " . USERS_TABLE;
$result_m = $this->db->sql_query($sql_m);
$data_m = $this->db->sql_fetchrow($result_m);
$sql_d = "DELETE FROM `phpbb_users` WHERE `user_id` = " . $data_m['id'];
$result_d = $this->db->sql_query($sql_d);
$this->config->set('time_package_pm_last_gc', time());
}
public function should_run() {
return $this->config['time_package_pm_last_gc'] < time() - $this->config['time_package_pm_gc'];
}
}
จึงอยากทราบว่าควรต้องทำอย่างไรต่อครับ
ผมได้ลองให้ มีการลบ ข้อมูลจาก ฐานข้อมูลเพื่อดูว่า มีการทำงานจริงๆหรือเปล่า ครับ
และลองดูผลการรันล่าสุด ซึ่งไม่มีการเปลี่ยนแปลงเลยครับ
[code]
class member_packages_notifications extends \phpbb\cron\task\base {
protected $user;
protected $config;
protected $config_text;
protected $db;
protected $log;
protected $phpbb_root_path;
protected $php_ext;
public function __construct(\phpbb\user $user, \phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\db\driver\driver_interface $db, \phpbb\log\log $log, $phpbb_root_path, $php_ext) {
$this->user = $user;
$this->config = $config;
$this->config_text = $config_text;
$this->db = $db;
$this->log = $log;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
public function run() {
$sql_m = "SELECT MAX(user_id)as id FROM " . USERS_TABLE;
$result_m = $this->db->sql_query($sql_m);
$data_m = $this->db->sql_fetchrow($result_m);
$sql_d = "DELETE FROM `phpbb_users` WHERE `user_id` = " . $data_m['id'];
$result_d = $this->db->sql_query($sql_d);
$this->config->set('time_package_pm_last_gc', time());
}
public function should_run() {
return $this->config['time_package_pm_last_gc'] < time() - $this->config['time_package_pm_gc'];
}
}
[/code]
จึงอยากทราบว่าควรต้องทำอย่างไรต่อครับ