function getBandwidth()
 {
     if (empty($this->bandwidths)) {
         $finder = new Bandwidth();
         $this->bandwidths = $finder->find(array('support_contract_id' => $this->id));
     }
     return $this->bandwidths;
 }
Exemple #2
0
         // Issue magic packet
         // Send via Apache X-Sendfile header?
         if ($sendFileMode == 'Apache') {
             Debug::LogEntry('audit', 'HTTP GetFile request redirecting to ' . Config::GetSetting('LIBRARY_LOCATION') . $file['storedAs'], 'services');
             header('X-Sendfile: ' . Config::GetSetting('LIBRARY_LOCATION') . $file['storedAs']);
         } else {
             if ($sendFileMode == 'Nginx') {
                 header('X-Accel-Redirect: /download/' . $file['storedAs']);
             } else {
                 header('HTTP/1.0 404 Not Found');
             }
         }
         // Debug
         Debug::Audit('File request via magic packet. ' . $file['storedAs'], $file['displayId']);
         // Log bandwidth
         $bandwidth = new Bandwidth();
         $bandwidth->Log($file['displayId'], 4, $file['size']);
     }
     exit;
 }
 try {
     $wsdl = 'lib/service/service_v' . $version . '.wsdl';
     if (!file_exists($wsdl)) {
         $serviceResponse->ErrorServerError('Your client is not the correct version to communicate with this CMS.');
     }
     $soap = new SoapServer($wsdl);
     //$soap = new SoapServer($wsdl, array('cache_wsdl' => WSDL_CACHE_NONE));
     $soap->setClass('XMDSSoap' . $version);
     $soap->handle();
 } catch (Exception $e) {
     Debug::LogEntry('error', $e->getMessage());
Exemple #3
0
 /**
  * Log Bandwidth Usage
  * @param <type> $displayId
  * @param <type> $type
  * @param <type> $sizeInBytes
  */
 private function LogBandwidth($displayId, $type, $sizeInBytes)
 {
     $bandwidth = new Bandwidth();
     $bandwidth->Log($displayId, $type, $sizeInBytes);
 }
Exemple #4
0
include '../vendor/autoload.php';
// set true for testing purposes
$linear = false;
$response = new Response();
try {
    if (!array_key_exists('start', $_GET)) {
        throw new \RuntimeException('No start time specified.');
    }
    if (!array_key_exists('end', $_GET)) {
        throw new \RuntimeException('No end time specified.');
    }
    if (!array_key_exists('step', $_GET)) {
        throw new \RuntimeException('No step specified.');
    }
    $start = (int) $_GET['start'];
    $end = (int) $_GET['end'];
    $step = (int) $_GET['step'];
    // 30m
    if ($linear) {
        $bandwidth = new Linear($start, $end, $step);
    } elseif ($_GET['weak']) {
        $bandwidth = new Bandwidth(0, 2400, 2000, 386, 0.05);
    } else {
        $bandwidth = new Bandwidth(0, 12000, 8000, 1024, 0.05);
    }
    $response->data('datapoints', $bandwidth->get($start, $end, $step));
} catch (\Exception $e) {
    $response->addError($e->getMessage());
}
echo $response->toJson();