From 4e034966c2a23368eff026d9f57db5405be3b1dc Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 2 Aug 2024 11:48:41 +0200 Subject: [PATCH 01/56] migration lockfile lifetime --- application/config/migration.php | 15 +++++++++++ application/controllers/Migrate.php | 3 ++- system/libraries/Migration.php | 39 +++++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/application/config/migration.php b/application/config/migration.php index 03983d214..c19a65279 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -37,5 +37,20 @@ $config['migration_version'] = 211; $config['migration_path'] = APPPATH . 'migrations/'; +/* +|-------------------------------------------------------------------------- +| Migration Lockfile +|-------------------------------------------------------------------------- +| +| Path to the migration lockfile. +| This lockfile prevents migrations from running twice +| +*/ +$config['migration_lockfile'] = sys_get_temp_dir() . '/.migration_running'; + +// the maximum age of the lockfile in seconds +$config['migration_lf_maxage'] = 30; + + /* End of file migration.php */ /* Location: ./application/config/migration.php */ diff --git a/application/controllers/Migrate.php b/application/controllers/Migrate.php index 65bf69dba..d1da26609 100644 --- a/application/controllers/Migrate.php +++ b/application/controllers/Migrate.php @@ -3,6 +3,7 @@ class Migrate extends CI_Controller { public function index() { $this->load->library('Migration'); + $this->load->config('migration'); $result = array(); $latest = $this->migration->latest(); @@ -12,7 +13,7 @@ class Migrate extends CI_Controller { log_message('error', 'Migration failed'); $result['status'] = 'error'; } else { - while (file_exists(APPPATH . 'cache/.migration_running')) { + while (file_exists($this->config->item('migration_lockfile'))) { sleep(1); } $result['status'] = 'success'; diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index d08f78b5e..b70ea530b 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -91,7 +91,16 @@ class CI_Migration { * * @var string */ - protected $_migration_lockfile = APPPATH . 'cache/.migration_running'; + protected $_migration_lockfile = NULL; + + /** + * Max Age of the migration lockfile + * + * @var int + */ + + protected $_migration_lf_maxage = NULL; + /** * Whether to automatically run migrations @@ -147,6 +156,12 @@ class CI_Migration { // Add trailing slash if not set $this->_migration_path = rtrim($this->_migration_path, '/').'/'; + // If not set, set it + $this->_migration_lockfile !== '' OR $this->_migration_lockfile = '/tmp/.migration_running'; + + // selockfile maxage if not set in config file. Fallback is 60 seconds. + $this->_migration_lf_maxage !== '' OR $this->_migration_lf_maxage = 60; + // Load migration language $this->lang->load('migration'); @@ -341,7 +356,27 @@ class CI_Migration { } } else { - log_message('debug', 'Migration process is currently locked. Second migration attempt ignored.'); + + log_message('debug', 'There is a lockfile for migrations. Checking the age...'); + + // Get the file creation date + $lockfile_ctime = filemtime($this->_migration_lockfile); + + //compare to the current time + $tdiff = time() - $lockfile_ctime; + log_message('debug', 'Migration lockfile lifetime in seconds: '.$tdiff.'/'.$this->_migration_lf_maxage); + + // if the file is older then the configured limit, delete it + if ($tdiff > $this->_migration_lf_maxage) { + + unlink($this->_migration_lockfile); + log_message('debug', 'Deleted migration lockfile because it was older then maxage.'); + + } else { + + log_message('debug', 'Migration process is currently locked. Second migration attempt ignored.'); + + } } return $current_version; From d538aaf7d5f59b2561602028cf29eeb94d6314f7 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 2 Aug 2024 12:02:47 +0200 Subject: [PATCH 02/56] set the lifetime higher --- application/config/migration.php | 2 +- system/libraries/Migration.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/config/migration.php b/application/config/migration.php index c19a65279..d0dbce0ab 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -49,7 +49,7 @@ $config['migration_path'] = APPPATH . 'migrations/'; $config['migration_lockfile'] = sys_get_temp_dir() . '/.migration_running'; // the maximum age of the lockfile in seconds -$config['migration_lf_maxage'] = 30; +$config['migration_lf_maxage'] = 300; /* End of file migration.php */ diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index b70ea530b..256748747 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -159,8 +159,8 @@ class CI_Migration { // If not set, set it $this->_migration_lockfile !== '' OR $this->_migration_lockfile = '/tmp/.migration_running'; - // selockfile maxage if not set in config file. Fallback is 60 seconds. - $this->_migration_lf_maxage !== '' OR $this->_migration_lf_maxage = 60; + // selockfile maxage if not set in config file. Fallback is 480 seconds. + $this->_migration_lf_maxage !== '' OR $this->_migration_lf_maxage = 480; // Load migration language $this->lang->load('migration'); From 6546fb33ed779b56607cf86204a3a3a9d1fbefe8 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 5 Aug 2024 10:31:06 +0200 Subject: [PATCH 03/56] issue bot (debug only) --- .github/workflows/issue_bot.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/issue_bot.yml diff --git a/.github/workflows/issue_bot.yml b/.github/workflows/issue_bot.yml new file mode 100644 index 000000000..c0acecc27 --- /dev/null +++ b/.github/workflows/issue_bot.yml @@ -0,0 +1,24 @@ +name: Issue Bot +on: + workflow_dispatch: + push: + branches: dev + schedule: + - cron: "30 1 * * *" + +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/stale@v9.0.0 + with: + any-of-labels: "wait4close" + exempt-all-milestones: true + days-before-issue-close: 14 + close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as 'wait4close'." + days-before-pr-stale: -1 + days-before-pr-close: -1 + repo-token: ${{ secrets.GITHUB_TOKEN }} + debug-only: true From 4433b1c1c98577879ec36f9bfe7d01c25db8f3b0 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 5 Aug 2024 08:31:31 +0000 Subject: [PATCH 04/56] po/mo updates --- assets/lang_src/messages.pot | 2 +- install/includes/gettext/lang_src/installer.pot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/lang_src/messages.pot b/assets/lang_src/messages.pot index bd1246696..23af6696a 100644 --- a/assets/lang_src/messages.pot +++ b/assets/lang_src/messages.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@wavelog.org\n" -"POT-Creation-Date: 2024-08-04 19:40+0000\n" +"POT-Creation-Date: 2024-08-05 08:31+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/install/includes/gettext/lang_src/installer.pot b/install/includes/gettext/lang_src/installer.pot index b879565c4..4e2adec15 100644 --- a/install/includes/gettext/lang_src/installer.pot +++ b/install/includes/gettext/lang_src/installer.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@wavelog.org\n" -"POT-Creation-Date: 2024-08-04 19:40+0000\n" +"POT-Creation-Date: 2024-08-05 08:31+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 51c8c3d708e297afb6a5fa35d5211f6d001ba9cd Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 5 Aug 2024 10:36:05 +0200 Subject: [PATCH 05/56] tmp disable translations workflow --- .github/workflows/issue_bot.yml | 4 ++-- .github/workflows/translation.yml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/issue_bot.yml b/.github/workflows/issue_bot.yml index c0acecc27..7bb78eed9 100644 --- a/.github/workflows/issue_bot.yml +++ b/.github/workflows/issue_bot.yml @@ -14,10 +14,10 @@ jobs: steps: - uses: actions/stale@v9.0.0 with: - any-of-labels: "wait4close" + any-of-labels: "wait 4 close" exempt-all-milestones: true days-before-issue-close: 14 - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as 'wait4close'." + close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as 'wait 4 close'." days-before-pr-stale: -1 days-before-pr-close: -1 repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index 626d90ac4..210620601 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -1,9 +1,10 @@ name: Run the po generator script on: - push: - branches: - - dev + workflow_dispatch: + # push: + # branches: + # - dev jobs: build: From c6493cb69bf1a502bf7ac908434bb5c2a8b6f4e9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 5 Aug 2024 10:39:08 +0200 Subject: [PATCH 06/56] reduce time for testing --- .github/workflows/issue_bot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue_bot.yml b/.github/workflows/issue_bot.yml index 7bb78eed9..0e1adf463 100644 --- a/.github/workflows/issue_bot.yml +++ b/.github/workflows/issue_bot.yml @@ -16,8 +16,8 @@ jobs: with: any-of-labels: "wait 4 close" exempt-all-milestones: true - days-before-issue-close: 14 - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as 'wait 4 close'." + days-before-issue-close: 5 + close-issue-message: "This issue was closed because it has been inactive for 5 days since being marked as 'wait 4 close'." days-before-pr-stale: -1 days-before-pr-close: -1 repo-token: ${{ secrets.GITHUB_TOKEN }} From e6dc3ab803e481c1ee91c86ce99bd11c8815d07e Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:54:03 +0200 Subject: [PATCH 07/56] Sets CQ Zone when DXCC is set when you create a location --- application/views/interface_assets/footer.php | 6 +++++ application/views/station_profile/create.php | 27 ++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index c38c60219..bea3fb9d7 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -681,6 +681,12 @@ $('#dxcc_id').ready(function() { $('#dxcc_id').on('change', function() { printWarning(); + let dxccadif = $('#dxcc_id').val(); + let dxccinfo = dxccarray.filter(function(dxcc) { + return dxcc.adif == dxccadif; + }); + $("#stationCQZoneInput").val(dxccinfo[0].cq); + // $("#stationITUZoneInput").val(dxccinfo[0].itu); // Commented out, since we do not have itu data. }); diff --git a/application/views/station_profile/create.php b/application/views/station_profile/create.php index 676951f65..d6ff7f8d6 100644 --- a/application/views/station_profile/create.php +++ b/application/views/station_profile/create.php @@ -1,3 +1,22 @@ +
@@ -201,18 +220,18 @@
-
- +
+
-
+
".__("HRDLog.net Userprofile page").""); ?>
- + ' + let message = ' ' BootstrapDialog.confirm({ - title: 'Query description', + title: '', size: BootstrapDialog.SIZE_NORMAL, cssClass: 'description-dialog', closable: true, nl2br: false, message: message, - btnCancelLabel: 'Cancel', - btnOKLabel: 'Save', + btnCancelLabel: lang_general_word_cancel, + btnOKLabel: lang_admin_save, callback: function(result) { if (result) { $.post("", { @@ -408,16 +408,16 @@ $(function () { }) .done(function(data) { $(".alert").remove(); - $(".card-body.main").append('
Your query has been saved!
'); + $(".card-body.main").append('
'); if ($("#querydropdown option").length == 0) { - var dropdowninfo = '

' + + var dropdowninfo = '

' + '
' + - '' + + '' + '
' + '' + '
' + - '' + + '' + '
'; $("#btn-save").after(dropdowninfo); } @@ -429,12 +429,12 @@ $(function () { } else { BootstrapDialog.show({ - title: 'Stored Queries', + title: '', type: BootstrapDialog.TYPE_WARNING, size: BootstrapDialog.SIZE_NORMAL, cssClass: 'queries-dialog', nl2br: false, - message: 'You need to make a query before you search!', + message: '', buttons: [{ label: lang_admin_close, action: function(dialogItself) { @@ -455,7 +455,7 @@ $(function () { }) .done(function(data) { - $('.exportbutton').html(''); + $('.exportbutton').html(''); $('.card-body.result').empty(); $(".search-results-box").show(); @@ -492,8 +492,8 @@ $(function () { function delete_stored_query(id) { BootstrapDialog.confirm({ - title: 'DANGER', - message: 'Warning! Are you sure you want delete this stored query?', + title: '', + message: '', type: BootstrapDialog.TYPE_DANGER, closable: true, draggable: true, @@ -507,7 +507,7 @@ $(function () { 'id': id }, success: function(data) { - $(".bootstrap-dialog-message").prepend('
The stored query has been deleted!
'); + $(".bootstrap-dialog-message").prepend('
'); $("#query_" + id).remove(); // removes query from table in dialog $("#querydropdown option[value='" + id + "']").remove(); // removes query from dropdown if ($("#querydropdown option").length == 0) { @@ -516,7 +516,7 @@ $(function () { }; }, error: function() { - $(".bootstrap-dialog-message").prepend('
The stored query could not be deleted. Please try again!
'); + $(".bootstrap-dialog-message").prepend('
'); }, }); } @@ -527,12 +527,12 @@ $(function () { function edit_stored_query(id) { $('#description_' + id).attr('contenteditable', 'true'); $('#description_' + id).focus(); - $('#edit_' + id).html('Save'); // Change to save button + $('#edit_' + id).html(''); // Change to save button } function save_edited_query(id) { $('#description_' + id).attr('contenteditable', 'false'); - $('#edit_' + id).html('Edit'); + $('#edit_' + id).html(''); $.ajax({ url: base_url + 'index.php/search/save_edited_query', type: 'post', @@ -541,12 +541,12 @@ $(function () { description: $('#description_' + id).html(), }, success: function(html) { - $('#edit_' + id).html('Edit'); // Change to edit button - $(".bootstrap-dialog-message").prepend('
The query description has been updated!
'); + $('#edit_' + id).html(''); // Change to edit button + $(".bootstrap-dialog-message").prepend('
'); $("#querydropdown option[value='" + id + "']").text($('#description_' + id).html()); // Change text in dropdown }, error: function() { - $(".bootstrap-dialog-message").prepend('
Something went wrong with the save. Please try again!
'); + $(".bootstrap-dialog-message").prepend('
'); }, }); } @@ -558,7 +558,7 @@ $(function () { type: 'post', success: function(html) { BootstrapDialog.show({ - title: 'Stored Queries', + title: '', size: BootstrapDialog.SIZE_WIDE, cssClass: 'queries-dialog', nl2br: false, @@ -586,7 +586,7 @@ $(function () { temp: "testvar" }) .done(function(data) { - $('.exportbutton').html(''); + $('.exportbutton').html(''); $('.card-body.result').empty(); $(".search-results-box").show(); @@ -622,12 +622,12 @@ $(function () { }); } else { BootstrapDialog.show({ - title: 'Stored Queries', + title: '', type: BootstrapDialog.TYPE_WARNING, size: BootstrapDialog.SIZE_NORMAL, cssClass: 'queries-dialog', nl2br: false, - message: 'You need to make a query before you search!', + message: '', buttons: [{ label: lang_admin_close, action: function(dialogItself) { @@ -1171,7 +1171,7 @@ $($('#callsign')).on('keypress',function(e) { if (data.error == 'not_logged_in') { $(".radio_cat_state" ).remove(); if($('.radio_login_error').length == 0) { - $('.qso_panel').prepend(''); + $('.qso_panel').prepend(''); } } // Put future Errorhandling here @@ -1450,7 +1450,7 @@ $(document).ready(function(){ uri->segment(1) == "gridsquares" && $this->uri->segment(2) == "band") { ?> var bands_available = ; - $('#gridsquare_bands').append('') + $('#gridsquare_bands').append('') $.each(bands_available, function(key, value) { $('#gridsquare_bands') .append($("") @@ -1589,7 +1589,7 @@ $(document).ready(function(){ uri->segment(1) == "activated_grids" && $this->uri->segment(2) == "band") { ?> var bands_available = ; - $('#gridsquare_bands').append('') + $('#gridsquare_bands').append('') $.each(bands_available, function(key, value) { $('#gridsquare_bands') .append($("") @@ -2113,9 +2113,9 @@ function viewQsl(picture, callsign) { textAndPic.append(''); var title = ''; if (callsign == null) { - title = 'QSL Card'; + title = ''; } else { - title = 'QSL Card for ' + callsign.replace('0', 'Ø'); + title = '' + callsign.replace('0', 'Ø'); } BootstrapDialog.show({ @@ -2134,8 +2134,8 @@ function viewQsl(picture, callsign) {