This repository was archived by the owner on Jun 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverseer.php
More file actions
executable file
·52 lines (41 loc) · 1.76 KB
/
overseer.php
File metadata and controls
executable file
·52 lines (41 loc) · 1.76 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
#!/usr/local/bin/php
<?php
namespace Edge\Overseer;
require_once __DIR__ . '/vendor/autoload.php';
define('CONFIG_FILE', __DIR__ . '/config/config.ini');
define('CONFIG_INDEX_EMAIL', 'email');
define('CONFIG_INDEX_IGNORE', 'ignore');
define('CONFIG_INDEX_NAME', 'name');
define('CONFIG_INDEX_WATCHFILE', 'watchfile');
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
if (!file_exists(CONFIG_FILE)) {
die('Config file "' . CONFIG_FILE . '" is missing. Create it!' . "\n");
}
$config = parse_ini_file(CONFIG_FILE);
if (!array_key_exists(CONFIG_INDEX_NAME, $config)) {
die('You must specify some "' . CONFIG_INDEX_NAME .'" in config!' . "\n");
}
if (!array_key_exists(CONFIG_INDEX_EMAIL, $config)) {
die('You must specify some "' . CONFIG_INDEX_EMAIL .'" in config!' . "\n");
}
if (!array_key_exists(CONFIG_INDEX_WATCHFILE, $config)) {
die('You must specify some "' . CONFIG_INDEX_WATCHFILE . '" in config!' . "\n");
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
$checkers = array();
foreach ($config[CONFIG_INDEX_WATCHFILE] as $fileToWatch) {
echo "Checking file '$fileToWatch'\n";
$ignoreList = array_key_exists(CONFIG_INDEX_IGNORE, $config) ? $config[CONFIG_INDEX_IGNORE] : array();
$checker = new FileChecker(
$config[CONFIG_INDEX_NAME],
$fileToWatch,
$config[CONFIG_INDEX_EMAIL],
$ignoreList
);
$checker->check();
}
echo "\nOK\n";