-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathupdate.php
More file actions
57 lines (41 loc) · 1.77 KB
/
update.php
File metadata and controls
57 lines (41 loc) · 1.77 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
53
54
55
56
57
<?php
// This runs the main updater. Requires PHP and git on the path and repo commit access. That last part you, of course, don't have.
// (C) 2016 CubicleSoft. All Rights Reserved.
if (!isset($_SERVER["argc"]) || !$_SERVER["argc"])
{
echo "This file is intended to be run from the command-line.";
exit();
}
$rootpath = str_replace("\\", "/", dirname(__FILE__));
require_once $rootpath . "/functions.php";
$srcpath = $rootpath . "/repos";
$destpath = $rootpath . "/support";
if (!is_dir($srcpath)) mkdir($srcpath);
if (!is_dir($destpath)) mkdir($destpath);
// Update the registered repo list. If nothing has changed, exit.
$numchanged = (int)GitRepoChanged($rootpath) + GitPull($srcpath);
if (!$numchanged) exit();
// Always do a full rebuild.
DeleteDirectory($destpath);
// Retrieve a list of all PHP files that contain 'class' + a name.
$files = array();
GetPHPFiles($files, $srcpath);
// Generate final file set.
foreach ($files as $name => $filename)
{
$data = file_get_contents($filename);
$pos = strrpos($filename, "/");
$name = substr($filename, $pos + 1);
file_put_contents($destpath . "/" . $name, $data);
}
// Net_DNS2.
mkdir($destpath . "/Net");
copy($srcpath . "/ultimate-email/support/Net/DNS2.php", $destpath . "/Net/DNS2.php");
copy($srcpath . "/ultimate-email/support/Net/license.txt", $destpath . "/Net/license.txt");
// CA certificates.
copy($srcpath . "/ultimate-web-scraper/support/cacert.pem", $destpath . "/cacert.pem");
copy($srcpath . "/digitalocean/support/digitalocean_ca.pem", $destpath . "/digitalocean_ca.pem");
// Generate README.
GenerateReadme($rootpath . "/readme_src/classes.json", $rootpath . "/readme_src/README.md", $rootpath . "/README.md", "", $files, "support/", $srcpath);
CommitRepo($rootpath);
?>