mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added cron-manager-entry
This commit is contained in:
@@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
||||
|
|
||||
*/
|
||||
|
||||
$config['migration_version'] = 253;
|
||||
$config['migration_version'] = 254;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -76,6 +76,10 @@ class Dcl extends CI_Controller {
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function dcl_sync() {
|
||||
$this->dcl_upload();
|
||||
}
|
||||
|
||||
public function dcl_upload() {
|
||||
// Called as User: Upload for User (if manual sync isn't disabled
|
||||
// Called from cron / without Session: iterate through stations, check for DCL-Key and upload
|
||||
|
||||
43
application/migrations/254_dcl_cron.php
Normal file
43
application/migrations/254_dcl_cron.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Migration_dcl_cron extends CI_Migration {
|
||||
public function up() {
|
||||
if ($this->chk4cron('sync_dcl') == 0) {
|
||||
$data = array(
|
||||
array(
|
||||
'id' => 'sync_dcl',
|
||||
'enabled' => '0',
|
||||
'status' => 'disabled',
|
||||
'description' => 'Sync with DARC-DCL',
|
||||
'function' => 'index.php/dcl/dcl_sync',
|
||||
'expression' => '45 4 * * *',
|
||||
'last_run' => null,
|
||||
'next_run' => null
|
||||
));
|
||||
$this->db->insert_batch('cron', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function down() {
|
||||
if ($this->chk4cron('sync_dcl') > 0) {
|
||||
$this->db->query("delete from cron where id='sync_dcl'");
|
||||
}
|
||||
// No way back to tle-table
|
||||
}
|
||||
|
||||
function chk4cron($cronkey) {
|
||||
$query = $this->db->query("select count(id) as cid from cron where id=?",$cronkey);
|
||||
$row = $query->row();
|
||||
return $row->cid ?? 0;
|
||||
}
|
||||
|
||||
function dbtry($what) {
|
||||
try {
|
||||
$this->db->query($what);
|
||||
} catch (Exception $e) {
|
||||
log_message("error", "Something gone wrong while altering FKs: ".$e." // Executing: ".$this->db->last_query());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user