Редакция 42 | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS
Редакция | Автор | № строки | Строка |
---|---|---|---|
41 | alex-w | 1 | <?php |
2 | |||
3 | class Core { |
||
4 | function getDistribution($message) { |
||
42 | alex-w | 5 | $answer = "unknown"; |
41 | alex-w | 6 | if (preg_match("/debian/i",$message)) { |
42 | alex-w | 7 | $answer = "debian"; |
41 | alex-w | 8 | } |
9 | if (preg_match("/ubuntu/i",$message)) { |
||
42 | alex-w | 10 | $answer = "ubuntu"; |
41 | alex-w | 11 | } |
12 | if (preg_match("/infralinux/i",$message)) { |
||
42 | alex-w | 13 | $answer = "infra"; |
41 | alex-w | 14 | } |
15 | return $answer; |
||
16 | } |
||
17 | |||
18 | function getLinuxOS($message) { |
||
19 | if (preg_match("/linux/i",$message)) { |
||
20 | return true; |
||
21 | } else { |
||
22 | return false; |
||
23 | } |
||
24 | } |
||
42 | alex-w | 25 | function getDistVersion($message,$distro){ |
26 | $answer = "unknown"; |
||
27 | if ($distro == "debian") { |
||
28 | if (preg_match("/sarge/i",$message)) $answer = "sarge"; |
||
29 | if (preg_match("/etch/i",$message)) $answer = "etch"; |
||
30 | if (preg_match("/lenny/i",$message)) $answer = "lenny"; |
||
31 | } |
||
32 | if ($distro == "ubuntu" || $distro == "infra") { |
||
33 | if (preg_match("/hardy/i",$message)) $answer = "hardy"; |
||
34 | if (preg_match("/intrepid/i",$message)) $answer = "intrepid"; |
||
35 | } |
||
36 | return $answer; |
||
37 | } |
||
41 | alex-w | 38 | } |
39 | |||
40 | ?> |