Esempio n. 1
0
 /**
  * @covers SysInfo\Linux\CPU::__construct
  * @covers SysInfo\Linux\CPU::getUsertime
  * @covers SysInfo\Linux\CPU::getSystemtime
  * @covers SysInfo\Linux\CPU::getIdletime
  */
 public function testCPUWithSystemData()
 {
     $cpu = new CPU();
     $this->assertInternalType('int', $cpu->getUsertime());
     $this->assertInternalType('int', $cpu->getUsertime(true));
     $this->assertInternalType('int', $cpu->getSystemtime());
     $this->assertInternalType('int', $cpu->getIdletime());
 }
Esempio n. 2
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/Source/CPUDB.php';
// File with DB functions class
if (!$_SESSION) {
    session_start();
}
// Start the session
$CPU = new CPU();
//instantiating class with DB functions
$action = $_REQUEST["action"];
//variable from GET string - shows what action to take
header("Content-type:text/xml");
//setting the content type of the response document to XML
echo '<?xml version="1.0"?><data>';
//setting the root xml tag in the response document
switch ($action) {
    case "AddCPURow":
        $status = $CPU->AddCPURow($_REQUEST['CPU'], $_REQUEST['CPU_Link'], $_REQUEST['Price'], $_REQUEST['Core'], $_REQUEST['Speed'], $_REQUEST['Cache'], $_REQUEST['Processor'], $_REQUEST['Memory_CPU'], $_REQUEST['Max_Memory'], $_REQUEST['Memory_Type'], $_REQUEST['TDP'], $_REQUEST['BenchMark'], $_REQUEST['Date'], $_REQUEST['Dell_Link'], $_REQUEST['Benchmark_Link'], $_REQUEST['Color'], $_REQUEST['Model'], $_REQUEST['Wholesale']);
        //
        echo '<status><![CDATA[' . $status[0] . ']]></status>';
        //output login status
        echo '<Name><![CDATA[' . $status[1] . ']]></Name>';
        //output login status
        break;
    case "SaveCPURow":
        $status = $CPU->EditSaveRow($_REQUEST['CPU'], $_REQUEST['CPU_Link'], $_REQUEST['Price'], $_REQUEST['Core'], $_REQUEST['Speed'], $_REQUEST['Cache'], $_REQUEST['Processor'], $_REQUEST['Memory_CPU'], $_REQUEST['Max_Memory'], $_REQUEST['Memory_Type'], $_REQUEST['TDP'], $_REQUEST['BenchMark'], $_REQUEST['Date'], $_REQUEST['Dell_Link'], $_REQUEST['Benchmark_Link'], $_REQUEST['Color'], $_REQUEST['id'], $_REQUEST['Model'], $_REQUEST['Wholesale']);
        //
        echo '<status><![CDATA[' . $status[0] . ']]></status>';
        //output login status
        echo '<Name><![CDATA[' . $status[1] . ']]></Name>';
Esempio n. 3
0
 public function removeMachine()
 {
     $this->requireGet('hostname');
     $db = Database::getDatabase();
     $machine_id = $db->getValue('SELECT id FROM hw_cpus WHERE hostname = ' . $db->quote($_GET['hostname']) . ' AND user_id = ' . $this->user->id);
     if ($machine_id === false) {
         $this->error('machine does not exist');
     } else {
         $cpu = new CPU($machine_id);
         $cpu->delete();
         $db->query("DELETE FROM hw_services WHERE cpu_id = '{$cpu->id}'");
         $this->success();
     }
 }