/** * Queries missing revisions. * * @return void * @throws \LogicException When no plugins are registered. */ public function refresh() { if (!$this->_plugins) { throw new \LogicException('Please register at least one revision log plugin.'); } $project_url = $this->_repositoryConnector->getProjectUrl($this->_repositoryUrl); // Initialize plugins with data from cache. $cache_key = 'log:' . $project_url; $cache = $this->_cacheManager->getCache($cache_key, $this->_getCacheInvalidator()); if (is_array($cache)) { foreach ($this->_plugins as $plugin_name => $plugin) { $plugin->setCollectedData($cache[$plugin_name]); } } $from_revision = $this->_getLastRevision(); $to_revision = $this->_repositoryConnector->getLastRevision($project_url); if ($to_revision > $from_revision) { $this->_queryRevisionData($from_revision, $to_revision); // Collect and cache plugin data. $cache = array(); foreach ($this->_plugins as $plugin_name => $plugin) { $cache[$plugin_name] = $plugin->getCollectedData(); } $this->_cacheManager->setCache($cache_key, $cache, $this->_getCacheInvalidator()); } }
/** * Queries missing revisions. * * @param boolean $is_migration Is migration. * * @return void * @throws \LogicException When no plugins are registered. */ public function refresh($is_migration) { if (!$this->_plugins) { throw new \LogicException('Please register at least one revision log plugin.'); } $this->_databaseReady(); if ($is_migration) { // Import missing data for imported commits only. $from_revision = 0; $to_revision = $this->_getAggregateRevision('max'); } else { // Import all data for new commits only. $from_revision = $this->_getAggregateRevision('min'); $to_revision = $this->_repositoryConnector->getLastRevision($this->_repositoryRootUrl); } if ($to_revision > $from_revision) { $this->_queryRevisionData($from_revision, $to_revision); } }