forked from gizmore/phpgdo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprovider_update.php
More file actions
51 lines (46 loc) · 1.07 KB
/
provider_update.php
File metadata and controls
51 lines (46 loc) · 1.07 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
<?php
chdir(__DIR__);
require 'protected/config.php';
require 'GDO7.php';
/**
* Update the official provider cache.
*/
# OLD
$filename = GDO_PATH . 'GDO/Core/ModuleProviders.php';
$file = file_get_contents($filename);
#################
### Providers ###
#################
$output = [];
$return_var = 0;
$out = exec("php providers.php --for_gizmore", $output, $return_var);
if ($return_var != 0)
{
echo $out;
die($return_var);
}
$deps = implode("\n", $output);
$bd = '### BEGIN_PROVIDERS ###';
$ed = '### END_PROVIDERS ###';
$file = preg_replace("/{$bd}.*{$ed}/s", "${bd}\n{$deps}\n{$ed}", $file);
############
### Deps ###
############
$output = [];
$return_var = 0;
$out = exec("php provider_dependencies.php --for_gizmore", $output, $return_var);
if ($return_var != 0)
{
echo $out;
die($return_var);
}
$deps = implode("\n", $output);
$bd = '### BEGIN_DEPENDENCIES ###';
$ed = '### END_DEPENDENCIES ###';
$file = preg_replace("/{$bd}.*{$ed}/s", "${bd}\n{$deps}\n{$ed}", $file);
##############
### Output ###
##############
echo $file;
file_put_contents($filename, $file);
die(0);