Changeset 247
- Timestamp:
- 05/22/07 16:19:12 (2 years ago)
- Files:
-
- trunk/webmin/lrs-inventory/agent/_relpos.php (added)
- trunk/webmin/lrs-inventory/agent/importGLPI.php (added)
- trunk/webmin/lrs-inventory/agent/transfertNG.php (modified) (1 diff)
- trunk/webmin/lrs-inventory/classes/Components/Bios.php (modified) (3 diffs)
- trunk/webmin/lrs-inventory/classes/Components/Hardware.php (modified) (1 diff)
- trunk/webmin/lrs-inventory/classes/Components/Input.php (modified) (1 diff)
- trunk/webmin/lrs-inventory/classes/Components/Memory.php (modified) (1 diff)
- trunk/webmin/lrs-inventory/classes/DataSource.php (modified) (4 diffs)
- trunk/webmin/lrs-inventory/classes/Drivers/Sql/SqlDriver.php (modified) (7 diffs)
- trunk/webmin/lrs-inventory/classes/Drivers/Xml/Maps/OcsNGMap.xml (modified) (4 diffs)
- trunk/webmin/lrs-inventory/classes/Drivers/Xml/XmlDriver.php (modified) (2 diffs)
- trunk/webmin/lrs-inventory/custom.cgi (modified) (4 diffs)
- trunk/webmin/lrs-inventory/debian/changelog (modified) (1 diff)
- trunk/webmin/lrs-inventory/module.info (modified) (1 diff)
- trunk/webmin/lrs-inventory/sql/create-db.sh (modified) (1 diff)
- trunk/webmin/lrs-inventory/sql/schema.sql.v.7 (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/webmin/lrs-inventory/agent/transfertNG.php
r208 r247 86 86 } 87 87 } 88 88 89 /* GLPI import */ 90 if (1) { 91 $mach = ereg_replace('-[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}$', '', $DEVICEID); 92 system("/var/lib/lrs/php ./importGLPI.php $mach >/tmp/glpi.log 2>&1"); 93 } 89 94 } 90 95 trunk/webmin/lrs-inventory/classes/Components/Bios.php
r133 r247 13 13 { 14 14 $this->m_Properties = array( 'Serial'=>'' , 15 'Version'=>'' ,16 'Vendor'=>'' ,17 'Chipset'=>'' ,18 'ChipsetSerial'=>'' ,19 'ChipsetVendor'=>'' ,20 'MachineType'=>'' );15 'Version'=>'' , 16 'Vendor'=>'' , 17 'Chipset'=>'' , 18 'ChipsetSerial'=>'' , 19 'ChipsetVendor'=>'' , 20 'TypeMachine'=>'' ); 21 21 } 22 22 … … 148 148 function getMachineType() 149 149 { 150 return $this->getProperty(' MachineType');150 return $this->getProperty('TypeMachine'); 151 151 } 152 152 … … 158 158 function setMachineType($machinetype) 159 159 { 160 $this->setProperty(' MachineType',$machinetype);160 $this->setProperty('TypeMachine',$machinetype); 161 161 } 162 162 trunk/webmin/lrs-inventory/classes/Components/Hardware.php
r133 r247 12 12 function Hardware() 13 13 { 14 $this->m_Properties = array( 'ProcessorType'=>'' , 14 $this->m_Properties = array( 'Description'=>'', 15 'Type'=>'', 16 'ProcessorType'=>'' , 15 17 'ProcessorFrequency'=>'' , 16 18 'ProcessorCount'=>'' , trunk/webmin/lrs-inventory/classes/Components/Input.php
r133 r247 13 13 { 14 14 $this->m_Properties = array( 'Type'=>'' , 15 'StandardDescription'=>'' , 16 'ExpandedDescription'=>'' , 17 'Connector'=>'' ); 15 'StandardDescription'=>'' , 16 'ExpandedDescription'=>'' , 17 'Manufacturer'=>'' , 18 'PointType'=>'' , 19 'Connector'=>'' ); 18 20 } 19 21 trunk/webmin/lrs-inventory/classes/Components/Memory.php
r133 r247 14 14 $this->m_Properties = array( 'Type'=>'' , 15 15 'ExtendedDescription'=>'' , 16 'Description'=>'' , 16 17 'Size'=>'' , 17 18 'ChipsetType'=>'' , trunk/webmin/lrs-inventory/classes/DataSource.php
r133 r247 18 18 var $m_Sources; 19 19 var $m_SourceConfigurations; 20 var $m_ClassPrefix; 20 21 21 22 /** … … 28 29 $this->m_Sources = array(); 29 30 $this->m_SourceConfigurations = DataSourceConfiguration::loadFromFile($DATASOURCECONFIGURATION); 31 $this->m_ClassPrefix = ""; 30 32 } 31 33 … … 228 230 } 229 231 232 /* 233 * Load a component class 234 */ 230 235 function loadComponentClass($classname) 231 236 { … … 233 238 234 239 global $INCLUDE_PATH; 235 236 include_once($INCLUDE_PATH .'Components/'. $classname .'.php'); 240 241 $pre = $this->m_ClassPrefix; 242 if (class_exists($pre.$classname)) 243 return; 244 245 if ($pre == "" || $classname == "Component" || $classname == "Object") { 246 include_once($INCLUDE_PATH .'Components/'. $classname .'.php'); 247 } else { 248 // rename the class name 249 ini_set("include_path", ".:".$INCLUDE_PATH .'Components/'); 250 $class = join("", file($INCLUDE_PATH .'Components/'. $classname .'.php')); 251 $class = preg_replace("/class ".$classname." extends /", "class ".$pre.$classname." extends ", $class); 252 $class = preg_replace("/function ".$classname."\(\)/", "function ".$pre.$classname."()", $class); 253 $class = preg_replace("/^<.php/", "// $0", $class); 254 $class = preg_replace("/\\?>/", "// $0", $class); 255 eval($class); 256 } 237 257 } 238 258 trunk/webmin/lrs-inventory/classes/Drivers/Sql/SqlDriver.php
r208 r247 22 22 var $m_InvIdDate; 23 23 var $m_InvIdTime; 24 var $m_DBName; 24 25 25 26 /** … … 38 39 $this->m_CachedMachines = array(); 39 40 $this->m_LatestMachineInventory = array(); 41 $this->m_DBName = $parameters['Database']; 40 42 } 41 43 … … 602 604 if ( $machine == "*ALL*") 603 605 $getall = 1; 606 else 607 $getall = 0; 604 608 // if it is a MAC address 605 609 if ( eregi('^[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}$', $machine) ) … … 720 724 { 721 725 global $datasource; 726 727 $pre = $datasource->m_ClassPrefix; 722 728 $datasource->loadComponentClass($type); 723 729 … … 797 803 $objectid = $connection->Record['id']; 798 804 799 $object = new $type; 805 $pretype = $pre.$type; 806 $object = new $pretype; 800 807 801 808 // Update host<=>component link … … 1014 1021 $newname = eregi_replace("[^0-9a-z-]", "_", $name); 1015 1022 1016 $sql = "ALTER TABLE Custom ADD $newname $type;"; 1023 $def = "DEFAULT 0"; 1024 if (strstr($type, "varchar")) $def = "DEFAULT \"\""; 1025 $sql = "ALTER TABLE Custom ADD $newname $type $def;"; 1017 1026 $this->m_Connection->query($sql); 1018 1019 1027 } 1028 1029 /** 1030 * Delete a field in the Custom table 1031 * 1032 * @param name 1033 */ 1034 function delCustomField($name) 1035 { 1036 $newname = eregi_replace("[^0-9a-z-]", "_", $name); 1037 1038 $sql = "ALTER TABLE Custom DROP COLUMN $newname;"; 1039 $this->m_Connection->query($sql); 1040 } 1020 1041 1021 1042 /** … … 1051 1072 } 1052 1073 1053 1074 /* Send a 'USE db' query to WA some PHP/Mysql bugs */ 1075 function forceUse() 1076 { 1077 $connection = $this->m_Connection; 1078 $connection->query("USE ".$this->m_DBName); 1079 } 1054 1080 } 1055 1081 trunk/webmin/lrs-inventory/classes/Drivers/Xml/Maps/OcsNGMap.xml
r208 r247 22 22 <MappedField from="WINOWNER" to="RegisteredName" /> 23 23 <MappedField from="WINPRODID" to="OSSerialNumber" /> 24 <MappedField from="DESCRIPTION" to="Description" /> 25 <MappedField from="TYPE" to="Type" /> 24 26 25 27 </MappedObject> … … 27 29 <MappedObject name="BIOS" class="Bios"> 28 30 29 <MappedField from="SMANUFACTURER" to=" SmbManufacturer" />30 <MappedField from="SMODEL" to=" SmbProduct" />31 <MappedField from="SSN" to="S mbSerial" />31 <MappedField from="SMANUFACTURER" to="ChipVendor" /> 32 <MappedField from="SMODEL" to="Chipset" /> 33 <MappedField from="SSN" to="Serial" /> 32 34 <MappedField from="BMANUFACTURER" to="BiosVendor" /> 33 35 <MappedField from="BVERSION" to="BiosVersion" /> 34 36 <MappedField from="BDATE" to="ChipSerial" /> 37 <MappedField from="TYPE" to="TypeMachine" /> 35 38 36 39 </MappedObject> … … 54 57 <MappedField from="DESCRIPTION" to="ExpandedDescription" /> 55 58 <MappedField from="INTERFACE" to="Connector" /> 59 <MappedField from="MANUFACTURER" to="Manufacturer" /> 60 <MappedField from="POINTTYPE" to="PointType" /> 56 61 57 62 </MappedObject> … … 65 70 <MappedField from="SPEED" to="Frequency" /> 66 71 <MappedField from="NUMSLOTS" to="SlotCount" /> 72 <MappedField from="DESCRIPTION" to="Description" /> 67 73 68 74 </MappedObject> trunk/webmin/lrs-inventory/classes/Drivers/Xml/XmlDriver.php
r208 r247 324 324 function characterDataXmlParser($parser, $data) 325 325 { 326 exec("echo \"==D\" >>/tmp/log");327 326 if ( trim($data) != "" && $data!='N/A' && isset($GLOBALS['CURRENTOBJECT'])) 328 327 { … … 334 333 $machine = & $GLOBALS['CURRENTMACHINE']; 335 334 336 exec("echo \"==C\" >>/tmp/log");337 335 // Sets the machine name 338 336 if ( ($GLOBALS['CURRENTFIELD']=='Host' || $GLOBALS['CURRENTFIELD']=='NAME') && $GLOBALS['CURRENTTAG']=='HARDWARE') { trunk/webmin/lrs-inventory/custom.cgi
r133 r247 18 18 $driver = $datasource->getDefaultSourceDriver(); 19 19 $types = $driver->getFields('Custom'); 20 21 20 # SQL types for new fields 22 21 $newtypes = array( … … 39 38 // A field has to be delete 40 39 case 'delete': 41 //$machine->deleteCustomField( $_GET['field'] );40 $driver->delCustomField( $_GET['field'] ); 42 41 break; 43 42 … … 102 101 if (!$cust) $cust = $empty; 103 102 $props = $cust->getProperties(); 104 105 103 foreach ( $props as $key => $value ) 106 104 { … … 119 117 $template->set_var('ROWCLASS', $parity); 120 118 $template->set_var('delme', ''); 121 // delete not activated 122 if (0) { 123 // can delete non standard fields only 124 if (!array_key_exists( $key, $empty->m_Properties)) { 125 $template->parse('delme', 'candelete'); 126 $template->set_var('DELETE_URL', $deleteurl); 127 } 119 120 // can delete non standard fields only 121 if (!array_key_exists( $key, $empty->m_Properties)) { 122 $template->set_var('DELETE_URL', $deleteurl); 123 $template->parse('delme', 'candelete'); 128 124 } 129 125 $template->parse('rows', 'row', true); trunk/webmin/lrs-inventory/debian/changelog
r208 r247 1 webmin-lrs-inventory (2.1. 4) stable; urgency=low1 webmin-lrs-inventory (2.1.5) stable; urgency=low 2 2 3 3 * First package. Replaces webmin-lbs-inventory trunk/webmin/lrs-inventory/module.info
r208 r247 3 3 desc_fr=LRS : Inventaire 4 4 depends=1.030 lbs_common 5 version=2.1. 45 version=2.1.5 trunk/webmin/lrs-inventory/sql/create-db.sh
r208 r247 5 5 6 6 # lastest db version 7 TOVER= 67 TOVER=7 8 8 9 9 #
