| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.1.23 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2026 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2024 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FireBox\Core\Admin; |
| @@ -17,21 +17,17 @@ | ||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | if (!class_exists('Activation')) |
| 20 | 20 | { |
| 21 | - require_once FBOX_PLUGIN_DIR . 'Inc/Framework/Inc/Admin/Includes/Activation.php'; | |
| 21 | + require_once FBOX_PLUGIN_DIR . '/Inc/Framework/Inc/Admin/Includes/Activation.php'; | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | class PluginActivation extends \Activation |
| 25 | 25 | { |
| 26 | 26 | /** |
| 27 | - * Installs FireBox on the current site. | |
| 28 | - * | |
| 29 | - * Idempotent: it runs on activation, for every site of a network, when a | |
| 30 | - * site is added to a network, and as a self-heal on version drift. Callers | |
| 31 | - * go through SiteInstaller, which decides which sites to run it on and | |
| 32 | - * handles the migrations an existing site needs. | |
| 33 | - * | |
| 27 | + * Runs once we activate the plugin. | |
| 28 | + * Set plugin data | |
| 29 | + * | |
| 34 | 30 | * @return void |
| 35 | 31 | */ |
| 36 | 32 | public function start() |
| 37 | 33 | { |
| @@ -36,69 +32,33 @@ | ||
| 36 | 32 | public function start() |
| 37 | 33 | { |
| 38 | 34 | $this->pluginActivation(); |
| 39 | 35 | |
| 36 | + require_once FBOX_PLUGIN_DIR . 'Inc/Framework/Inc/Helpers/Directory.php'; | |
| 37 | + require_once FBOX_PLUGIN_DIR . 'Inc/Framework/Inc/Helpers/WPHelper.php'; | |
| 40 | 38 | \FireBox\Core\Helpers\Activation::createLibraryDirectories(); |
| 41 | - | |
| 42 | 39 | |
| 40 | + // Set plugin version | |
| 41 | + update_option('firebox_version', FBOX_VERSION); | |
| 43 | 42 | |
| 44 | - $this->installDefaultSettings(); | |
| 43 | + // set default plugin settings | |
| 44 | + if (!get_option('firebox_settings')) | |
| 45 | + { | |
| 46 | + $settings = [ | |
| 47 | + 'loadCSS' => '1', | |
| 48 | + 'loadVelocity' => '1', | |
| 49 | + 'showcopyright' => '1', | |
| 50 | + 'show_admin_bar_menu_item' => '1', | |
| 51 | + 'debug' => '0', | |
| 52 | + 'statsdays' => '730', | |
| 53 | + 'geo_license_key' => '', | |
| 54 | + 'keep_data_on_uninstall' => '1', | |
| 55 | + 'enable_phpscripts' => '0', | |
| 56 | + 'license_key' => '', | |
| 57 | + ]; | |
| 58 | + update_option('firebox_settings', $settings); | |
| 59 | + } | |
| 45 | 60 | |
| 46 | 61 | // initialize capabilities |
| 47 | 62 | new Capabilities(); |
| 48 | - | |
| 49 | - // Each site runs its own log retention cleanup; cron is per site. | |
| 50 | - \FireBox\Core\FB\Log::maybeScheduleCleanup(); | |
| 51 | 63 | } |
| 52 | - | |
| 53 | - /** | |
| 54 | - * Whether this site already has the FireBox tables. | |
| 55 | - * | |
| 56 | - * @return bool | |
| 57 | - */ | |
| 58 | - public function tablesInstalled() | |
| 59 | - { | |
| 60 | - return (bool) $this->tablesInitialized(); | |
| 61 | - } | |
| 62 | - | |
| 63 | - /** | |
| 64 | - * Writes any missing default settings. | |
| 65 | - * | |
| 66 | - * Missing keys are filled in rather than the whole option being written | |
| 67 | - * only when absent: a site can end up with a partial firebox_settings from | |
| 68 | - * a migration long before it ever sees this method. | |
| 69 | - * | |
| 70 | - * @return void | |
| 71 | - */ | |
| 72 | - private function installDefaultSettings() | |
| 73 | - { | |
| 74 | - $settings = get_option('firebox_settings'); | |
| 75 | - $settings = is_array($settings) ? $settings : []; | |
| 76 | - | |
| 77 | - $defaults = [ | |
| 78 | - 'showcopyright' => '1', | |
| 79 | - 'show_admin_bar_menu_item' => '1', | |
| 80 | - 'debug' => '0', | |
| 81 | - 'statsdays' => '730', | |
| 82 | - 'geo_license_key' => '', | |
| 83 | - 'keep_data_on_uninstall' => '1', | |
| 84 | - 'usage_tracking' => '0', | |
| 85 | - 'enable_phpscripts' => '0', | |
| 86 | - 'license_key' => '', | |
| 87 | - ]; | |
| 88 | - | |
| 89 | - foreach (\FireBox\Core\Helpers\Integrations::getSettingsKeys() as $integration_key) | |
| 90 | - { | |
| 91 | - $defaults[$integration_key] = ''; | |
| 92 | - } | |
| 93 | - | |
| 94 | - $missing = array_diff_key($defaults, $settings); | |
| 95 | - | |
| 96 | - if (!$missing) | |
| 97 | - { | |
| 98 | - return; | |
| 99 | - } | |
| 100 | - | |
| 101 | - update_option('firebox_settings', array_merge($settings, $missing)); | |
| 102 | - } | |
| 103 | - | |
| 104 | -} | |
| 64 | +} | |