forked from magento-sparta/m2_patchchk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·40 lines (32 loc) · 1.3 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
require_once 'app/bootstrap.php';
$action = (isset($_GET['action'])) ? $_GET['action'] : false;
try {
if ($action == 'upload' && !empty($_POST)) {
require_once 'app/code/File/Uploader.php';
$fileUploader = new File_Uploader(['upload_path' => BP . UPLOAD_PATH]);
$result = $fileUploader->upload();
require_once 'app/code/Patch/Checker.php';
$patchChecker = new Patch_Checker(BP . UPLOAD_PATH . $result['new_file_name'][0]);
$checkResults = $patchChecker->checkPatchForAllReleases();
$result = $result['result'];
$result['check_results'] = $checkResults;
// checked patches statistic collection
if (isset($result['filename'])) {
$statsPath = BP . STATS_PATH;
if (file_exists($statsPath) || mkdir($statsPath, 02777, true)) {
foreach ($result['filename'] as $fileId => $filename) {
$data = date('Y-m-d H:i:s') . ': ' . $filename . "\n";
file_put_contents($statsPath . 'stats.log', $data, FILE_APPEND);
}
}
}
echo json_encode($result);
die;
}
} catch (Exception $e) {
// @TODO Implement logging
}
require_once 'app/code/Design.php';
$design = new Design();
require_once 'design/templates/index.phtml';