Example #1
0
 /**
  *
  */
 private function collectRefs()
 {
     $name = $this->getName() ? $this->getName() : 'repository';
     $this->msg("Downloading {$name} data through API");
     $tagsAndReleases = [];
     $tags = $this->githubApiClient->getTags($this->getName());
     foreach ($tags as $tag) {
         if ($this->isNormalisible($tag->name)) {
             $this->tags[$tag->name] = $tag;
             $tagsAndReleases[] = $tag->name;
         }
     }
     $releases = $this->githubApiClient->getReleases($this->getName());
     foreach ($releases as $release) {
         if ($this->isNormalisible($release->name)) {
             $this->releases[$release->name] = $release;
             $tagsAndReleases[] = $release->name;
         }
     }
     $branches = $this->githubApiClient->getBranches($this->getName());
     foreach ($branches as $branch) {
         $this->branches[$branch->name] = $branch;
     }
     $this->tagsReleasesBranches = $this->semver->rsort($tagsAndReleases);
     $this->tagsReleasesBranches += array_keys($this->branches);
 }
Example #2
0
 /**
  * Selects the upgrade functions applicable for this upgrade.
  *
  * The upgrade functions are specified by the `upgradeList`
  * hook.  This variable is an associative array containing version numbers
  * as keys and an array of upgrade function names as values.  This function
  * merges all the upgrade function names of the version between the current
  * installed version and the upgraded version.
  *
  * @param string $version the version of SimpleID to upgrade from, calls
  * {@link getVersion()} if not specified
  * @return array an array of strings, containing the list of upgrade functions
  * to call.  The functions should be called in the same order as they appear
  * in this array
  * @see SimpleID\API\ModuleHooks::upgradeListHook()
  */
 protected function getUpgradeList($version = NULL)
 {
     $mgr = ModuleManager::instance();
     $upgrade_data = array();
     foreach ($mgr->getModules() as $name => $module) {
         $data = $mgr->invoke($name, 'upgradeList');
         if ($data != NULL) {
             $upgrade_data = array_merge_recursive($upgrade_data, $data);
         }
     }
     if ($version == NULL) {
         $version = $this->getVersion();
     }
     $list = array();
     // Sorts versions from newest to oldest
     $versions = array_keys($upgrade_data);
     $versions = Semver::rsort($versions);
     foreach ($versions as $upgrade_version) {
         if (Comparator::lessThan($version, $upgrade_version)) {
             $list = array_merge($list, $upgrade_data[$upgrade_version]);
         }
     }
     if (Comparator::lessThan($version, SIMPLEID_VERSION)) {
         $list[] = 'SimpleID\\Upgrade->setVersion';
     }
     return $list;
 }
Example #3
0
 /**
  * @param array $versions
  */
 public function __construct(array $versions)
 {
     $this->versions = Semver::rsort($versions);
 }