forked from BeWelcome/rox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
diagnostics.php
98 lines (91 loc) · 1.91 KB
/
diagnostics.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
$files = array('rox_local.ini',
'localhost.ini',
'rox_default.ini',
'inc/config.inc.php',
'base.xml',
'htdocs/.htaccess',
);
$dirs = array('htdocs',
'build',
'archive',
'data',
'extensions',
'inc',
'lib',
'pthacks',
'templates',
'modules',
'roxlauncher',
'setup',
'test',
'testdb',
'tools',
'update_script',
);
// check files - stick errors in $file_errors
$file_errors = array();
foreach ($files as $file)
{
if (!file_exists($file) || !is_file($file))
{
$file_errors[] = "{$file}";
continue;
}
$dummy = file_get_contents($file);
if (!$dummy)
{
$file_errors[] = "{$file}";
}
}
// check dirs - stick errors in $dir_errors
$dir_errors = array();
foreach ($dirs as $dir)
{
if (!file_exists($dir) || !is_dir($dir))
{
$dir_errors[] = "{$dir}";
continue;
}
}
// output result
echo <<<XHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="dk" lang="dk">
<head>
<title>bwrox diagnostics</title>
</head>
<body>
XHTML;
if (empty($file_errors))
{
echo "<p>All core files found.</p>";
}
else
{
echo "<p>Core files missing:\n";
echo "<ul>\n";
foreach ($file_errors as $error)
{
echo "<li>{$error}</li>\n";
}
echo "</ul>\n";
}
if (empty($dir_errors))
{
echo "<p>All core diagnostics found.</p>";
}
else
{
echo "<p>Core directories missing:\n";
echo "<ul>\n";
foreach ($dir_errors as $error)
{
echo "<li>{$error}</li>\n";
}
echo "</ul>\n";
}
echo <<<XHTML
</body>
</html>
XHTML;