Commit 6b3b41a877e3b57516c4ccf54bd8ee6cfda4f90b
1 parent
22187144
Broke the user and document info into separate fields
PT: 1591661 Committed by: Megan Watson
Showing
1 changed file
with
40 additions
and
23 deletions
bin/system_info.php
| @@ -43,7 +43,12 @@ | @@ -43,7 +43,12 @@ | ||
| 43 | * The following data is collected: | 43 | * The following data is collected: |
| 44 | * Unique installation information: installation GUID, number of users in repository, number of documents in repository, | 44 | * Unique installation information: installation GUID, number of users in repository, number of documents in repository, |
| 45 | * operating system (platform, platform version, flavor if Linux), version and edition. | 45 | * operating system (platform, platform version, flavor if Linux), version and edition. |
| 46 | + | ||
| 47 | +<installation guid>|<enabled user count>|<disabled user count>|<deleted user count>| | ||
| 48 | +<live document count>|<deleted document count>|<archived document count>| | ||
| 49 | +<KT version>|<KT edition>|<User licenses>|<OS info> | ||
| 46 | */ | 50 | */ |
| 51 | + | ||
| 47 | chdir(realpath(dirname(__FILE__))); | 52 | chdir(realpath(dirname(__FILE__))); |
| 48 | require_once('../config/dmsDefaults.php'); | 53 | require_once('../config/dmsDefaults.php'); |
| 49 | 54 | ||
| @@ -56,7 +61,7 @@ function getGuid() | @@ -56,7 +61,7 @@ function getGuid() | ||
| 56 | $guid = KTUtil::getSystemIdentifier(); | 61 | $guid = KTUtil::getSystemIdentifier(); |
| 57 | 62 | ||
| 58 | if(PEAR::isError($guid)){ | 63 | if(PEAR::isError($guid)){ |
| 59 | - $guid = ''; | 64 | + $guid = '-'; |
| 60 | } | 65 | } |
| 61 | return $guid; | 66 | return $guid; |
| 62 | } | 67 | } |
| @@ -68,42 +73,43 @@ function getUserCnt() | @@ -68,42 +73,43 @@ function getUserCnt() | ||
| 68 | $result = DBUtil::getResultArray($query); | 73 | $result = DBUtil::getResultArray($query); |
| 69 | 74 | ||
| 70 | if(empty($result) || PEAR::isError($result)){ | 75 | if(empty($result) || PEAR::isError($result)){ |
| 71 | - return ''; | 76 | + return '-|-|-'; |
| 72 | } | 77 | } |
| 73 | - $users = ''; | 78 | + $enabled = '-'; |
| 79 | + $disabled = '-'; | ||
| 80 | + $deleted = '-'; | ||
| 74 | 81 | ||
| 75 | foreach ($result as $row){ | 82 | foreach ($result as $row){ |
| 76 | - $str = ''; | ||
| 77 | switch($row['disabled']){ | 83 | switch($row['disabled']){ |
| 78 | - case 0: $str = 'Enabled'; break; | ||
| 79 | - case 1: $str = 'Disabled'; break; | ||
| 80 | - case 2: $str = 'Deleted'; break; | 84 | + case 0: $enabled = $row['cnt']; break; |
| 85 | + case 1: $disabled = $row['cnt']; break; | ||
| 86 | + case 2: $deleted = $row['cnt']; break; | ||
| 81 | } | 87 | } |
| 82 | - | ||
| 83 | - $str .= ': '.$row['cnt']; | ||
| 84 | - | ||
| 85 | - $users .= (!empty($users)) ? '; ' : ''; | ||
| 86 | - $users .= $str; | ||
| 87 | } | 88 | } |
| 88 | - return $users; | 89 | + return "{$enabled}|{$disabled}|{$deleted}"; |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | // Get the number of documents in the repository | 92 | // Get the number of documents in the repository |
| 92 | function getDocCnt() | 93 | function getDocCnt() |
| 93 | { | 94 | { |
| 94 | - $query = 'select count(*) as cnt, s.name from documents d, status_lookup s WHERE s.id = d.status_id group by d.status_id;'; | 95 | + $query = 'select count(*) as cnt, status_id from documents d WHERE status_id IN (1,3,4) group by d.status_id;'; |
| 95 | $result2 = DBUtil::getResultArray($query); | 96 | $result2 = DBUtil::getResultArray($query); |
| 96 | 97 | ||
| 97 | if(empty($result2) || PEAR::isError($result2)){ | 98 | if(empty($result2) || PEAR::isError($result2)){ |
| 98 | - return ''; | 99 | + return '-|-|-'; |
| 99 | } | 100 | } |
| 100 | - $docs = ''; | 101 | + $live = '-'; |
| 102 | + $deleted = '-'; | ||
| 103 | + $archived = '-'; | ||
| 101 | 104 | ||
| 102 | foreach ($result2 as $row){ | 105 | foreach ($result2 as $row){ |
| 103 | - $docs .= (!empty($docs)) ? '; ' : ''; | ||
| 104 | - $docs .= $row['name'].': '.$row['cnt']; | 106 | + switch($row['status_id']){ |
| 107 | + case 1: $live = $row['cnt']; break; | ||
| 108 | + case 3: $deleted = $row['cnt']; break; | ||
| 109 | + case 4: $archived = $row['cnt']; break; | ||
| 110 | + } | ||
| 105 | } | 111 | } |
| 106 | - return $docs; | 112 | + return "{$live}|{$deleted}|{$archived}"; |
| 107 | } | 113 | } |
| 108 | 114 | ||
| 109 | // Get the version of KT | 115 | // Get the version of KT |
| @@ -121,15 +127,21 @@ function getKTVersion() | @@ -121,15 +127,21 @@ function getKTVersion() | ||
| 121 | // Get the edition of KT | 127 | // Get the edition of KT |
| 122 | function getKTEdition() | 128 | function getKTEdition() |
| 123 | { | 129 | { |
| 124 | - $edition = 'Community'; | 130 | + $edition = 'Community|-'; |
| 125 | if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { | 131 | if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { |
| 126 | $path = KTPluginUtil::getPluginPath('ktdms.wintools'); | 132 | $path = KTPluginUtil::getPluginPath('ktdms.wintools'); |
| 127 | require_once($path . 'baobabkeyutil.inc.php'); | 133 | require_once($path . 'baobabkeyutil.inc.php'); |
| 128 | $edition = BaobabKeyUtil::getName(); | 134 | $edition = BaobabKeyUtil::getName(); |
| 129 | 135 | ||
| 136 | + // this could be done with regular expressions... | ||
| 130 | // Remove the brackets around the name | 137 | // Remove the brackets around the name |
| 131 | $edition = substr($edition, 1); | 138 | $edition = substr($edition, 1); |
| 132 | $edition = substr($edition, 0, strlen($edition)-1); | 139 | $edition = substr($edition, 0, strlen($edition)-1); |
| 140 | + // Remove the "users" | ||
| 141 | + $pos = strpos($edition, 'users'); | ||
| 142 | + $edition = ($pos === false) ? $edition.'|-' : substr($edition, 0, $pos-1); | ||
| 143 | + // Replace the , with | | ||
| 144 | + $edition = str_replace(', ', '|', $edition); | ||
| 133 | } | 145 | } |
| 134 | return $edition; | 146 | return $edition; |
| 135 | } | 147 | } |
| @@ -139,22 +151,27 @@ function getKTEdition() | @@ -139,22 +151,27 @@ function getKTEdition() | ||
| 139 | function getOSInfo() | 151 | function getOSInfo() |
| 140 | { | 152 | { |
| 141 | $server = php_uname(); | 153 | $server = php_uname(); |
| 154 | + $flavour = '';//'|-'; | ||
| 142 | 155 | ||
| 143 | if(strpos($server, 'Darwin') !== false){ | 156 | if(strpos($server, 'Darwin') !== false){ |
| 144 | $os = 'Mac OS X'; | 157 | $os = 'Mac OS X'; |
| 145 | }else if(strpos($server, 'Win') !== false){ | 158 | }else if(strpos($server, 'Win') !== false){ |
| 146 | $os = 'Windows'; | 159 | $os = 'Windows'; |
| 147 | - }else { | 160 | + }else if(strpos($server, 'Linux') !== false) { |
| 161 | + // Again regular expressions would be nice... | ||
| 162 | + // $pos = strpos($server, 'SMP'); | ||
| 163 | + // $flavour = '|'.substr($server, 6, $pos-7); | ||
| 148 | $os = 'Linux'; | 164 | $os = 'Linux'; |
| 165 | + }else { | ||
| 166 | + $os = 'Unix'; | ||
| 149 | } | 167 | } |
| 150 | 168 | ||
| 151 | - return $os; | 169 | + return $os.$flavour; |
| 152 | } | 170 | } |
| 153 | 171 | ||
| 154 | function sendForm($data) | 172 | function sendForm($data) |
| 155 | { | 173 | { |
| 156 | $url = 'http://ktnetwork.knowledgetree.com/call_home.php'; | 174 | $url = 'http://ktnetwork.knowledgetree.com/call_home.php'; |
| 157 | - //$url = 'http://10.33.20.250/knowledgetree/call_home.php'; | ||
| 158 | $data = http_build_query($data); | 175 | $data = http_build_query($data); |
| 159 | 176 | ||
| 160 | $ch = curl_init($url); | 177 | $ch = curl_init($url); |