From a46467b9149ef5435124c3cfab5737332293afa5 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 11 Feb 2026 00:01:48 +0000
Subject: [PATCH] =upload manager tweaks; especially for fields that already have values and are being updated
---
activate.php | 45 ++++++++++++++++++++++-----------------------
1 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/activate.php b/activate.php
index 39b04a1..77cc1e4 100644
--- a/activate.php
+++ b/activate.php
@@ -1,6 +1,10 @@
<?php
use JVBase\integrations\Umami;
+use JVBase\managers\Cache;
+use JVBase\managers\ReferralManager;
+use JVBase\managers\SEO\SEOAdminPage;
+use JVBase\utility\Features;
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
@@ -8,7 +12,6 @@
function jvbActivatePlugin():void
{
- ob_start();
$validator = new JVBase\utility\Validator();
$validation = $validator->validateAll();
error_log('Validation result: '.print_r($validation, true));
@@ -40,27 +43,14 @@
remove_role('editor');
error_log('Roles removed!');
error_log('New Roles done!');
+ jvbRegisterAdminPages();
if (array_key_exists('integrations', JVB_SITE) && array_key_exists('umami', JVB_SITE['integrations']) && JVB_SITE['integrations']['umami']=== true) {
error_log('Adding Umami tables');
Umami::createTables();
}
+
+ JVB()->directories()->activate();
error_log('Activation done! Huzzah!');
-
- $output = ob_get_clean();
- if ( $output ) {
- // Grab a backtrace to see what caused the output
- $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
- $formatted = [];
- foreach ( $trace as $step ) {
- if ( isset( $step['file'], $step['line'] ) ) {
- $formatted[] = $step['file'] . ':' . $step['line'];
- }
- }
-
- error_log( "⚠️ Plugin activation produced unexpected output (" . strlen( $output ) . " chars)" );
- error_log( "Output: " . trim( $output ) );
- error_log( "Backtrace: " . implode( ' <- ', $formatted ) );
- }
}
function jvbAddAdminCaps()
@@ -199,6 +189,7 @@
jvbDeleteOptions();
jvbDeleteDashboard();
jvbDeleteDirectories();
+ Cache::flushAll();
do_action('jvbDeactivate');
}
@@ -234,14 +225,13 @@
$pages = new WP_Query([
'post_type' => BASE.'directory',
'posts_per_page' => -1,
- 'post_status' => 'any',
+ 'post_status' => ['publish', 'draft','trash'],
'fields' => 'ids'
]);
- if ($pages->have_posts()) {
- foreach ($pages->posts as $ID) {
- wp_delete_post($ID, true);
- }
- }
+ foreach ($pages->posts as $ID) {
+ wp_delete_post($ID, true);
+ }
+
}
function jvbClearSchedules()
{
@@ -268,3 +258,12 @@
do_action('jvbDailyReset');
error_log('Daily options reset completed at ' . current_time('Y-m-d H:i:s'));
}
+
+
+function jvbRegisterAdminPages():void
+{
+ if (Features::forSite()->has('referrals')){
+ ReferralManager::addSubpage();
+ }
+ SEOAdminPage::addSubpage();
+}
--
Gitblit v1.10.0