Merge pull request #19017 from eileenmcnaughton/remove_recur
[civicrm-core.git] / CRM / Utils / VersionCheck.php
index 18fb15511c457767cbc53902298ad16dfb800bce..fbb05a1929c9cc1efad57f47d06c2bea49279082 100644 (file)
@@ -74,9 +74,10 @@ class CRM_Utils_VersionCheck {
   /**
    * Self-populates version info
    *
-   * @throws \Exception
+   * @param bool $force
+   * @throws Exception
    */
-  public function initialize() {
+  public function initialize($force = FALSE) {
     $this->getJob();
 
     // Populate remote $versionInfo from cache file
@@ -84,9 +85,9 @@ class CRM_Utils_VersionCheck {
 
     // Fallback if scheduled job is enabled but has failed to run.
     $expiryTime = time() - self::CACHEFILE_EXPIRE;
-    if (!empty($this->cronJob['is_active']) &&
+    if ($force || (!empty($this->cronJob['is_active']) &&
       (!$this->isInfoAvailable || filemtime($this->cacheFile) < $expiryTime)
-    ) {
+    )) {
       // First try updating the files modification time, for 2 reasons:
       //  - if the file is not writeable, this saves the trouble of pinging back
       //  - if the remote server is down, this will prevent an immediate retry
@@ -237,7 +238,7 @@ class CRM_Utils_VersionCheck {
       $this->stats['extensions'][] = [
         'name' => $dao->full_name,
         'enabled' => $dao->is_active,
-        'version' => isset($info->version) ? $info->version : NULL,
+        'version' => $info->version ?? NULL,
       ];
     }
   }