X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PlanetLabConf%2Fbwlimit.php;h=a35bdebb5fc005b6f496ecfc965b3795da9cb5cc;hb=9f350979dcb5a9b5e1643f81fa93326e23c231a4;hp=850e864ad361ae7616f1218a3976c33981dcc4d5;hpb=e9b0065a02763ed6ba0d6499c8d4fc723eb3a410;p=nodeconfig.git diff --git a/PlanetLabConf/bwlimit.php b/PlanetLabConf/bwlimit.php index 850e864..a35bdeb 100755 --- a/PlanetLabConf/bwlimit.php +++ b/PlanetLabConf/bwlimit.php @@ -13,7 +13,18 @@ require_once 'plc_api.php'; global $adm; // Look up the node -$interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); +// backwards compatibility with the old 4.2 API +global $__PLC_API_VERSION; +if ( ! method_exists ($adm,"GetInterfaces")) + $__PLC_API_VERSION = 4.2; +else + $__PLC_API_VERSION = 4.3; + +if ($__PLC_API_VERSION==4.2) + $interfaces = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); +else + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); + if (!empty($interfaces)) { if ($interfaces[0]['bwlimit'] !== NULL) { $rate = $interfaces[0]['bwlimit'];