Comment fixes for CRM/Utils directory
[civicrm-core.git] / CRM / Utils / VersionCheck.php
index 6b7e07960eae3679c6cad5ed3fc2ecae36a4fa26..380c4b61dba191d7c1b643e9ee239adcec0b6536 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
  */
 class CRM_Utils_VersionCheck {
   const
@@ -191,7 +189,7 @@ class CRM_Utils_VersionCheck {
 
     if ($this->versionInfo && $this->localVersion) {
       if (isset($this->versionInfo[$this->localMajorVersion])) {
-        switch(CRM_Utils_Array::value('status', $this->versionInfo[$this->localMajorVersion])) {
+        switch (CRM_Utils_Array::value('status', $this->versionInfo[$this->localMajorVersion])) {
           case 'stable':
           case 'lts':
           case 'testing':
@@ -261,7 +259,7 @@ class CRM_Utils_VersionCheck {
         if (version_compare($this->localVersion, $release['version']) < 0) {
           if (!$this->ignoreDate || $this->ignoreDate < $release['date']) {
             $newerVersion['newest'] = $release['version'];
-            if (CRM_Utils_Array::value('security',$release)) {
+            if (CRM_Utils_Array::value('security', $release)) {
               $newerVersion['security'] = $release['version'];
             }
           }
@@ -271,46 +269,6 @@ class CRM_Utils_VersionCheck {
     return $newerVersion;
   }
 
-  /**
-   * Alert the site admin of new versions of CiviCRM.
-   * Show the message once a day
-   */
-  public function versionAlert() {
-    $versionAlertSetting = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionAlert', NULL, 1);
-    $securityAlertSetting = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'securityUpdateAlert', NULL, 3);
-    $settingsUrl = CRM_Utils_System::url('civicrm/admin/setting/misc', 'reset=1', FALSE, NULL, FALSE, FALSE, TRUE);
-    if (CRM_Core_Permission::check('administer CiviCRM') && $securityAlertSetting > 1 && $this->isSecurityUpdateAvailable()) {
-      $session = CRM_Core_Session::singleton();
-      if ($session->timer('version_alert', 24 * 60 * 60)) {
-        $msg = ts('This version of CiviCRM requires a security update.') .
-          '<ul>
-            <li><a href="https://civicrm.org/advisory">' . ts('Read advisory') . '</a></li>
-            <li><a href="https://civicrm.org/download">' . ts('Download now') . '</a></li>
-            <li><a class="crm-setVersionCheckIgnoreDate" href="' . $settingsUrl . '">' . ts('Suppress this message') . '</a></li>
-          </ul>';
-        $session->setStatus($msg, ts('Security Alert'), 'alert');
-        CRM_Core_Resources::singleton()
-          ->addScriptFile('civicrm', 'templates/CRM/Admin/Form/Setting/versionCheckOptions.js');
-      }
-    }
-    elseif (CRM_Core_Permission::check('administer CiviCRM') && $versionAlertSetting > 1) {
-      $newerVersion = $this->isNewerVersionAvailable();
-      if ($newerVersion) {
-        $session = CRM_Core_Session::singleton();
-        if ($session->timer('version_alert', 24 * 60 * 60)) {
-          $msg = ts('A newer version of CiviCRM is available: %1', array(1 => $newerVersion)) .
-            '<ul>
-              <li><a href="https://civicrm.org/download">' . ts('Download now') . '</a></li>
-              <li><a class="crm-setVersionCheckIgnoreDate" href="' . $settingsUrl . '">' . ts('Suppress this message') . '</a></li>
-            </ul>';
-          $session->setStatus($msg, ts('Update Available'), 'info');
-          CRM_Core_Resources::singleton()
-            ->addScriptFile('civicrm', 'templates/CRM/Admin/Form/Setting/versionCheckOptions.js');
-        }
-      }
-    }
-  }
-
   /**
    * Collect info about the site to be sent as pingback data.
    */
@@ -328,10 +286,10 @@ class CRM_Utils_VersionCheck {
         'uf' => $config->userFramework,
         'lang' => $config->lcMessages,
         'co' => $config->defaultContactCountry,
-        'ufv' => $config->userFrameworkVersion,
+        'ufv' => $config->userSystem->getVersion(),
         'PHP' => phpversion(),
         'MySQL' => CRM_CORE_DAO::singleValueQuery('SELECT VERSION()'),
-        'communityMessagesUrl' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'communityMessagesUrl', NULL, '*default*'),
+        'communityMessagesUrl' => Civi::settings()->get('communityMessagesUrl'),
       );
       $this->getPayProcStats();
       $this->getEntityStats();