/**
  * Returns any updates needs or false if everything is up to date.
  *
  * @return array|bool
  */
 public function getUpdatesNeeded()
 {
     $update_check = new wfUpdateCheck();
     $needs_update = $update_check->checkAllUpdates()->needsAnyUpdates();
     if ($needs_update) {
         return array('core' => $update_check->getCoreUpdateVersion(), 'plugins' => $update_check->getPluginUpdates(), 'themes' => $update_check->getThemeUpdates());
     }
     return false;
 }
Example #2
0
 /**
  *
  */
 private function scan_oldVersions()
 {
     $this->statusIDX['oldVersions'] = wordfence::statusStart("Scanning for old themes, plugins and core files");
     $haveIssues = false;
     $update_check = new wfUpdateCheck();
     $update_check->checkAllUpdates();
     // WordPress core updates needed
     if ($update_check->needsCoreUpdate()) {
         if ($this->addIssue('wfUpgrade', 1, 'wfUpgrade' . $update_check->getCoreUpdateVersion(), 'wfUpgrade' . $update_check->getCoreUpdateVersion(), "Your WordPress version is out of date", "WordPress version " . $update_check->getCoreUpdateVersion() . " is now available. Please upgrade immediately to get the latest security updates from WordPress.", array('currentVersion' => $this->wp_version, 'newVersion' => $update_check->getCoreUpdateVersion()))) {
             $haveIssues = true;
         }
     }
     // Plugin updates needed
     if (count($update_check->getPluginUpdates()) > 0) {
         foreach ($update_check->getPluginUpdates() as $plugin) {
             $key = 'wfPluginUpgrade' . ' ' . $plugin['pluginFile'] . ' ' . $plugin['newVersion'] . ' ' . $plugin['Version'];
             if ($this->addIssue('wfPluginUpgrade', 1, $key, $key, "The Plugin \"" . $plugin['Name'] . "\" needs an upgrade.", "You need to upgrade \"" . $plugin['Name'] . "\" to the newest version to ensure you have any security fixes the developer has released.", $plugin)) {
                 $haveIssues = true;
             }
         }
     }
     // Theme updates needed
     if (count($update_check->getThemeUpdates()) > 0) {
         foreach ($update_check->getThemeUpdates() as $theme) {
             $key = 'wfThemeUpgrade' . ' ' . $theme['Name'] . ' ' . $theme['version'] . ' ' . $theme['newVersion'];
             if ($this->addIssue('wfThemeUpgrade', 1, $key, $key, "The Theme \"" . $theme['Name'] . "\" needs an upgrade.", "You need to upgrade \"" . $theme['Name'] . "\" to the newest version to ensure you have any security fixes the developer has released.", $theme)) {
                 $haveIssues = true;
             }
         }
     }
     wordfence::statusEnd($this->statusIDX['oldVersions'], $haveIssues);
 }