public function _discoverRemote() { $config = CRM_Core_Config::singleton(); $tsPath = $config->extensionsDir . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'timestamp.txt'; $timestamp = FALSE; if (file_exists($tsPath)) { $timestamp = file_get_contents($tsPath); } // 3 minutes ago for now $outdated = (int) $timestamp < time() - 180 ? TRUE : FALSE; if (!$timestamp || $outdated) { $remotes = $this->grabRemoteKeyList(); $cached = FALSE; } else { $remotes = $this->grabCachedKeyList(); $cached = TRUE; } foreach ($remotes as $id => $rext) { $ext = new CRM_Core_Extensions_Extension($rext['key']); $ext->setRemote(); $xml = $this->grabRemoteInfoFile($rext['key'], $cached); if ($xml != FALSE) { $ext->readXMLInfo($xml); $this->_remotesDiscovered[] = $ext; } } if (file_exists(dirname($tsPath))) { file_put_contents($tsPath, (string) time()); } return $this->_remotesDiscovered; }