From f7ca614b383e3792841240391199e228638993de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20G=C3=BCnther?=
Date: Mon, 12 Aug 2024 15:48:55 +0200
Subject: [PATCH] Added Control element for manual cronjobs
---
bdp-kompass.php | 5 ++++-
.../Controllers/SettingsPage.php | 7 +++++++
settings/views/settings.php | 21 ++++++++++++++++++-
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/bdp-kompass.php b/bdp-kompass.php
index 3ce5898..168a497 100644
--- a/bdp-kompass.php
+++ b/bdp-kompass.php
@@ -12,6 +12,7 @@
* Text Domain: bdp-kompass
*/
+use Bdp\Libs\WpConfigEditor;
use Bdp\Modules\EventParticipants\Controllers\MainController as EventsMain;
use Bdp\Modules\KompassSettings\Controllers\SettingsPage as KomnpassSettings;
use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as OptionsPageAlias;
@@ -32,7 +33,9 @@ function bdp_plugin_init() {
Security::ProhibitBots();
Security::SetPageFilters();
- if (null == get_option('kompass_already_installed', null)) {
+# WpConfigEditor::updateConfig('DISABLE_WP_CRON', true);
+
+ if (null == get_option('kompass_already_installed', null)) {
Seo::setup();
Security::setup();
update_option('kompass_already_installed', true);
diff --git a/modules/KompassSettings/Controllers/SettingsPage.php b/modules/KompassSettings/Controllers/SettingsPage.php
index 2428e76..4d85302 100644
--- a/modules/KompassSettings/Controllers/SettingsPage.php
+++ b/modules/KompassSettings/Controllers/SettingsPage.php
@@ -3,6 +3,8 @@
namespace Bdp\Modules\KompassSettings\Controllers;
+use Bdp\Libs\WpConfigEditor;
+
class SettingsPage
{
public static function add_menu() {
@@ -89,6 +91,11 @@ class SettingsPage
if (isset($_POST['used_for_state'])) { update_option('paged_used_for_state', true); }
if (isset($_POST['self_register'])) { update_option('user_can_register', true); }
if (isset($_POST['use_mareike_theme'])) { update_option('use_mareike_theme', true); }
+ if (isset($_POST['external_cronjobs'])) {
+ WpConfigEditor::updateConfig('DISABLE_WP_CRON', true);
+ } else {
+ WpConfigEditor::deleteConfigKey('DISABLE_WP_CRON');
+ }
kompass_print_message_box('Die Einstellungen wurden gespeichert.');
}
diff --git a/settings/views/settings.php b/settings/views/settings.php
index 5874117..1797073 100644
--- a/settings/views/settings.php
+++ b/settings/views/settings.php
@@ -1,4 +1,7 @@
-