Skip to content
Snippets Groups Projects
Commit 69dfa583 authored by Thomas Hackl's avatar Thomas Hackl
Browse files

close Gitlab issue if Trac ticket was already closed

parent 408072d4
No related branches found
No related tags found
No related merge requests found
......@@ -86,6 +86,17 @@ class GitLab
return $issue;
}
/**
* Closes an issue.
* @param mixed $projectId project ID or path
* @param int $issueId issue to close
* @param string $time time in ISO8601 format
*/
public function closeIssue($projectId, $issueId, $time) {
$this->client->api('issues')->update($projectId, $issueId,
['state_event' => 'close', 'updated_at' => $time]);
}
/**
* Creates a new note in the given project and on the given issue id (NOTE: id, not iid). When working in admin mode, tries to create the note
* as the given author (SUDO) and if that fails, tries creating the note again as the admin.
......
......@@ -128,9 +128,6 @@ class Migration
echo "\tAlso created " . count($ticket[4]) . " note(s)\n";
}*/
// Map old image filenames to new markdown links
$images = [];
/*
* Add files attached to Trac ticket to new Gitlab issue.
*/
......@@ -144,6 +141,11 @@ class Migration
echo "\tAttached file " . $a['filename'] . " to issue " . $issue['iid'] . ".\n";
}
// Close issue if Trac ticket was closed.
if ($ticket[3]['status'] === 'closed') {
$this->gitLab->closeIssue($gitLabProject, $issue['iid'], $dateUpdated);
}
}
return $mapping;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment