@@ -18,14 +18,14 @@ function __construct($resource_dir = false)
18
18
{
19
19
$ this ->path_executable = __DIR__ . '/../JasperStarter/bin ' ; //Path to executable
20
20
if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
21
- $ this ->windows = true ;
21
+ $ this ->windows = true ;
22
22
}
23
23
24
24
if (!$ resource_dir ) {
25
25
$ this ->resource_directory = __DIR__ . '/../../../vendor/geekcom/jasperphp/src/JasperStarter/bin ' ;
26
26
} else {
27
27
if (!file_exists ($ resource_dir )) {
28
- throw new \Exception ('Invalid resource directory. ' , 1 );
28
+ throw new \Exception ('Invalid resource directory. ' , 1 );
29
29
}
30
30
31
31
$ this ->resource_directory = $ resource_dir ;
@@ -44,7 +44,7 @@ public static function __callStatic($method, $parameters)
44
44
public function compile ($ input_file , $ output_file = false , $ background = true , $ redirect_output = true )
45
45
{
46
46
if (is_null ($ input_file ) || empty ($ input_file )) {
47
- throw new \Exception ('No input file ' , 1 );
47
+ throw new \Exception ('No input file ' , 1 );
48
48
}
49
49
50
50
$ command = ($ this ->windows ) ? $ this ->executable : './ ' . $ this ->executable ;
@@ -54,7 +54,7 @@ public function compile($input_file, $output_file = false, $background = true, $
54
54
$ command .= "\"$ input_file \"" ;
55
55
56
56
if ($ output_file !== false ) {
57
- $ command .= ' -o ' . "\"$ output_file \"" ;
57
+ $ command .= ' -o ' . "\"$ output_file \"" ;
58
58
}
59
59
60
60
$ this ->redirect_output = $ redirect_output ;
@@ -67,18 +67,18 @@ public function compile($input_file, $output_file = false, $background = true, $
67
67
public function process ($ input_file , $ output_file = false , $ format = array ('pdf ' ), $ parameters = array (), $ db_connection = array (), $ locale = false , $ background = true , $ redirect_output = true )
68
68
{
69
69
if (is_null ($ input_file ) || empty ($ input_file )) {
70
- throw new \Exception ('No input file ' , 1 );
70
+ throw new \Exception ('No input file ' , 1 );
71
71
}
72
72
73
73
if (is_array ($ format )) {
74
74
foreach ($ format as $ key ) {
75
75
if (!in_array ($ key , $ this ->formats )) {
76
- throw new \Exception ('Invalid format! ' , 1 );
76
+ throw new \Exception ('Invalid format! ' , 1 );
77
77
}
78
78
}
79
79
} else {
80
80
if (!in_array ($ format , $ this ->formats )) {
81
- throw new \Exception ('Invalid format! ' , 1 );
81
+ throw new \Exception ('Invalid format! ' , 1 );
82
82
}
83
83
}
84
84
@@ -91,13 +91,13 @@ public function process($input_file, $output_file = false, $format = array('pdf'
91
91
$ command .= "\"$ input_file \"" ;
92
92
93
93
if ($ output_file !== false ) {
94
- $ command .= ' -o ' . "\"$ output_file \"" ;
94
+ $ command .= ' -o ' . "\"$ output_file \"" ;
95
95
}
96
96
97
97
if (is_array ($ format )) {
98
- $ command .= ' -f ' . join (' ' , $ format );
98
+ $ command .= ' -f ' . join (' ' , $ format );
99
99
} else {
100
- $ command .= ' -f ' . $ format ;
100
+ $ command .= ' -f ' . $ format ;
101
101
}
102
102
103
103
@@ -115,51 +115,51 @@ public function process($input_file, $output_file = false, $format = array('pdf'
115
115
$ command .= ' -t ' . $ db_connection ['driver ' ];
116
116
117
117
if (isset ($ db_connection ['username ' ])) {
118
- $ command .= " -u " . $ db_connection ['username ' ];
118
+ $ command .= " -u " . $ db_connection ['username ' ];
119
119
}
120
120
121
121
if (isset ($ db_connection ['password ' ]) && !empty ($ db_connection ['password ' ])) {
122
- $ command .= ' -p ' . $ db_connection ['password ' ];
122
+ $ command .= ' -p ' . $ db_connection ['password ' ];
123
123
}
124
124
125
125
if (isset ($ db_connection ['host ' ]) && !empty ($ db_connection ['host ' ])) {
126
- $ command .= ' -H ' . $ db_connection ['host ' ];
126
+ $ command .= ' -H ' . $ db_connection ['host ' ];
127
127
}
128
128
129
129
if (isset ($ db_connection ['database ' ]) && !empty ($ db_connection ['database ' ])) {
130
- $ command .= ' -n ' . $ db_connection ['database ' ];
130
+ $ command .= ' -n ' . $ db_connection ['database ' ];
131
131
}
132
132
133
133
if (isset ($ db_connection ['port ' ]) && !empty ($ db_connection ['port ' ])) {
134
- $ command .= ' --db-port ' . $ db_connection ['port ' ];
134
+ $ command .= ' --db-port ' . $ db_connection ['port ' ];
135
135
}
136
136
137
137
if (isset ($ db_connection ['jdbc_driver ' ]) && !empty ($ db_connection ['jdbc_driver ' ])) {
138
- $ command .= ' --db-driver ' . $ db_connection ['jdbc_driver ' ];
138
+ $ command .= ' --db-driver ' . $ db_connection ['jdbc_driver ' ];
139
139
}
140
140
141
141
if (isset ($ db_connection ['jdbc_url ' ]) && !empty ($ db_connection ['jdbc_url ' ])) {
142
- $ command .= ' --db-url ' . $ db_connection ['jdbc_url ' ];
142
+ $ command .= ' --db-url ' . $ db_connection ['jdbc_url ' ];
143
143
}
144
144
145
145
if (isset ($ db_connection ['jdbc_dir ' ]) && !empty ($ db_connection ['jdbc_dir ' ])) {
146
- $ command .= ' --jdbc-dir ' . $ db_connection ['jdbc_dir ' ];
146
+ $ command .= ' --jdbc-dir ' . $ db_connection ['jdbc_dir ' ];
147
147
}
148
148
149
149
if (isset ($ db_connection ['db_sid ' ]) && !empty ($ db_connection ['db_sid ' ])) {
150
- $ command .= ' --db-sid ' . $ db_connection ['db_sid ' ];
150
+ $ command .= ' --db-sid ' . $ db_connection ['db_sid ' ];
151
151
}
152
152
153
153
if (isset ($ db_connection ['xml_xpath ' ])) {
154
- $ command .= ' --xml-xpath ' . $ db_connection ['xml_xpath ' ];
154
+ $ command .= ' --xml-xpath ' . $ db_connection ['xml_xpath ' ];
155
155
}
156
156
157
157
if (isset ($ db_connection ['data_file ' ])) {
158
- $ command .= ' --data-file ' . $ db_connection ['data_file ' ];
158
+ $ command .= ' --data-file ' . $ db_connection ['data_file ' ];
159
159
}
160
160
161
161
if (isset ($ db_connection ['json_query ' ])) {
162
- $ command .= ' --json-query ' . $ db_connection ['json_query ' ];
162
+ $ command .= ' --json-query ' . $ db_connection ['json_query ' ];
163
163
}
164
164
}
165
165
@@ -173,7 +173,7 @@ public function process($input_file, $output_file = false, $format = array('pdf'
173
173
public function list_parameters ($ input_file )
174
174
{
175
175
if (is_null ($ input_file ) || empty ($ input_file )) {
176
- throw new \Exception ('No input file ' , 1 );
176
+ throw new \Exception ('No input file ' , 1 );
177
177
}
178
178
179
179
$ command = ($ this ->windows ) ? $ this ->executable : './ ' . $ this ->executable ;
@@ -196,7 +196,7 @@ public function execute($run_as_user = false)
196
196
{
197
197
198
198
if ($ run_as_user !== false && strlen ($ run_as_user > 0 ) && !$ this ->windows ) {
199
- $ this ->the_command = 'su -u ' . $ run_as_user . " -c \"" . $ this ->the_command . "\"" ;
199
+ $ this ->the_command = 'su -u ' . $ run_as_user . " -c \"" . $ this ->the_command . "\"" ;
200
200
}
201
201
202
202
$ output = array ();
@@ -210,7 +210,7 @@ public function execute($run_as_user = false)
210
210
}
211
211
212
212
if ($ return_var != 0 ) {
213
- throw new \Exception ('Your report has an error and couldn \'t be processed!\ Try to output the command using the function `output();` and run it manually in the console. ' , 1 );
213
+ throw new \Exception ('Your report has an error and couldn \'t be processed!\ Try to output the command using the function `output();` and run it manually in the console. ' , 1 );
214
214
}
215
215
216
216
return $ output ;
0 commit comments