Merge pull request #180 from HB9HIL/maintenance_cron

added flag to recommend cronjobs
This commit is contained in:
HB9HIL
2024-02-29 18:15:56 +01:00
committed by GitHub
6 changed files with 85 additions and 34 deletions

View File

@@ -6,6 +6,16 @@
class Clublog extends CI_Controller {
function __construct()
{
parent::__construct();
if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') {
echo "Maintenance Mode is active. Try again later.\n";
redirect('user/login');
}
}
// Show frontend if there is one
public function index() {
$this->config->load('config');

View File

@@ -4,8 +4,15 @@ class eqsl extends CI_Controller {
/* Controls who can access the controller and its functions */
function __construct() {
parent::__construct();
$this->load->helper(array('form', 'url'));
if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') {
echo "Maintenance Mode is active. Try again later.\n";
redirect('user/login');
}
}
// Default view when loading controller.

View File

@@ -11,6 +11,17 @@ class Hrdlog extends CI_Controller {
* When called from the url wavelog/hrdlog/upload, the function loops through all station_id's with a hrdlog code defined.
* All QSOs not previously uploaded, will then be uploaded, one at a time
*/
function __construct()
{
parent::__construct();
if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') {
echo "Maintenance Mode is active. Try again later.\n";
redirect('user/login');
}
}
public function upload() {
$this->setOptions();
@@ -34,7 +45,6 @@ class Hrdlog extends CI_Controller {
echo "No station profiles with a hrdlog Code found.";
log_message('error', "No station profiles with a hrdlog Code found.");
}
}
function setOptions() {

View File

@@ -26,6 +26,11 @@ class Lotw extends CI_Controller {
// Load language files
$this->lang->load('lotw');
if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') {
echo "Maintenance Mode is active. Try again later.\n";
redirect('user/login');
}
}
/*
@@ -352,7 +357,7 @@ class Lotw extends CI_Controller {
/*
| Download QSO Matches from LoTW
*/
*/
if ($this->user_model->authorize(2)) {
echo "<br><br>";
$sync_user_id=$this->session->userdata('user_id');

View File

@@ -6,6 +6,16 @@
class Qrz extends CI_Controller {
function __construct()
{
parent::__construct();
if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') {
echo "Maintenance Mode is active. Try again later.\n";
redirect('user/login');
}
}
// Show frontend if there is one
public function index() {
$this->config->load('config');
@@ -38,7 +48,6 @@ class Qrz extends CI_Controller {
echo "No station profiles with a QRZ API Key found.";
log_message('error', "No station profiles with a QRZ API Key found.");
}
}
function setOptions() {
@@ -247,7 +256,7 @@ class Qrz extends CI_Controller {
} else {
echo "Downloaded QRZ report contains no matches.";
}
}
}
}
function mass_download_qsos($qrz_api_key = '', $lastqrz = '1900-01-01', $trusted = false) {

View File

@@ -8,6 +8,16 @@ class Update extends CI_Controller {
lotw_users - imports lotw users
*/
function __construct()
{
parent::__construct();
if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') {
echo "Maintenance Mode is active. Try again later.\n";
redirect('user/login');
}
}
public function index()
{
$data['page_title'] = "Updates";
@@ -290,9 +300,9 @@ class Update extends CI_Controller {
if ($nCount > 0)
{
echo "DONE: " . number_format($nCount) . " callsigns loaded";
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('scp_update', $datetime , 'no');
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('scp_update', $datetime , 'no');
} else {
echo "FAILED: Empty file";
}
@@ -360,9 +370,9 @@ class Update extends CI_Controller {
$totaltime = ($endtime - $starttime);
echo "This page was created in ".$totaltime." seconds <br />";
echo "Records inserted: " . $i . " <br/>";
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('lotw_users_update', $datetime , 'no');
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('lotw_users_update', $datetime , 'no');
}
public function lotw_check() {
@@ -394,9 +404,9 @@ class Update extends CI_Controller {
if ($nCount > 0)
{
echo "DONE: " . number_format($nCount) . " DOKs and SDOKs saved";
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('dok_file_update', $datetime , 'no');
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('dok_file_update', $datetime , 'no');
} else {
echo"FAILED: Empty file";
}
@@ -444,9 +454,9 @@ class Update extends CI_Controller {
if ($nCount > 0)
{
echo "DONE: " . number_format($nCount) . " SOTA's saved";
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('sota_file_update', $datetime , 'no');
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('sota_file_update', $datetime , 'no');
} else {
echo"FAILED: Empty file";
}
@@ -481,12 +491,12 @@ class Update extends CI_Controller {
$data = str_getcsv($csv,"\n");
$nCount = 0;
foreach ($data as $idx => $row) {
if ($idx == 0) continue; // Skip line we are not interested in
$row = str_getcsv($row, ',');
if ($row[0]) {
fwrite($wwfffilehandle, $row[0].PHP_EOL);
$nCount++;
}
if ($idx == 0) continue; // Skip line we are not interested in
$row = str_getcsv($row, ',');
if ($row[0]) {
fwrite($wwfffilehandle, $row[0].PHP_EOL);
$nCount++;
}
}
fclose($wwfffilehandle);
@@ -494,9 +504,9 @@ class Update extends CI_Controller {
if ($nCount > 0)
{
echo "DONE: " . number_format($nCount) . " WWFF's saved";
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('wwff_file_update', $datetime , 'no');
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('wwff_file_update', $datetime , 'no');
} else {
echo"FAILED: Empty file";
}
@@ -527,12 +537,12 @@ class Update extends CI_Controller {
$data = str_getcsv($csv,"\n");
$nCount = 0;
foreach ($data as $idx => $row) {
if ($idx == 0) continue; // Skip line we are not interested in
$row = str_getcsv($row, ',');
if ($row[0]) {
fwrite($potafilehandle, $row[0].PHP_EOL);
$nCount++;
}
if ($idx == 0) continue; // Skip line we are not interested in
$row = str_getcsv($row, ',');
if ($row[0]) {
fwrite($potafilehandle, $row[0].PHP_EOL);
$nCount++;
}
}
fclose($potafilehandle);
@@ -540,9 +550,9 @@ class Update extends CI_Controller {
if ($nCount > 0)
{
echo "DONE: " . number_format($nCount) . " POTA's saved";
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('pota_file_update', $datetime , 'no');
$datetime = new DateTime("now", new DateTimeZone('UTC'));
$datetime = $datetime->format('Ymd h:i');
$this->optionslib->update('pota_file_update', $datetime , 'no');
} else {
echo"FAILED: Empty file";
}