| @@ -72,11 +72,8 @@ | ||
| 72 | 72 | $settings = new Vigilante_Settings(); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - // Create backup of current files FIRST (before any modifications) | |
| 77 | - self::create_activation_backup( $settings ); | |
| 78 | - | |
| 79 | 76 | // Apply htaccess protection (part of firewall module) |
| 80 | 77 | if ( $settings->is_module_enabled( 'firewall' ) ) { |
| 81 | 78 | self::apply_htaccess_protection( $settings ); |
| 82 | 79 | } |
| @@ -226,25 +223,8 @@ | ||
| 226 | 223 | return true; |
| 227 | 224 | } |
| 228 | 225 | |
| 229 | 226 | /** |
| 230 | - * Create backup of important files | |
| 231 | - * | |
| 232 | - * @param Vigilante_Settings $settings Settings instance. | |
| 233 | - */ | |
| 234 | - private static function create_activation_backup( $settings ) { | |
| 235 | - require_once VIGILANTE_INCLUDES_DIR . 'class-backup-manager.php'; | |
| 236 | - | |
| 237 | - $backup_manager = new Vigilante_Backup_Manager(); | |
| 238 | - $result = $backup_manager->create_backups(); | |
| 239 | - | |
| 240 | - if ( is_wp_error( $result ) ) { | |
| 241 | - // Store error for admin notice | |
| 242 | - set_transient( 'vigilante_backup_error', $result->get_error_message(), 60 ); | |
| 243 | - } | |
| 244 | - } | |
| 245 | - | |
| 246 | - /** | |
| 247 | 227 | * Apply htaccess protection |
| 248 | 228 | * |
| 249 | 229 | * @param Vigilante_Settings $settings Settings instance. |
| 250 | 230 | */ |
| @@ -334,8 +314,14 @@ | ||
| 334 | 314 | * |
| 335 | 315 | * @param Vigilante_Settings $settings Settings instance. |
| 336 | 316 | */ |
| 337 | 317 | private static function remove_sensitive_files( $settings ) { |
| 318 | + // They sit in the root every site of a network shares. Until 2.11.6 the | |
| 319 | + // activation on any site removed them. | |
| 320 | + if ( ! Vigilante_Settings::can_write_shared_files() ) { | |
| 321 | + return; | |
| 322 | + } | |
| 323 | + | |
| 338 | 324 | $advanced = $settings->get_section( 'advanced' ); |
| 339 | 325 | |
| 340 | 326 | // Remove readme.html |
| 341 | 327 | if ( ! empty( $advanced['remove_readme'] ) ) { |
| @@ -375,9 +361,15 @@ | ||
| 375 | 361 | $database = new Vigilante_Database(); |
| 376 | 362 | $activity_log = null; // Not needed for baseline generation |
| 377 | 363 | |
| 378 | 364 | $fi = new Vigilante_File_Integrity( $settings, $database, $activity_log ); |
| 379 | - $fi->regenerate_all_baselines(); | |
| 365 | + | |
| 366 | + // Same care as the migration: reactivating the plugin on a site that | |
| 367 | + // already has an approved baseline must not throw it away and adopt | |
| 368 | + // whatever the files say today. | |
| 369 | + if ( ! $fi->get_critical_files_baseline() ) { | |
| 370 | + $fi->regenerate_all_baselines(); | |
| 371 | + } | |
| 380 | 372 | } |
| 381 | 373 | |
| 382 | 374 | /** |
| 383 | 375 | * Schedule cron events |