wp-staging
Last commit date
Backend
4 months ago
Backup
4 months ago
Basic
4 months ago
Component
6 months ago
Core
4 months ago
Framework
4 months ago
Frontend
5 months ago
Notifications
8 months ago
Staging
4 months ago
assets
4 months ago
languages
1 year ago
resources
1 year ago
vendor_wpstg
4 months ago
views
4 months ago
CONTRIBUTING.md
2 years ago
Deactivate.php
8 months ago
README.md
9 months ago
SECURITY.md
2 years ago
autoloader.php
6 months ago
bootstrap.php
9 months ago
constantsFree.php
4 months ago
freeBootstrap.php
1 year ago
install.php
1 year ago
opcacheBootstrap.php
4 months ago
readme.txt
4 months ago
runtimeRequirements.php
5 months ago
uninstall.php
5 months ago
wp-staging-error-handler.php
6 months ago
wp-staging.php
4 months ago
install.php
71 lines
| 1 | <?php |
| 2 | /** |
| 3 | * This file is hooked as the \register_activation_hook of the plugin, |
| 4 | * therefore it runs as a standalone script that needs to be bootstrapped. |
| 5 | * |
| 6 | * @var string $pluginFilePath The absolute path to the main file of WP Staging. |
| 7 | */ |
| 8 | |
| 9 | use WPStaging\Backend\Optimizer\Optimizer; |
| 10 | use WPStaging\Core\Cron\Cron; |
| 11 | use WPStaging\Core\DTO\Settings; |
| 12 | use WPStaging\Core\Utils\Htaccess; |
| 13 | use WPStaging\Core\WPStaging; |
| 14 | |
| 15 | if (!class_exists('WPStaging\Core\Cron\Cron')) { |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Register Cron Events |
| 21 | */ |
| 22 | $cron = (new Cron)->scheduleEvent(); |
| 23 | |
| 24 | /** |
| 25 | * Install the Optimizer |
| 26 | */ |
| 27 | $optimizer = (new Optimizer)->installOptimizer(); |
| 28 | |
| 29 | /** |
| 30 | * Add the transient to redirect for class Welcome (Not for multisites) and not for Pro version |
| 31 | */ |
| 32 | if (!defined('WPSTGPRO_VERSION')) { |
| 33 | set_transient('wpstg_activation_redirect', true, 3600); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Create Htaccess |
| 38 | */ |
| 39 | $htaccess = new Htaccess(); |
| 40 | if (extension_loaded('litespeed')) { |
| 41 | $htaccess->createLitespeed(ABSPATH . '.htaccess'); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Set default values for settings |
| 46 | */ |
| 47 | $settings = (new Settings())->setDefault(); |
| 48 | |
| 49 | /** |
| 50 | * Add plugin install for free or pro version in wp options table. |
| 51 | * If that option already exists do not overwrite it to always keep it |
| 52 | */ |
| 53 | if (defined('WPSTGPRO_VERSION')) { |
| 54 | add_option('wpstgpro_install_date', date('Y-m-d h:i:s')); |
| 55 | } else { |
| 56 | add_option('wpstg_free_install_date', date('Y-m-d h:i:s')); |
| 57 | } |
| 58 | |
| 59 | // @deprecated since 13.10.2022 Remove in 2023 |
| 60 | add_option('wpstg_installDate', date('Y-m-d h:i:s')); |
| 61 | |
| 62 | /** |
| 63 | * Register the Cron Events for Scheduled Backups |
| 64 | */ |
| 65 | WPStaging::make(\WPStaging\Backup\BackupScheduler::class)->reCreateCron(); |
| 66 | |
| 67 | /** |
| 68 | * Create backups dir on activation. |
| 69 | */ |
| 70 | WPStaging::make(\WPStaging\Backup\BackupServiceProvider::class)->createBackupsDirectory(); |
| 71 |