root/modules/branches/2.2/irc/functions.inc.php

Revision 2865, 0.9 kB (checked in by gregmac, 7 years ago)

Added distro name to version information

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?
2 // Try to determine the distro and kernel of the current machine
3 function irc_getversioninfo() {
4   // Various places that may have the Distro Name..
5   $version = "";
6   $locations = array(
7       'Redhat' => '/etc/redhat-release',
8     'Fedora' => '/etc/fedora-release',
9     'Debian' => '/etc/debian_version',
10     'SuSE' => '/etc/SuSE-release',
11     'Gentoo' => '/etc/gentoo-release'
12   );
13   foreach ($locations as $distro => $loc) {
14     if (is_readable($loc)) {
15         $fh = fopen($loc, "r");
16         if ($version != "") {
17             $version .= " OR ".$distro.' '.fgets($fh, 80);
18         } else {
19             $version = $distro.' '.fgets($fh, 80);
20         }
21     }
22   }
23   if ($version == "") {
24     return "Unknown Version";
25   } else {
26     $lastchar = substr("$version", strlen("$version") - 1, 1);
27                if ($lastchar == "\n")
28                {
29                        $version = substr("$version", 0, -1);
30                }
31       return $version;
32   }
33 }
34 ?>
35
Note: See TracBrowser for help on using the browser.