-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathpatchs.php
More file actions
52 lines (34 loc) · 1.18 KB
/
patchs.php
File metadata and controls
52 lines (34 loc) · 1.18 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
<?php
define('xml_patch_file', 'patchs.xml');
if (file_exists(mnmpatchs.xml_patch_file)) {
$patches = simplexml_load_file(mnmpatchs.xml_patch_file);
} else {
$xmlstr = "<?xml version='1.0' standalone='yes'?><patchs></patchs>";
$patches = new SimpleXMLElement($xmlstr);
}
function add_to_xml_patchs($patch_file)
{
global $patches;
$patch = $patches->addChild('patch');
$patch->addAttribute('file', $patch_file);
$patch->addAttribute('date', date('Y-m-d H:i:s'));
file_put_contents(mnmpatchs.xml_patch_file, $patches->asXML());
}
$t_files = glob(mnmpatchs.'ticket_*.php');
foreach ($t_files as $file) {
$found = false;
foreach ($patches->patch as $patch) {
if ($patch['file']==basename($file)) {
$found = true;
break;
}
}
// Vérifie si un fichier log existe, pour savoir si le patch a déjà été passé
if (!$found) {
// Applique le patch
require $file;
// Génère le fichier log
add_to_xml_patchs(basename($file));
}
}
?>