diff --git a/cli/retrieveissues.php b/cli/retrieveissues.php index 801737a76..790d1e17f 100644 --- a/cli/retrieveissues.php +++ b/cli/retrieveissues.php @@ -73,7 +73,37 @@ protected function getData() try { - $issues = $github->issues->getListByRepository('joomla', 'joomla-cms'); + $issues = array(); + foreach(array('open','closed') as $state) + { + $this->out("Retrieving $state items from GitHub.", true); + $page = 0; + do + { + $page++; + $issues_more = $github->issues->getListByRepository( + 'joomla', // Owner + 'joomla-cms', // Repository + null, // Milestone + $state, // State [ open | closed ] + null, // Assignee + null, // Creator + null, // Labels + 'created', // Sort + 'asc', // Direction + null, // Since + $page, // Page + 100 // Count + ); + $count = is_array($issues_more) ? count($issues_more) : 0; + $this->out('Retrieved batch of ' . $count . ' items from GitHub.', true); + if ($count) { + $issues = array_merge($issues, $issues_more); + } + } while ($count); + } + + usort($issues, function($a,$b) { return $a->number - $b->number; } ); } // Catch any DomainExceptions and close the script catch (DomainException $e) @@ -135,6 +165,8 @@ protected function processIssues($issues) $table->gh_id = $issue->number; $table->title = $issue->title; $table->description = $issue->body; + $table->status = ($issue->state == 'open') ? 1 : 10; + if (!$table->store()) { $this->out($table->getError(), true);