-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
30 lines (27 loc) · 842 Bytes
/
functions.php
File metadata and controls
30 lines (27 loc) · 842 Bytes
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
<?php
function countApacheRunningInstances($pattern) {
//LoadModule status_module modules/mod_status.so
//ExtendedStatus On
if (!@exec("apachectl fullstatus", $status)) {
return false;
}
if (is_array($status) AND count($status) > 10) {
$c = 0;
foreach ($status as $line) {
if (preg_match($pattern, $line))
$c++;
}
return $c;
}
}
function checkWikipage($title) {
if ($json = file_get_contents("https://wiki.openstreetmap.org/w/api.php?action=query&titles=" . $title . "&format=json")) {
$json = json_decode($json);
foreach ((array) $json->query->pages as $result => $page) {
if ($result > -1) {
return "http://wiki.openstreetmap.org/wiki/" . $title;
}
}
}
return false;
}