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