Пример #1
0
function getDevModel($device)
{
    $arrDiskInfo = getBlockDevices(false, true);
    if (!is_array($arrDiskInfo)) {
        return false;
    }
    //
    if (!isset($arrDiskInfo[$device]['info'])) {
        return false;
    }
    //
    return $arrDiskInfo[$device]['info'];
}
Пример #2
0
$_SESSION['diskedit']['token'] = uniqid(md5(microtime()), true);
require 'guiconfig.inc';
require_once 'util.inc';
require_once 'blockdevices.lib.php';
require_once 'libs-php/htmltable.class.php';
// define some constants referenced in fbegin.inc
define('INCLUDE_TBLSTYLE', true);
// actual configuration reference
$cfgPtr =& $config['system']['storage'];
// retrieve informations about system block devices
$forceDevRefresh = false;
if (isset($_SESSION['refresh']['blockdevice'])) {
    $forceDevRefresh = true;
    unset($_SESSION['refresh']['blockdevice']);
}
$disksInfo = getBlockDevices($forceDevRefresh);
getDiskUsage($disksInfo);
$_SESSION['diskedit']['info'] = $disksInfo;
//
// init a table object
$tblStorage = new htmlTable('id=table01|class=report');
// fill the table caption
$tblStorage->caption(_('Configured storage'));
// table section heading
$tblStorage->thead();
$tblStorage->tr();
$tblStorage->th(_('Device name'), 'class=colheader');
$tblStorage->th(_('Label'), 'class=colheader');
$tblStorage->th(_('Mount Point'), 'class=colheader');
$tblStorage->th(_('Free'), 'class=colheader');
$tblStorage->th(_('Used'), 'class=colheader');
Пример #3
0
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
/* parse the configuration and include all functions used below */
require_once "config.inc";
require_once "functions.inc";
require_once 'console.msg.inc';
require_once 'blockdevices.lib.php';
$rin = fopen('php://stdin', 'r');
$rout = fopen('php://stdout', 'w');
$disks = getBlockDevices();
echo "\n", 'Valid disks are:', "\n\n";
foreach (array_keys($disks) as $descriptor) {
    // skip removable devices
    if ($disks[$descriptor]['removable']) {
        continue;
    }
    // show anything else
    echo ' ', basename($descriptor), ' -> ', $disks[$descriptor]['info'], ' (', $disks[$descriptor]['sizelabel'], ')', PHP_EOL;
    //
}
do {
    fwrite($rout, "\nEnter the device name you wish to install onto: ");
    $target_disk = chop(fgets($rin));
    if ($target_disk === '') {
        exit(0);
Пример #4
0
    $memReport = _('Free') . ': ' . formatBytes($memStatus['free']) . ' ';
    $memReport .= _('Used') . ': ' . formatBytes($memStatus['used']) . ' ';
    $memReport .= _('Total') . ': ' . formatBytes($memStatus['total']);
    $memReport .= getAnalogBar($memStatus);
} else {
    $memReport = _('Unable to get data.');
}
$tbl->tr();
$tbl->td(_('Memory Usage'), 'class=tblrowlabel');
$tbl->td($memReport);
//
unset($memStatus, $memReport);
// storage status
if (isset($config['system']['storage']['fsmounts'])) {
    if (is_array($config['system']['storage']['fsmounts'])) {
        $disksInfo = getBlockDevices(true);
        getDiskUsage($disksInfo);
        $storageReport = '';
        foreach (array_keys($config['system']['storage']['fsmounts']) as $mntNode) {
            if (!is_array($config['system']['storage']['fsmounts'][$mntNode])) {
                continue;
            }
            //
            if ($config['system']['storage']['fsmounts'][$mntNode]['active'] != 1) {
                // disabled entry, only report active devices status
                continue;
            }
            // TODO: also report alerts about disks autodisabled at boot time because of errors
            //
            $fsUuid = $config['system']['storage']['fsmounts'][$mntNode]['uuid'];
            $fsInfo = getDevByUuid($disksInfo, $fsUuid);