Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 120
0.00% covered (danger)
0.00%
0 / 37
CRAP
0.00% covered (danger)
0.00%
0 / 1
ManagementController
0.00% covered (danger)
0.00%
0 / 120
0.00% covered (danger)
0.00%
0 / 37
2256
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 index
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setup_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 setup_post
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 environment
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 configuration
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 configuration_edit_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 configuration_edit_post
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 backup
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 delete_old_data
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 database_maintenance_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 database_maintenance_post
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 database_download_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 mail_send_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 mail_send_post
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 php_evaluate_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 php_evaluate_post
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 default_plugin_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 default_plugin_post
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 cache_rebuild
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 vacuum_access_log
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 clear_deploy_progress
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 feedback_list_top
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 feedback_list_page
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 feedback_detail_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 feedback_detail_post
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
12
 crash_report_list_top
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 crash_report_list_page
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 crash_report_detail_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 crash_report_detail_post
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
12
 version_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 version_post
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 plugin_category_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 log_list
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 log_detail_get
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 log_detail_post
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 markdown
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\App\Controllers\Page;
6
7use PeServer\App\Controllers\Page\PageControllerBase;
8use PeServer\App\Models\Domain\Page\Management\ManagementBackupLogic;
9use PeServer\App\Models\Domain\Page\Management\ManagementCacheRebuildLogic;
10use PeServer\App\Models\Domain\Page\Management\ManagementClearDeployProgressLogic;
11use PeServer\App\Models\Domain\Page\Management\ManagementConfigurationEditLogic;
12use PeServer\App\Models\Domain\Page\Management\ManagementConfigurationLogic;
13use PeServer\App\Models\Domain\Page\Management\ManagementCrashReportDetailLogic;
14use PeServer\App\Models\Domain\Page\Management\ManagementCrashReportListLogic;
15use PeServer\App\Models\Domain\Page\Management\ManagementDatabaseDownloadLogic;
16use PeServer\App\Models\Domain\Page\Management\ManagementDatabaseMaintenanceLogic;
17use PeServer\App\Models\Domain\Page\Management\ManagementDefaultPluginLogic;
18use PeServer\App\Models\Domain\Page\Management\ManagementDeleteOldDataLogic;
19use PeServer\App\Models\Domain\Page\Management\ManagementEnvironmentLogic;
20use PeServer\App\Models\Domain\Page\Management\ManagementFeedbackDetailLogic;
21use PeServer\App\Models\Domain\Page\Management\ManagementFeedbackListLogic;
22use PeServer\App\Models\Domain\Page\Management\ManagementLogDetailLogic;
23use PeServer\App\Models\Domain\Page\Management\ManagementLogListLogic;
24use PeServer\App\Models\Domain\Page\Management\ManagementMailSendLogic;
25use PeServer\App\Models\Domain\Page\Management\ManagementMarkdownLogic;
26use PeServer\App\Models\Domain\Page\Management\ManagementPhpEvaluateLogic;
27use PeServer\App\Models\Domain\Page\Management\ManagementPluginCategoryListLogic;
28use PeServer\App\Models\Domain\Page\Management\ManagementSetupLogic;
29use PeServer\App\Models\Domain\Page\Management\ManagementVacuumAccessLogLogic;
30use PeServer\App\Models\Domain\Page\Management\ManagementVersionLogic;
31use PeServer\Core\Http\HttpRequest;
32use PeServer\Core\Http\HttpStatus;
33use PeServer\Core\Mvc\ControllerArgument;
34use PeServer\Core\Mvc\LogicCallMode;
35use PeServer\Core\Mvc\Result\IActionResult;
36use PeServer\Core\Mvc\Template\TemplateParameter;
37use PeServer\Core\Throws\InvalidOperationException;
38
39/**
40 * [PAGE] 管理者用コントローラ。
41 */
42final class ManagementController extends PageControllerBase
43{
44    public function __construct(ControllerArgument $argument)
45    {
46        parent::__construct($argument);
47    }
48
49    public function index(): IActionResult
50    {
51        return $this->view('index', new TemplateParameter(HttpStatus::OK, [], []));
52    }
53
54    public function setup_get(): IActionResult
55    {
56        $logic = $this->createLogic(ManagementSetupLogic::class);
57        $logic->run(LogicCallMode::Initialize);
58
59        return $this->view('setup', $logic->getViewData());
60    }
61
62    public function setup_post(): IActionResult
63    {
64        $logic = $this->createLogic(ManagementSetupLogic::class);
65        if ($logic->run(LogicCallMode::Submit)) {
66            return $this->redirectPath('/');
67        }
68
69        return $this->view('setup', $logic->getViewData());
70    }
71
72    public function environment(): IActionResult
73    {
74        $logic = $this->createLogic(ManagementEnvironmentLogic::class);
75        $logic->run(LogicCallMode::Initialize);
76
77        return $this->view('environment', $logic->getViewData());
78    }
79
80    public function configuration(): IActionResult
81    {
82        $logic = $this->createLogic(ManagementConfigurationLogic::class);
83        $logic->run(LogicCallMode::Initialize);
84
85        return $this->view('configuration', $logic->getViewData());
86    }
87
88    public function configuration_edit_get(): IActionResult
89    {
90        $logic = $this->createLogic(ManagementConfigurationEditLogic::class);
91        $logic->run(LogicCallMode::Initialize);
92
93        return $this->view('configuration_edit', $logic->getViewData());
94    }
95
96    public function configuration_edit_post(): IActionResult
97    {
98        $logic = $this->createLogic(ManagementConfigurationEditLogic::class);
99        if ($logic->run(LogicCallMode::Submit)) {
100            return $this->redirectPath('management/configuration/edit');
101        }
102
103        return $this->view('configuration_edit', $logic->getViewData());
104    }
105
106    public function backup(): IActionResult
107    {
108        $logic = $this->createLogic(ManagementBackupLogic::class);
109        $logic->run(LogicCallMode::Submit);
110
111        return $this->redirectPath('/management');
112    }
113
114    public function delete_old_data(): IActionResult
115    {
116        $logic = $this->createLogic(ManagementDeleteOldDataLogic::class);
117        $logic->run(LogicCallMode::Submit);
118
119        return $this->redirectPath('/management');
120    }
121
122    public function database_maintenance_get(): IActionResult
123    {
124        $logic = $this->createLogic(ManagementDatabaseMaintenanceLogic::class);
125        $logic->run(LogicCallMode::Initialize);
126
127        return $this->view('database_maintenance', $logic->getViewData());
128    }
129    public function database_maintenance_post(): IActionResult
130    {
131        $logic = $this->createLogic(ManagementDatabaseMaintenanceLogic::class);
132        $logic->run(LogicCallMode::Submit);
133        return $this->view('database_maintenance', $logic->getViewData());
134    }
135    public function database_download_get(): IActionResult
136    {
137        $logic = $this->createLogic(ManagementDatabaseDownloadLogic::class);
138        $logic->run(LogicCallMode::Submit);
139        return $this->data($logic->getContent());
140    }
141
142    public function mail_send_get(): IActionResult
143    {
144        $logic = $this->createLogic(ManagementMailSendLogic::class);
145        $logic->run(LogicCallMode::Initialize);
146        return $this->view('mail_send', $logic->getViewData());
147    }
148    public function mail_send_post(): IActionResult
149    {
150        $logic = $this->createLogic(ManagementMailSendLogic::class);
151        if ($logic->run(LogicCallMode::Submit)) {
152            return $this->redirectPath('management/mail-send');
153        }
154
155        return $this->view('mail_send', $logic->getViewData());
156    }
157
158    public function php_evaluate_get(): IActionResult
159    {
160        $logic = $this->createLogic(ManagementPhpEvaluateLogic::class);
161        $logic->run(LogicCallMode::Initialize);
162
163        return $this->view('php_evaluate', $logic->getViewData());
164    }
165    public function php_evaluate_post(): IActionResult
166    {
167        $logic = $this->createLogic(ManagementPhpEvaluateLogic::class);
168        $logic->run(LogicCallMode::Submit);
169        return $this->view('php_evaluate', $logic->getViewData());
170    }
171
172    public function default_plugin_get(): IActionResult
173    {
174        $logic = $this->createLogic(ManagementDefaultPluginLogic::class);
175        $logic->run(LogicCallMode::Initialize);
176
177        return $this->view('default_plugin', $logic->getViewData());
178    }
179
180    public function default_plugin_post(): IActionResult
181    {
182        $logic = $this->createLogic(ManagementDefaultPluginLogic::class);
183        if ($logic->run(LogicCallMode::Submit)) {
184            return $this->redirectPath('management/default-plugin');
185        }
186
187        return $this->view('default_plugin', $logic->getViewData());
188    }
189
190    public function cache_rebuild(): IActionResult
191    {
192        $logic = $this->createLogic(ManagementCacheRebuildLogic::class);
193        $logic->run(LogicCallMode::Submit);
194
195        return $this->redirectPath('/management');
196    }
197
198    public function vacuum_access_log(): IActionResult
199    {
200        $logic = $this->createLogic(ManagementVacuumAccessLogLogic::class);
201        $logic->run(LogicCallMode::Submit);
202
203        return $this->redirectPath('/management');
204    }
205
206    public function clear_deploy_progress(): IActionResult
207    {
208        $logic = $this->createLogic(ManagementClearDeployProgressLogic::class);
209        $logic->run(LogicCallMode::Submit);
210
211        return $this->redirectPath('/management');
212    }
213
214    public function feedback_list_top(): IActionResult
215    {
216        $logic = $this->createLogic(ManagementFeedbackListLogic::class);
217        $logic->run(LogicCallMode::Initialize);
218
219        return $this->view('feedback_list', $logic->getViewData());
220    }
221
222    public function feedback_list_page(): IActionResult
223    {
224        $logic = $this->createLogic(ManagementFeedbackListLogic::class);
225        $logic->run(LogicCallMode::Submit);
226
227        return $this->view('feedback_list', $logic->getViewData());
228    }
229
230    public function feedback_detail_get(): IActionResult
231    {
232        $logic = $this->createLogic(ManagementFeedbackDetailLogic::class);
233        $logic->run(LogicCallMode::Initialize);
234
235        return $this->view('feedback_detail', $logic->getViewData());
236    }
237
238    public function feedback_detail_post(): IActionResult
239    {
240        $logic = $this->createLogic(ManagementFeedbackDetailLogic::class);
241        if ($logic->run(LogicCallMode::Submit)) {
242            if ($logic->tryGetResult('sequence', $sequence)) {
243                return $this->redirectPath("management/feedback/$sequence");
244            }
245            throw new InvalidOperationException();
246        }
247
248        return $this->view('feedback_detail', $logic->getViewData());
249    }
250
251    public function crash_report_list_top(): IActionResult
252    {
253        $logic = $this->createLogic(ManagementCrashReportListLogic::class);
254        $logic->run(LogicCallMode::Initialize);
255
256        return $this->view('crash_report_list', $logic->getViewData());
257    }
258
259    public function crash_report_list_page(): IActionResult
260    {
261        $logic = $this->createLogic(ManagementCrashReportListLogic::class);
262        $logic->run(LogicCallMode::Submit);
263
264        return $this->view('crash_report_list', $logic->getViewData());
265    }
266
267    public function crash_report_detail_get(): IActionResult
268    {
269        $logic = $this->createLogic(ManagementCrashReportDetailLogic::class);
270        $logic->run(LogicCallMode::Initialize);
271
272        return $this->view('crash_report_detail', $logic->getViewData());
273    }
274
275    public function crash_report_detail_post(): IActionResult
276    {
277        $logic = $this->createLogic(ManagementCrashReportDetailLogic::class);
278        if ($logic->run(LogicCallMode::Submit)) {
279            if ($logic->tryGetResult('sequence', $sequence)) {
280                return $this->redirectPath("management/crash-report/$sequence");
281            }
282            throw new InvalidOperationException();
283        }
284
285        return $this->view('crash_report_detail', $logic->getViewData());
286    }
287
288    public function version_get(): IActionResult
289    {
290        $logic = $this->createLogic(ManagementVersionLogic::class);
291        $logic->run(LogicCallMode::Initialize);
292
293        return $this->view('version', $logic->getViewData());
294    }
295
296    public function version_post(): IActionResult
297    {
298        $logic = $this->createLogic(ManagementVersionLogic::class);
299        if ($logic->run(LogicCallMode::Submit)) {
300            return $this->redirectPath('management/version');
301        }
302
303        return $this->view('version', $logic->getViewData());
304    }
305
306    public function plugin_category_get(): IActionResult
307    {
308        $logic = $this->createLogic(ManagementPluginCategoryListLogic::class);
309        $logic->run(LogicCallMode::Initialize);
310
311        return $this->view('plugin_category', $logic->getViewData());
312    }
313
314    public function log_list(): IActionResult
315    {
316        $logic = $this->createLogic(ManagementLogListLogic::class);
317        $logic->run(LogicCallMode::Initialize);
318
319        return $this->view('log_list', $logic->getViewData());
320    }
321
322    public function log_detail_get(): IActionResult
323    {
324        $logic = $this->createLogic(ManagementLogDetailLogic::class);
325        $logic->run(LogicCallMode::Initialize);
326
327        if ($logic->equalsResult('download', true)) {
328            return $this->data($logic->getContent());
329        }
330
331        return $this->view('log_detail', $logic->getViewData());
332    }
333
334    public function log_detail_post(): IActionResult
335    {
336        $logic = $this->createLogic(ManagementLogDetailLogic::class);
337        $logic->run(LogicCallMode::Submit);
338
339        return $this->data($logic->getContent());
340    }
341
342    public function markdown(): IActionResult
343    {
344        $logic = $this->createLogic(ManagementMarkdownLogic::class);
345        $logic->run(LogicCallMode::Initialize);
346
347        return $this->view('markdown', $logic->getViewData());
348    }
349}