@@ -17,13 +17,15 @@ class AttachmentService extends \JiraRestApi\JiraClient
17
17
* @param $id string|int attachment Id
18
18
* @outDir string downloads the content and store into outDir
19
19
* @overwrite boolean determines whether to overwrite the file if it already exists.
20
+ * @mode int outDir creation mode.
21
+ * @recursive boolean Allows the creation of nested directories specified in the pathname.
20
22
*
21
23
* @throws \JiraRestApi\JiraException
22
24
* @throws \JsonMapper_Exception
23
25
*
24
26
* @return \JiraRestApi\Issue\Attachment
25
27
*/
26
- public function get ($ id , $ outDir = null , $ overwrite = false )
28
+ public function get ($ id , $ outDir = null , $ overwrite = false , $ mode = 0777 , $ recursive = true )
27
29
{
28
30
$ ret = $ this ->exec ($ this ->uri .$ id , null );
29
31
@@ -39,7 +41,7 @@ public function get($id, $outDir = null, $overwrite = false)
39
41
40
42
// download contents
41
43
if (!file_exists ($ outDir )) {
42
- mkdir ($ outDir );
44
+ mkdir ($ outDir, $ mode , $ recursive );
43
45
}
44
46
45
47
// extract filename
@@ -50,6 +52,8 @@ public function get($id, $outDir = null, $overwrite = false)
50
52
}
51
53
52
54
$ this ->download ($ attachment ->content , $ outDir , $ file );
55
+
56
+ return $ attachment ;
53
57
}
54
58
55
59
/**
0 commit comments