Changeset 135
- Timestamp:
- 03/14/06 15:49:04 (3 years ago)
- Files:
-
- trunk/webmin/lrs-inventory/agent/lrs-inventory.conf (modified) (1 diff)
- trunk/webmin/lrs-inventory/agent/transfertNG.php (modified) (3 diffs)
- trunk/webmin/lrs-inventory/classes/Components/Null.php (added)
- trunk/webmin/lrs-inventory/classes/Drivers/Csv/Definitions/Modem.xml (modified) (1 diff)
- trunk/webmin/lrs-inventory/classes/Drivers/Csv/Definitions/Monitor.xml (modified) (1 diff)
- trunk/webmin/lrs-inventory/classes/Drivers/Sql/SqlDriver.php (modified) (3 diffs)
- trunk/webmin/lrs-inventory/classes/Drivers/Xml/Maps/OcsNGMap.xml (modified) (4 diffs)
- trunk/webmin/lrs-inventory/classes/Drivers/Xml/XmlDriver.php (modified) (6 diffs)
- trunk/webmin/lrs-inventory/debian/changelog (modified) (1 diff)
- trunk/webmin/lrs-inventory/module.info (modified) (1 diff)
- trunk/webmin/lrs-inventory/peripherals.cgi (modified) (1 diff)
- trunk/webmin/lrs-inventory/sql/create-db.sh (modified) (1 diff)
- trunk/webmin/lrs-inventory/sql/schema.sql.v.5 (added)
- trunk/webmin/lrs-inventory/tmpl/en/Modem.tpl (added)
- trunk/webmin/lrs-inventory/tmpl/en/Monitor.tpl (modified) (2 diffs)
- trunk/webmin/lrs-inventory/tmpl/fr/Modem.tpl (added)
- trunk/webmin/lrs-inventory/tmpl/fr/Monitor.tpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/webmin/lrs-inventory/agent/lrs-inventory.conf
r133 r135 8 8 Alias /lrs-transfert /usr/share/webmin/lrs-inventory/agent/ 9 9 Alias /lrs-transfer /usr/share/webmin/lrs-inventory/agent/ 10 Alias /ocsinventory /usr/share/webmin/lrs-inventory/agent/transfertNG.php trunk/webmin/lrs-inventory/agent/transfertNG.php
r133 r135 1 1 <?php 2 # 3 # $Id$ 4 # 5 # Linbox Rescue Server 6 # Copyright (C) 2005 Linbox FAS 7 # 8 # This program is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU General Public License 10 # as published by the Free Software Foundation; either version 2 11 # of the License, or (at your option) any later version. 12 # 13 # This program is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program; if not, write to the Free Software 20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 2 21 3 22 $QUERY; … … 11 30 12 31 // Read compressed data 32 $data = ""; 13 33 $stdin = fopen('php://input','r'); 14 $data = fread($stdin,$_SERVER['CONTENT_LENGTH']); 34 while (!feof($stdin)) { 35 $data .= fread($stdin, 8192); 36 } 15 37 fclose($stdin); 16 17 // Write it in a temporary file18 $fh = fopen("/tmp/${_SERVER[REMOTE_ADDR]}.tmp",'w');19 fwrite($fh,$data);20 fclose($fh);21 22 38 // Uncompress it 23 exec("perl uncompress.pl /tmp/${_SERVER[REMOTE_ADDR]}.tmp",$DATA); 24 $DATA = join('',$DATA); 39 $DATA = gzuncompress($data); 25 40 26 41 system("rm /tmp/${_SERVER[REMOTE_ADDR]}.tmp -f"); … … 32 47 ereg('<DEVICEID>([a-zA-Z0-9_-]+)</DEVICEID>', $DATA, $matches); 33 48 $DEVICEID = $matches[1]; 34 35 $DEBUG = true; 49 50 //exec("echo \"$DATA\" >>/tmp/log"); 51 //$DEBUG = true; 36 52 37 if ( $QUERY=='PROLOG' ) 38 53 if ( $QUERY=='PROLOG' ) { 39 54 // Always send the inventory 40 $ data = '<?xml version="1.0" encoding="utf-8" ?><REPLY><RESPONSE>send</RESPONSE></REPLY>';41 55 $resp = '<?xml version="1.0" encoding="utf-8" ?><REPLY><RESPONSE>SEND</RESPONSE></REPLY>'; 56 } 42 57 else if ( $QUERY=='INVENTORY' ) 43 58 { 44 59 // Extract inventory data 45 ereg(' (<HARDWARE>.+)<\/CONTENT>', $DATA, $matches);60 ereg('<CONTENT>(.+)<\/CONTENT>', $DATA, $matches); 46 61 $INVENTORY = '<?xml version="1.0" encoding="utf-8" ?><Inventory>'. $matches[1] .'</Inventory>'; 62 $resp = '<?xml version="1.0" encoding="utf-8" ?><REPLY><RESPONSE>no_account_update</RESPONSE></REPLY>'; 47 63 48 $data = '<?xml version="1.0" encoding="utf-8" ?><REPLY><RESPONSE>no_update</RESPONSE></REPLY>'; 49 64 // Store data on the server 50 65 // Parse data 51 66 $machines = & $datasource->readMachine( array($DEVICEID), null, 'OcsNG' ); 52 67 53 // Store data on the server54 68 for ( $i=0 ; $i<count($machines) ; $i++ ) 55 69 { 56 70 $machine = & $machines[$i]; 57 58 foreach ( array_keys($machine->m_Components) as $type ) 59 60 $datasource->write($machine->m_Components[$type]); 71 if ($machine->getName() != "") { 72 foreach ( array_keys($machine->m_Components) as $type ) { 73 $datasource->write($machine->m_Components[$type]); 74 } 75 } 61 76 } 62 77 63 78 } 64 79 65 print gzcompress($data); 66 67 80 print gzcompress($resp); 81 68 82 ?> trunk/webmin/lrs-inventory/classes/Drivers/Csv/Definitions/Modem.xml
r133 r135 6 6 7 7 <Versions> 8 9 <Version number="3.0"> 10 11 <Directory>Modems</Directory> 12 13 <Fields> 14 <Field index="0">Host</Field> 15 <Field index="1">Vendor</Field> 16 <Field index="2">Model</Field> 17 <Field index="3">ExpandedDescription</Field> 18 <Field index="4">Type</Field> 19 </Fields> 20 21 </Version> 8 22 9 23 <Version number="2.0"> trunk/webmin/lrs-inventory/classes/Drivers/Csv/Definitions/Monitor.xml
r133 r135 13 13 <Fields> 14 14 <Field index="0">Host</Field> 15 <Field index="1">Stamp</Field> 16 <Field index="2">Description</Field> 17 <Field index="3">Type</Field> 15 <Field index="1">Manuf</Field> 16 <Field index="2">Stamp</Field> 17 <Field index="3">Description</Field> 18 <Field index="4">Type</Field> 18 19 </Fields> 19 20 20 21 </Version> 21 22 trunk/webmin/lrs-inventory/classes/Drivers/Sql/SqlDriver.php
r133 r135 53 53 // hack used by transfer.php to make sure that an inventory has the same 54 54 // Id for all object types 55 $todayinventory = new Inventory($this->m_InvIdDate, $this->m_InvIdTime); 55 $todayinventory = new Inventory($this->m_InvIdDate, $this->m_InvIdTime); 56 56 } 57 57 $this->m_InvIdDate = $todayinventory->getDate(); … … 62 62 { 63 63 $ismachine = $object->getClassName()=='machine'; 64 65 if ($object->getClassName() == "object") continue; 64 66 65 67 // Get object and machine IDs in the database … … 67 69 debug("Object ID : $objectid"); 68 70 71 69 72 if ( $ismachine ) 70 73 71 $this->saveCustomFields($object); 74 $this->saveCustomFields($object); // obsolete ? 72 75 73 76 else trunk/webmin/lrs-inventory/classes/Drivers/Xml/Maps/OcsNGMap.xml
r133 r135 9 9 <MappedField from="OSNAME" to="OperatingSystem" /> 10 10 <MappedField from="OSVERSION" to="Version" /> 11 <MappedField from="OSCOMMENTS" to="Build" /> 11 12 <MappedField from="PROCESSORT" to="ProcessorType" /> 12 13 <MappedField from="PROCESSORS" to="ProcessorFrequency" /> … … 72 73 <MappedField from="CAPTION" to="Stamp" /> 73 74 <MappedField from="DESCRIPTION" to="Description" /> 75 <MappedField from="MANUFACTURER" to="Manuf" /> 74 76 <MappedField from="TYPE" to="Type" /> 75 77 … … 78 80 <MappedObject name="NETWORKS" class="Network"> 79 81 80 <MappedField from="DESCRIPTION" to=" Description" />81 <MappedField from="TYPE" to=" CardType" />82 <MappedField from="DESCRIPTION" to="CardType" /> 83 <MappedField from="TYPE" to="NetworkType" /> 82 84 <MappedField from="TYPEMIB" to="MIB" /> 83 85 <MappedField from="SPEED" to="Bandwidth" /> … … 166 168 </MappedObject> 167 169 170 <MappedObject name="MODEMS" class="Modem"> 171 <MappedField from="NAME" to="Vendor" /> 172 <MappedField from="MODEL" to="Model" /> 173 <MappedField from="DESCRIPTION" to="ExpandedDescription" /> 174 <MappedField from="TYPE" to="Type" /> 175 </MappedObject> 176 177 <MappedObject name="ACCOUNTINFO" class="Null"> 178 </MappedObject> 179 180 <MappedObject name="ACCESSLOG" class="Null"> 181 </MappedObject> 182 183 <MappedObject name="DEVICEID" class="Null"> 184 </MappedObject> 185 168 186 </MappedFields> trunk/webmin/lrs-inventory/classes/Drivers/Xml/XmlDriver.php
r133 r135 140 140 141 141 // For each component of the machine 142 for ( $j=0 ; $j<count($machine->m_Components[$type]) ; $j++ ) 143 142 for ( $j=0 ; $j<count($machine->m_Components[$type]) ; $j++ ) { 144 143 // Only append the current component to the end of array 145 $objects[] = & $machine->m_Components[$type][$j]; 146 147 } 148 144 $obj = & $machine->m_Components[$type][$j]; 145 $obj->setHost($machine); 146 $objects[] = & $obj; 147 } 148 } 149 149 150 return $objects; 150 151 } … … 199 200 200 201 xml_parser_free($parser); 201 202 202 203 return $machine; 203 204 } … … 244 245 245 246 $xmlmap = & $GLOBALS['CURRENTXMLMAP']; 247 248 //echo $GLOBALS['CURRENTLEVEL'].":$name;".$GLOBALS['CURRENTTAG'].";"; 246 249 247 250 switch ( $GLOBALS['CURRENTLEVEL'] ) … … 262 265 } 263 266 264 if ( class_exists($class) )267 if ( class_exists($class) && $class != "Null" ) 265 268 { 266 269 unset($GLOBALS['CURRENTOBJECT']); … … 277 280 else 278 281 { 279 global $datasource;280 $datasource->loadComponentClass('Object');282 //global $datasource; 283 //$datasource->loadComponentClass('Object'); 281 284 282 $GLOBALS['CURRENTOBJECT'] = new Object(); 285 unset($GLOBALS['CURRENTOBJECT']); 286 // = new Object(); 283 287 } 284 288 } … … 315 319 function characterDataXmlParser($parser, $data) 316 320 { 317 if ( ! empty($data) && $data!='N/A')321 if ( trim($data) != "" && $data!='N/A' && isset($GLOBALS['CURRENTOBJECT'])) 318 322 { 319 323 $object = & $GLOBALS['CURRENTOBJECT']; 320 324 321 $object->setProperty($GLOBALS['CURRENTFIELD'], $data);325 $object->setProperty($GLOBALS['CURRENTFIELD'], utf8_decode($data)); 322 326 323 327 $machine = & $GLOBALS['CURRENTMACHINE']; 324 328 325 329 // Sets the machine name 326 if ( $GLOBALS['CURRENTFIELD']=='Host' && $GLOBALS['CURRENTTAG']=='HARDWARE' ) 327 330 if ( ($GLOBALS['CURRENTFIELD']=='Host' || $GLOBALS['CURRENTFIELD']=='NAME') && $GLOBALS['CURRENTTAG']=='HARDWARE') { 328 331 $machine->setName($data); 329 330 } 331 } 332 333 332 } 333 } 334 } 334 335 ?> trunk/webmin/lrs-inventory/debian/changelog
r133 r135 1 webmin-lrs-inventory (2.0. 8) stable; urgency=low1 webmin-lrs-inventory (2.0.9) stable; urgency=low 2 2 3 3 * First package. Replaces webmin-lbs-inventory trunk/webmin/lrs-inventory/module.info
r133 r135 3 3 desc_fr=LRS : Inventaire 4 4 depends=1.030 lbs_common 5 version=2.0. 85 version=2.0.9 trunk/webmin/lrs-inventory/peripherals.cgi
r133 r135 9 9 renderTable('Input'); 10 10 renderTable('Monitor'); 11 renderTable('Modem'); 11 12 12 13 print perl_exec("lbs_footer.cgi"); trunk/webmin/lrs-inventory/sql/create-db.sh
r133 r135 5 5 6 6 # lastest db version 7 TOVER= 47 TOVER=5 8 8 9 9 # trunk/webmin/lrs-inventory/tmpl/en/Monitor.tpl
r133 r135 15 15 <tr> 16 16 <th>Client {SORT_HOST}</th> 17 <th> Category {SORT_STAMP}</th>17 <th>Manufacturer {SORT_MANUF}</th> 18 18 <th>Description {SORT_DESCRIPTION}</th> 19 19 <th>Type {SORT_TYPE}</th> 20 <th>Category {SORT_STAMP}</th> 20 21 <th>Appearance {SORT_FIRSTAPPARITION}</th> 21 22 </tr> … … 25 26 <tr class="{ROWCLASS}"> 26 27 <td class="{HOST_CLASS}">{HOSTL}</td> 27 <td class="{ STAMP_CLASS}">{STAMP}</td>28 <td class="{MANUF_CLASS}">{MANUF}</td> 28 29 <td class="{DESCRIPTION_CLASS}">{DESCRIPTION}</td> 29 30 <td class="{TYPE_CLASS}">{TYPE}</td> 31 <td class="{STAMP_CLASS}">{STAMP}</td> 30 32 <td class="{FIRSTAPPARITION_CLASS}">{FIRSTAPPARITION}</td> 31 33 </tr> trunk/webmin/lrs-inventory/tmpl/fr/Monitor.tpl
r133 r135 15 15 <tr> 16 16 <th>Client {SORT_HOST}</th> 17 <th> Categorie {SORT_STAMP}</th>17 <th>Fabriquant {SORT_MANUF}</th> 18 18 <th>Description {SORT_DESCRIPTION}</th> 19 19 <th>Type {SORT_TYPE}</th> 20 <th>Categorie {SORT_STAMP}</th> 20 21 <th>Apparition {SORT_FIRSTAPPARITION}</th> 21 22 </tr> … … 25 26 <tr class="{ROWCLASS}"> 26 27 <td class="{HOST_CLASS}">{HOSTL}</td> 27 <td class="{ STAMP_CLASS}">{STAMP}</td>28 <td class="{MANUF_CLASS}">{MANUF}</td> 28 29 <td class="{DESCRIPTION_CLASS}">{DESCRIPTION}</td> 29 30 <td class="{TYPE_CLASS}">{TYPE}</td> 31 <td class="{STAMP_CLASS}">{STAMP}</td> 30 32 <td class="{FIRSTAPPARITION_CLASS}">{FIRSTAPPARITION}</td> 31 33 </tr>
