diff --git a/src/GitLab.php b/src/GitLab.php index 2fef53d4b61ec62cf7d18a8f04b40c6f090814fd..3b78dec68bc27bbb23307ebf07ec138f7bba3667 100644 --- a/src/GitLab.php +++ b/src/GitLab.php @@ -48,7 +48,7 @@ class GitLab $page = 1; // Stop when we either have all users or we have exhausted the sane number of attempts while (!$gotAll && $page < USER_FETCH_MAX_PAGES) { - $response = $this->client->api('users')->all(null, $page++, USER_FETCH_PAGE_SIZE); + $response = $this->client->api('users')->all([], $page++, USER_FETCH_PAGE_SIZE); foreach($response as $user) { $users[$user['username']] = $user; // We assume that 'Administrator' user is in there diff --git a/src/Migration.php b/src/Migration.php index e353a9b80c36ed4782480e78ce161fb65c705011..86f1e16225e5d16bd53cdac1bbdb1bac7f0aa376 100644 --- a/src/Migration.php +++ b/src/Migration.php @@ -123,7 +123,7 @@ class Migration $commentAuthor = $this->getGitLabUser($comment['author']); $commentAuthorId = is_array($commentAuthor) ? $commentAuthor['id'] : null; $commentText = $this->translateTracToMarkdown($comment['text']); - $note = $this->gitLab->createNote($gitLabProject, $issue['id'], $commentText, $commentAuthorId); + $note = $this->gitLab->createNote($gitLabProject, $issue['iid'], $commentText, $commentAuthorId); } echo "\tAlso created " . count($ticket[4]) . " note(s)\n"; }*/ @@ -133,12 +133,12 @@ class Migration */ foreach ($attachments as $a) { - $file = file_put_contents($a['filename'], $a['content']['__jsonclass__'][1]); + file_put_contents($a['filename'], base64_decode($a['content'])); - $this->gitLab->createIssueAttachment($gitLabProject, $issue['id'], $a['filename'], $a['author']); + $this->gitLab->createIssueAttachment($gitLabProject, $issue['iid'], $a['filename'], $a['author']); unlink($a['filename']); - echo "\tAttached file " . $a['filename'] . " to issue " . $issue['id'] . ".\n"; + echo "\tAttached file " . $a['filename'] . " to issue " . $issue['iid'] . ".\n"; } } diff --git a/src/Trac.php b/src/Trac.php index f263dee47c78464e6fe4245ac5bdbce3e2bbac57..22542cf87b4ed4e20ca9bc3e621879a01e184315 100644 --- a/src/Trac.php +++ b/src/Trac.php @@ -68,9 +68,11 @@ class Trac $attachments = $this->client->execute('ticket.listAttachments', [$id]); foreach ($attachments as $attachment) { + $data = $this->client->execute('ticket.getAttachment', [$id, $attachment[0]]); + $result[] = [ 'filename' => $attachment[0], - 'content' => $this->client->execute('ticket.getAttachment', [$id, $attachment[0]]), + 'content' => $data['__jsonclass__'][1], 'author' => $attachment[4] ];