/** * Install all assets required for a useable system. */ public function Install() { if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION) < 0) { ?> <html> <head> <link rel="stylesheet" href="<?php echo esc_attr($this->GetBaseUrl() . '/css/install-error.css?v=' . filemtime($this->GetBaseDir() . '/css/install-error.css')); ?> " type="text/css" media="all"/> </head><body> <div class="warn-wrap"> <div class="warn-icon-tri"></div><div class="warn-icon-chr">!</div><div class="warn-icon-cir"></div> <?php echo sprintf(__('You are using a version of PHP that is older than %s, which is no longer supported.<br/>Contact us on <a href="mailto:plugins@wpwhitesecurity.com">plugins@wpwhitesecurity.com</a> to help you switch the version of PHP you are using.'), self::MIN_PHP_VERSION); ?> </div> </body> </html><?php die(1); } // ensure that the system is installed and schema is correct self::getConnector()->installAll(); $PreInstalled = $this->IsInstalled(); // if system already installed, do updates now (if any) $OldVersion = $this->GetOldVersion(); $NewVersion = $this->GetNewVersion(); if ($PreInstalled && $OldVersion != $NewVersion) { $this->Update($OldVersion, $NewVersion); } // Load options from wp_options table or wp_sitemeta in multisite enviroment $data = $this->read_options_prefixed("wsal-"); if (!empty($data)) { $this->SetOptions($data); } $this->deleteAllOptions(); // if system wasn't installed, try migration now if (!$PreInstalled && $this->CanMigrate()) { $this->Migrate(); } //setting the prunig date with the old value or the default value $pruningDate = $this->settings->GetPruningDate(); $this->settings->SetPruningDate($pruningDate); $pruningEnabled = $this->settings->IsPruningLimitEnabled(); $this->settings->SetPruningLimitEnabled($pruningEnabled); //setting the prunig limit with the old value or the default value $pruningLimit = $this->settings->GetPruningLimit(); $this->settings->SetPruningLimit($pruningLimit); // install cleanup hook (remove older one if it exists) wp_clear_scheduled_hook('wsal_cleanup'); wp_schedule_event(current_time('timestamp') + 600, 'hourly', 'wsal_cleanup'); }