Skip to content

Commit

Permalink
Rename glpi_plugin_fusioninventory_snmp_history table to glpi_plugin_…
Browse files Browse the repository at this point in the history
…fusioninventory_snmphistories and PluginFusionInventorySNMPHistory class to PluginFusioninventorySnmphistory and snmp.history.classes.php file to snmphistory.class.php. See release fusioninventory#47
  • Loading branch information
Vincent MAZZONI committed Apr 28, 2010
1 parent d06f2c6 commit 3696260
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 74 deletions.
2 changes: 1 addition & 1 deletion ajax/plugin_fusioninventory.functionalities.tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
$config->showForm($_POST['target'],'1');
$config_modules = new PluginFusionInventoryConfigModules;
$config_modules->showForm($_POST['target'],'1');
$history = new PluginFusionInventorySNMPHistory;
$history = new PluginFusioninventorySnmphistory;
$history->showForm($_POST['target'],'1');
$ptLockable = new PluginFusionInventoryLockable;
$ptLockable->showForm($_POST['target']);
Expand Down
2 changes: 1 addition & 1 deletion front/cli-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

if (file_exists(GLPI_PLUGIN_DOC_DIR."/fusioninventory/cli-update.txt")) {
if (file_get_contents(GLPI_PLUGIN_DOC_DIR."/fusioninventory/cli-update.txt") == "1") {
$pfisnmph = new PluginFusionInventorySNMPHistory;
$pfisnmph = new PluginFusioninventorySnmphistory;
$pfisnmph->ConvertField(1);
unlink(GLPI_PLUGIN_DOC_DIR."/fusioninventory/cli-update.txt");
}
Expand Down
2 changes: 1 addition & 1 deletion front/plugin_fusioninventory.functionalities.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
}
glpi_header($_SERVER['HTTP_REFERER']);
} else if ((isset($_POST['Clean_history']))) {
$history = new PluginFusionInventorySNMPHistory;
$history = new PluginFusioninventorySnmphistory;
$history->CleanHistory("");
glpi_header($_SERVER['HTTP_REFERER']);
} else if ((isset($_POST['plugin_fusioninventory_lockable_add']))
Expand Down
42 changes: 21 additions & 21 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ function plugin_fusioninventory_getSearchOption() {

$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY]['common'] = $LANG['plugin_fusioninventory']["title"][2];

$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][1]['table'] = 'glpi_plugin_fusioninventory_snmp_history';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][1]['table'] = 'glpi_plugin_fusioninventory_snmphistories';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][1]['field'] = 'ID';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][1]['linkfield'] = '';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][1]['name'] = $LANG["common"][2];
Expand All @@ -447,22 +447,22 @@ function plugin_fusioninventory_getSearchOption() {
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][2]['linkfield'] = 'FK_ports';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][2]['name'] = $LANG["setup"][175];

$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][3]['table'] = 'glpi_plugin_fusioninventory_snmp_history';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][3]['table'] = 'glpi_plugin_fusioninventory_snmphistories';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][3]['field'] = 'Field';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][3]['linkfield'] = 'Field';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][3]['name'] = $LANG["event"][18];

$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][4]['table'] = 'glpi_plugin_fusioninventory_snmp_history';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][4]['table'] = 'glpi_plugin_fusioninventory_snmphistories';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][4]['field'] = 'old_value';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][4]['linkfield'] = 'old_value';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][4]['name'] = $LANG['plugin_fusioninventory']["history"][0];

$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][5]['table'] = 'glpi_plugin_fusioninventory_snmp_history';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][5]['table'] = 'glpi_plugin_fusioninventory_snmphistories';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][5]['field'] = 'new_value';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][5]['linkfield'] = 'new_value';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][5]['name'] = $LANG['plugin_fusioninventory']["history"][1];

$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][6]['table'] = 'glpi_plugin_fusioninventory_snmp_history';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][6]['table'] = 'glpi_plugin_fusioninventory_snmphistories';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][6]['field'] = 'date_mod';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][6]['linkfield'] = 'date_mod';
$sopt[PLUGIN_FUSIONINVENTORY_SNMP_HISTORY][6]['name'] = $LANG["common"][27];
Expand Down Expand Up @@ -1064,21 +1064,21 @@ function plugin_fusioninventory_giveItem($type,$ID,$data,$num) {
break;

// ** Display GLPI field of device
case "glpi_plugin_fusioninventory_snmp_history.Field" :
case "glpi_plugin_fusioninventory_snmphistories.Field" :
$out = $FUSIONINVENTORY_MAPPING[NETWORKING_TYPE][$data["ITEM_$num"]]['name'];
return $out;
break;

// ** Display Old Value (before changement of value)
case "glpi_plugin_fusioninventory_snmp_history.old_value" :
case "glpi_plugin_fusioninventory_snmphistories.old_value" :
// TODO ADD LINK TO DEVICE
if ((substr_count($data["ITEM_$num"],":") == 5) AND (empty($data["ITEM_3"]))) {
return "<center><b>".$data["ITEM_$num"]."</b></center>";
}
break;

// ** Display New Value (new value modified)
case "glpi_plugin_fusioninventory_snmp_history.new_value" :
case "glpi_plugin_fusioninventory_snmphistories.new_value" :
if ((substr_count($data["ITEM_$num"],":") == 5) AND (empty($data["ITEM_3"]))) {
return "<center><b>".$data["ITEM_$num"]."</b></center>";
}
Expand Down Expand Up @@ -1115,7 +1115,7 @@ function cron_plugin_fusioninventory() {
// $ptud->CleanOrphelinsConnections();
// $ptud->FusionUnknownKnownDevice();
// #Clean server script processes history
$pfisnmph = new PluginFusionInventorySNMPHistory;
$pfisnmph = new PluginFusioninventorySnmphistory;
$pfisnmph->cronCleanHistory();
return 1;
}
Expand Down Expand Up @@ -2078,7 +2078,7 @@ function plugin_fusioninventory_addLeftJoin($type,$ref_table,$new_table,$linkfie

// * ports updates list (report/switch_ports.history.php)
case PLUGIN_FUSIONINVENTORY_SNMP_HISTORY :
return " LEFT JOIN `glpi_networking_ports` ON ( `glpi_networking_ports`.`ID` = `glpi_plugin_fusioninventory_snmp_history`.`FK_ports` ) ";
return " LEFT JOIN `glpi_networking_ports` ON ( `glpi_networking_ports`.`ID` = `glpi_plugin_fusioninventory_snmphistories`.`FK_ports` ) ";
break;
}
return "";
Expand Down Expand Up @@ -2207,30 +2207,30 @@ function plugin_fusioninventory_addOrderBy($type,$ID,$order,$key=0) {
switch ($table.".".$field) {

// ** Display switch and Port
case "glpi_plugin_fusioninventory_snmp_history.ID" :
return " ORDER BY glpi_plugin_fusioninventory_snmp_history.ID $order ";
case "glpi_plugin_fusioninventory_snmphistories.ID" :
return " ORDER BY glpi_plugin_fusioninventory_snmphistories.ID $order ";
break;
case "glpi_networking_ports.ID" :
return " ORDER BY glpi_networking.name,glpi_networking_ports.name $order ";
break;

// ** Display GLPI field of device
case "glpi_plugin_fusioninventory_snmp_history.Field" :
return " ORDER BY glpi_plugin_fusioninventory_snmp_history.Field $order ";
case "glpi_plugin_fusioninventory_snmphistories.Field" :
return " ORDER BY glpi_plugin_fusioninventory_snmphistories.Field $order ";
break;

// ** Display Old Value (before changement of value)
case "glpi_plugin_fusioninventory_snmp_history.old_value" :
return " ORDER BY glpi_plugin_fusioninventory_snmp_history.old_value $order ";
case "glpi_plugin_fusioninventory_snmphistories.old_value" :
return " ORDER BY glpi_plugin_fusioninventory_snmphistories.old_value $order ";
break;

// ** Display New Value (new value modified)
case "glpi_plugin_fusioninventory_snmp_history.new_value" :
return " ORDER BY glpi_plugin_fusioninventory_snmp_history.new_value $order ";
case "glpi_plugin_fusioninventory_snmphistories.new_value" :
return " ORDER BY glpi_plugin_fusioninventory_snmphistories.new_value $order ";
break;

case "glpi_plugin_fusioninventory_snmp_history.date_mod" :
return " ORDER BY glpi_plugin_fusioninventory_snmp_history.date_mod $order ";
case "glpi_plugin_fusioninventory_snmphistories.date_mod" :
return " ORDER BY glpi_plugin_fusioninventory_snmphistories.date_mod $order ";
break;

}
Expand Down Expand Up @@ -2507,7 +2507,7 @@ function plugin_fusioninventory_addWhere($link,$nott,$type,$ID,$val) {
break;

// ** Display GLPI field of device
case "glpi_plugin_fusioninventory_snmp_history.Field" :
case "glpi_plugin_fusioninventory_snmphistories.Field" :
$ADD = "";
if ($nott=="0"&&$val=="NULL") {
$ADD=" OR $table.$field IS NULL ";
Expand Down
18 changes: 9 additions & 9 deletions inc/communication.classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1018,22 +1018,22 @@ function importPortNetworking($p_port) {
$errors.=$this->importVlans($child, $ptp);
break;
case 'IFNAME' :
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue('name', $child);
break;
case 'MAC' :
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue('ifmac', $child);
break;
case 'IFNUMBER' :
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue('logical_number', $child);
break;
case 'IFTYPE' : // already managed
break;
case 'TRUNK' :
if (!$ptp->getNoTrunk()) {
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue('trunk', $p_port->$name);
}
break;
Expand All @@ -1048,7 +1048,7 @@ function importPortNetworking($p_port) {
case 'IFOUTOCTETS' :
case 'IFSPEED' :
case 'IFSTATUS' :
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue(strtolower($name), $p_port->$name);
break;
default :
Expand Down Expand Up @@ -1085,19 +1085,19 @@ function importPortPrinter($p_port) {
foreach ($p_port->children() as $name=>$child) {
switch ($name) {
case 'IFNAME' :
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue('name', $child);
break;
case 'MAC' :
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue('ifmac', $child);
break;
case 'IP' :
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue('ifaddr', $child);
break;
case 'IFNUMBER' :
PluginFusionInventorySNMPHistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
PluginFusioninventorySnmphistory::networking_ports_addLog($ptp->getValue('ID'), $child, strtolower($name));
$ptp->setValue('logical_number', $child);
break;
case 'IFTYPE' : // already managed
Expand Down
6 changes: 3 additions & 3 deletions inc/port.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function connectDB($destination_port='') {
if (makeConnector($this->getValue('ID'),$destination_port)) { // connect those 2 ports
$ptap->updateProcess($_SESSION['glpi_plugin_fusioninventory_processnumber'],
array('query_nb_connections_created' => '1'));
PluginFusionInventorySNMPHistory::addLogConnection("make",$this->getValue('ID'));
PluginFusioninventorySnmphistory::addLogConnection("make",$this->getValue('ID'));
}
}
}
Expand All @@ -284,8 +284,8 @@ function connectDB($destination_port='') {
function disconnectDB($p_port='') {
if ($p_port=='') $p_port=$this->getValue('ID');
$netwire = new Netwire;
PluginFusionInventorySNMPHistory::addLogConnection("remove",$netwire->getOppositeContact($p_port));
//PluginFusionInventorySNMPHistory::addLogConnection("remove",$p_port);
PluginFusioninventorySnmphistory::addLogConnection("remove",$netwire->getOppositeContact($p_port));
//PluginFusioninventorySnmphistory::addLogConnection("remove",$p_port);
$nn = new NetworkPort_NetworkPort();
if ($nn->getFromDBForNetworkPort($p_port)) {
if ($nn->delete(array('id'=>$p_port))) {
Expand Down
2 changes: 1 addition & 1 deletion inc/setup.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static function update($version) {
foreach (glob(GLPI_ROOT.'/plugins/fusioninventory/models/*.xml') as $file) $importexport->import($file,0,1);

// Update ports history from lang traduction into field constant (MySQL fiel 'Field')
$pfisnmph = new PluginFusionInventorySNMPHistory;
$pfisnmph = new PluginFusioninventorySnmphistory;
$pfisnmph->ConvertField();

// Delete all values in glpi_plugin_fusioninventory_config_snmp_history
Expand Down
Loading

0 comments on commit 3696260

Please sign in to comment.