| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* singleton pattern and cache the instance in this variable
*
* @var object
- * @static
*/
static private $_singleton = NULL;
* @var array
*/
protected $stats = array();
-
+
/**
* Path to cache file
*
protected $cacheFile;
/**
- * Class constructor
- *
+ * Class constructor.
*/
public function __construct() {
global $civicrm_root;
$this->cacheFile = $config->uploadDir . self::CACHEFILE_NAME;
if (file_exists($localFile)) {
- require_once ($localFile);
+ require_once $localFile;
}
if (function_exists('civicrmVersion')) {
$info = civicrmVersion();
}
/**
- * Static instance provider
+ * Static instance provider.
*
* Method providing static instance of CRM_Utils_VersionCheck,
* as in Singleton pattern
}
/**
- * Finds the release info for a minor version
+ * Finds the release info for a minor version.
* @param string $version
* @return array|null
*/
foreach ($this->versionInfo as $majorVersion) {
foreach ($majorVersion['releases'] as $release) {
if (!empty($release['security']) && $release['date'] > $localVersionDate
- && version_compare($this->localVersion, $release['version']) < 0) {
+ && version_compare($this->localVersion, $release['version']) < 0
+ ) {
if (!$this->ignoreDate || $this->ignoreDate < $release['date']) {
return TRUE;
}
* Get the latest version number if it's newer than the local one
*
* @return string|null
- * Returns version number of the latest release if it is greater than the local version
+ * Returns version number of the latest release if it is greater than the local version
*/
public function isNewerVersionAvailable() {
$newerVersion = NULL;
}
/**
- * Alert the site admin of new versions of CiviCRM
+ * 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);
+ $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)) {
<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');
+ CRM_Core_Resources::singleton()
+ ->addScriptFile('civicrm', 'templates/CRM/Admin/Form/Setting/versionCheckOptions.js');
}
}
elseif (CRM_Core_Permission::check('administer CiviCRM') && $versionAlertSetting > 1) {
<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');
+ CRM_Core_Resources::singleton()
+ ->addScriptFile('civicrm', 'templates/CRM/Admin/Form/Setting/versionCheckOptions.js');
}
}
}
}
/**
- * Collect info about the site to be sent as pingback data
+ * Collect info about the site to be sent as pingback data.
*/
private function getSiteStats() {
$config = CRM_Core_Config::singleton();
}
/**
- * Get active payment processor types
+ * Get active payment processor types.
*/
private function getPayProcStats() {
- $dao = new CRM_Financial_DAO_PaymentProcessor;
+ $dao = new CRM_Financial_DAO_PaymentProcessor();
$dao->is_active = 1;
$dao->find();
$ppTypes = array();
}
/**
- * Fetch counts from entity tables
+ * Fetch counts from entity tables.
* Add info to the 'entities' array
*/
private function getEntityStats() {
'CRM_Pledge_DAO_PledgeBlock' => NULL,
);
foreach ($tables as $daoName => $where) {
- $dao = new $daoName;
+ $dao = new $daoName();
if ($where) {
$dao->whereAdd($where);
}
}
/**
- * Save version info to file
+ * Save version info to file.
* @param string $contents
*/
private function writeCacheFile($contents) {