Commit c6861033 authored by XS - TeamIndia's avatar XS - TeamIndia

Added Dmidecode libraries

parent 0365f4c1
Pipeline #77173301 passed with stages
in 11 minutes and 48 seconds
......@@ -5,7 +5,7 @@
/////////////////////////////////////////////////////////////////////////////
$app['basename'] = 'base';
$app['version'] = '2.7.4';
$app['version'] = '2.7.5';
$app['vendor'] = 'ClearFoundation';
$app['packager'] = 'ClearFoundation';
$app['license'] = 'GPLv3';
......
<?php
/**
* dmidecode class.
*
* @category apps
* @package base
* @subpackage libraries
* @author ClearFoundation <developer@clearfoundation.com>
* @copyright 2003-2019 ClearFoundation
* @license http://www.gnu.org/copyleft/lgpl.html GNU Lesser General Public License version 3 or later
* @link http://www.clearfoundation.com/docs/developer/apps/base/
*/
///////////////////////////////////////////////////////////////////////////////
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// N A M E S P A C E
///////////////////////////////////////////////////////////////////////////////
namespace clearos\apps\base;
///////////////////////////////////////////////////////////////////////////////
// B O O T S T R A P
///////////////////////////////////////////////////////////////////////////////
$bootstrap = getenv('CLEAROS_BOOTSTRAP') ? getenv('CLEAROS_BOOTSTRAP') : '/usr/clearos/framework/shared';
require_once $bootstrap . '/bootstrap.php';
///////////////////////////////////////////////////////////////////////////////
// T R A N S L A T I O N S
///////////////////////////////////////////////////////////////////////////////
clearos_load_language('base');
///////////////////////////////////////////////////////////////////////////////
// D E P E N D E N C I E S
///////////////////////////////////////////////////////////////////////////////
use \clearos\apps\base\Engine as Engine;
use \clearos\apps\base\File as File;
use \clearos\apps\base\File_No_Match_Exception as File_No_Match_Exception;
use \clearos\apps\base\File_Not_Found_Exception as File_Not_Found_Exception;
use \clearos\apps\base\Shell as Shell;
clearos_load_library('base/Engine');
clearos_load_library('base/File');
clearos_load_library('base/File_No_Match_Exception');
clearos_load_library('base/File_Not_Found_Exception');
clearos_load_library('base/Shell');
///////////////////////////////////////////////////////////////////////////////
// C L A S S
///////////////////////////////////////////////////////////////////////////////
/**
* Dmidecode class.
*
* @category apps
* @package base
* @subpackage libraries
* @author ClearFoundation <developer@clearfoundation.com>
* @copyright 2003-2019 ClearFoundation
* @license http://www.gnu.org/copyleft/lgpl.html GNU Lesser General Public License version 3 or later
* @link http://www.clearfoundation.com/docs/developer/apps/base/
*/
class Dmidecode extends Engine
{
///////////////////////////////////////////////////////////////////////////////
// C O N S T A N T S
///////////////////////////////////////////////////////////////////////////////
const COMMAND_DMIDECODE = '/usr/sbin/dmidecode';
///////////////////////////////////////////////////////////////////////////////
// M E T H O D S
///////////////////////////////////////////////////////////////////////////////
/**
* System constructor.
*/
public function __construct()
{
clearos_profile(__METHOD__, __LINE__);
}
/**
* Get system product name
*
* @return string system product name
* @throws Engine_Exception
*/
public function get_system_product_name()
{
clearos_profile(__METHOD__, __LINE__);
$options['validate_exit_code'] = FALSE;
$shell = new Shell();
$shell->execute(self::COMMAND_DMIDECODE, '-s system-product-name', TRUE, $options);
$output = $shell->get_output();
return $output[0];
}
/**
* Get system manufacturer name
*
* @return string system manufacturer name
* @throws Engine_Exception
*/
public function get_system_manufacturer_name()
{
clearos_profile(__METHOD__, __LINE__);
$options['validate_exit_code'] = FALSE;
$shell = new Shell();
$shell->execute(self::COMMAND_DMIDECODE, '-s system-manufacturer', TRUE, $options);
$output = $shell->get_output();
return $output[0];
}
/**
* Is system product name Gen10
*
* @return boolean TRUE and FALSE if the system product name Gen10
* @throws Engine_Exception
*/
public function is_product_microserver_gen10()
{
clearos_profile(__METHOD__, __LINE__);
//get system product name
//.......................
$system = $this->get_system_product_name();
if (preg_match('/MicroServer Gen10/', $system)) {
return TRUE;
} else {
return FALSE;
}
}
}
Name: app-base
Epoch: 1
Version: 2.7.4
Version: 2.7.5
Release: 1%{dist}
Summary: General Settings
License: GPLv3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment