Skip to content

Instantly share code, notes, and snippets.

@co3k
Created July 8, 2011 11:14
Show Gist options
  • Save co3k/1071616 to your computer and use it in GitHub Desktop.
Save co3k/1071616 to your computer and use it in GitHub Desktop.
<?php
// this script is public domain
$list_34 = array(
36, 40, 39, 43, 62, 73, 89,
86, 97, 106, 124, 125, 126,
127, 164, 169, 182, 196,
183, 119,
);
$list_36 = array(
35, 55, 69, 85, 99, 112, 122,
123, 165, 190, 195, 157,
);
function getIssues($id)
{
$redmine_version_url = 'http://redmine.openpne.jp/versions/show/'.$id;
$document = new DOMDocument();
$document->loadHTMLFile($redmine_version_url);
$ticket_list = $document->getElementsByTagName('fieldset')->item(1)->getElementsByTagName('li');
$issues = array();
foreach ($ticket_list as $t)
{
if (false !== strpos($t->nodeValue, 'Bug') || false !== strpos($t->nodeValue, 'Backport'))
{
preg_match('/^.+?#(?P<ticket_id>[0-9]+):(?P<ticket_subject>.*)$/', $t->nodeValue, $matches);
$ticket_info = simplexml_load_file('http://redmine.openpne.jp/issues/'.$matches['ticket_id'].'.xml');
$priority = $ticket_info->priority->attributes();
$status = $ticket_info->status->attributes();
$issues[$matches['ticket_id']] = $matches['ticket_subject'];
}
}
return $issues;
}
$issues_34 = array();
$issues_36 = array();
foreach ($list_34 as $id) {
var_dump($id);
$issues_34 += getIssues($id);
}
foreach ($list_36 as $id) {
var_dump($id);
$issues_36 += getIssues($id);
}
var_dump(array_diff($issues_34, $issues_36));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment