mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Add version check to cron manager
This commit is contained in:
@@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
||||
|
|
||||
*/
|
||||
|
||||
$config['migration_version'] = 217;
|
||||
$config['migration_version'] = 219;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
33
application/migrations/219_add_version_check_to_cron.php
Normal file
33
application/migrations/219_add_version_check_to_cron.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Migration_add_version_check_to_cron extends CI_Migration {
|
||||
public function up() {
|
||||
if ($this->chk4cron('version_check') == 0) {
|
||||
$data = array(
|
||||
array(
|
||||
'id' => 'version_check',
|
||||
'enabled' => '0',
|
||||
'status' => 'pending',
|
||||
'description' => 'Check for new Wavelog releases',
|
||||
'function' => 'index.php/update/wavelog_update_check',
|
||||
'expression' => '45 4 * * *',
|
||||
'last_run' => null,
|
||||
'next_run' => null
|
||||
));
|
||||
$this->db->insert_batch('cron', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function down() {
|
||||
if ($this->chk4cron('version_check') > 0) {
|
||||
$this->db->query("delete from cron where id='version_check'");
|
||||
}
|
||||
}
|
||||
|
||||
function chk4cron($cronkey) {
|
||||
$query = $this->db->query("select count(id) as cid from cron where id=?",$cronkey);
|
||||
$row = $query->row();
|
||||
return $row->cid ?? 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user