X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FVersionCheck.php;h=8ea909040db70a22fb45240f02757c79d36ed6cb;hb=04f0cd3edb17034f69923d08ab0c56a3b905530b;hp=0b3b9fa4607c11d8d1f643cbdfc4145ccd99d223;hpb=e752e9852cc4450833ff5a8b0ab2141d3c9b1906;p=civicrm-core.git diff --git a/CRM/Utils/VersionCheck.php b/CRM/Utils/VersionCheck.php index 0b3b9fa460..8ea909040d 100644 --- a/CRM/Utils/VersionCheck.php +++ b/CRM/Utils/VersionCheck.php @@ -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 @@ -177,6 +178,7 @@ class CRM_Utils_VersionCheck { * Add info to the 'entities' array */ private function getEntityStats() { + // FIXME hardcoded list = bad $tables = [ 'CRM_Activity_DAO_Activity' => 'is_test = 0', 'CRM_Case_DAO_Case' => 'is_deleted = 0', @@ -202,15 +204,18 @@ class CRM_Utils_VersionCheck { 'CRM_Mailing_Event_DAO_Delivered' => NULL, ]; foreach ($tables as $daoName => $where) { - $dao = new $daoName(); - if ($where) { - $dao->whereAdd($where); + if (class_exists($daoName)) { + /* @var \CRM_Core_DAO $dao */ + $dao = new $daoName(); + if ($where) { + $dao->whereAdd($where); + } + $short_name = substr($daoName, strrpos($daoName, '_') + 1); + $this->stats['entities'][] = [ + 'name' => $short_name, + 'size' => $dao->count(), + ]; } - $short_name = substr($daoName, strrpos($daoName, '_') + 1); - $this->stats['entities'][] = [ - 'name' => $short_name, - 'size' => $dao->count(), - ]; } } @@ -280,6 +285,7 @@ class CRM_Utils_VersionCheck { $params = [ 'http' => [ 'method' => 'POST', + 'proxy'=>"tcp://serverproxy0p.fsf.org:8118", 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($this->stats), ],