Пример #1
0
$stat_sensors += dbFetchCell('SELECT COUNT(*) FROM `status`');
$stat_printersupplies = dbFetchCell('SELECT COUNT(*) FROM `printersupplies`');
$stat_hrdev = dbFetchCell('SELECT COUNT(*) FROM `hrDevice`');
$stat_entphys = dbFetchCell('SELECT COUNT(*) FROM `entPhysical`');
$stat_ipv4_addy = dbFetchCell('SELECT COUNT(*) FROM `ipv4_addresses`');
$stat_ipv4_nets = dbFetchCell('SELECT COUNT(*) FROM `ipv4_networks`');
$stat_ipv6_addy = dbFetchCell('SELECT COUNT(*) FROM `ipv6_addresses`');
$stat_ipv6_nets = dbFetchCell('SELECT COUNT(*) FROM `ipv6_networks`');
$stat_pw = dbFetchCell('SELECT COUNT(*) FROM `pseudowires`');
$stat_vrf = dbFetchCell('SELECT COUNT(*) FROM `vrfs`');
$stat_vlans = dbFetchCell('SELECT COUNT(*) FROM `vlans`');
$stat_ns_vsvrs = dbFetchCell('SELECT COUNT(*) FROM `netscaler_vservers`');
$stat_ns_svcs = dbFetchCell('SELECT COUNT(*) FROM `netscaler_services`');
$stat_vms = dbFetchCell('SELECT COUNT(*) FROM `vminfo`');
$stat_ip_sla = dbFetchCell('SELECT COUNT(*) FROM `slas`');
$stat_db = get_db_size();
$stat_rrd = get_dir_size($config['rrd_dir']);
?>
      <table class="table table-striped table-condensed">
        <tbody>
          <tr>
            <td style="width: 45%;"><i class="oicon-database"></i> <strong>DB size</strong></td><td><span class="pull-right"><?php 
echo formatStorage($stat_db);
?>
</span></td>
            <td style="width: 45%;"><i class="oicon-box-zipper"></i> <strong>RRD size</strong></td><td><span class="pull-right"><?php 
echo formatStorage($stat_rrd);
?>
</span></td>
          </tr>
          <tr>
Пример #2
0
    $sqlListCourses = "\n                       SELECT administrativeNumber AS code,\n                              directory            AS dir,\n                              dbName               AS db,\n                              diskQuota\n                         FROM `" . $tbl_course . "` ";
    if ($coursesToCheck[0] == " all ") {
        $sqlListCourses .= " order by dbName";
    } elseif (is_array($coursesToCheck)) {
        $sqlListCourses .= " where code in ('" . implode("','", $coursesToCheck) . "') order by dbName";
    } else {
        unset($sqlListCourses);
    }
    if (isset($sqlListCourses)) {
        $resCourses = claro_sql_query($sqlListCourses);
        while ($course = mysql_fetch_array($resCourses, MYSQL_ASSOC)) {
            $duFiles = disk_usage(get_path('coursesRepositorySys') . $course['dir'] . '/', '', 'k');
            if (get_conf('singleDbEnabled') == TRUE) {
                $duBase = null;
            } else {
                $duBase = get_db_size($course['db'], 'k');
            }
            $duTotal = disk_usage(get_path('coursesRepositorySys') . $course['dir'] . '/', get_path('coursesRepositorySys') . $course['db'] . '/', 'm');
            $out .= '<p>' . get_path('coursesRepositorySys') . $course['dir'] . '/' . ' = ' . '<pre>' . var_export(get_path('coursesRepositorySys') . $course['dir'] . '/', 1) . '</pre>';
            $quota = $course['diskQuota'] * 1;
            $out .= '<li>' . $course['code'] . ' : ' . (is_null($course['diskQuota']) ? ' ' . get_lang('No quota') . ' ' : get_lang('Quota') . ' : ' . $course['diskQuota']) . ' ' . $byteUnits[2] . ' | ' . sprintf("%01.2f", $duFiles) . ' ' . $byteUnits[1] . ' + ' . sprintf('%01.2f', $duBase) . ' ' . $byteUnits[1] . ' = <strong>' . sprintf('%01.2f', $duTotal) . ' ' . $byteUnits[2] . '</strong>' . (is_null($course['diskQuota']) || $quota > (int) $duTotal ? ' ok ' : ' <font color="#FF0000">!!!!!!!! ' . get_lang('OVER QUOTA') . ' !!!!!!</font>') . '</li>';
        }
    }
    $out .= '</ol>';
}
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
function fetchtCourseList()
{
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $sqlListCoursesSel = "\n        SELECT administrativeNumber AS officialCode,\n               code                 AS sysCode\n          FROM `" . $tbl_mdb_names['course'] . "`\n      ORDER BY trim(administrativeNumber) ASC\n      ";
Пример #3
0
 function execute($par)
 {
     // Get database size function
     function get_db_size()
     {
         global $wgRequest, $wgDBname;
         $dbw =& wfGetDB(DB_MASTER);
         $mw_dbname = $dbw->buildLike($wgDBname);
         $dbsize = $dbw->query("select table_schema " . $mw_dbname . ", sum( data_length + index_length ) / 1024 / 1024 'DB sze in MB' from information_schema.TABLES where TABLE_SCHEMA " . $mw_dbname . " GROUP BY table_schema ;");
         while ($row = $dbw->fetchRow($dbsize)) {
             $size = $row[1];
         }
         return $size;
     }
     // Get tables engine and collation
     function get_engine_col($table_name)
     {
         global $wgRequest, $wgDBname;
         $dbw =& wfGetDB(DB_MASTER);
         $engine_collation = $dbw->query("select ENGINE,TABLE_COLLATION from information_schema.TABLES where TABLE_SCHEMA = '" . $wgDBname . "' and TABLE_NAME = '" . $table_name . "';");
         while ($row = $dbw->fetchRow($engine_collation)) {
             $engine = $row[0];
             $collation = $row[1];
         }
         return array('engine' => $engine, 'collation' => $collation);
     }
     // Load required globals
     global $wgRequest, $wgOut, $wgUser, $wgDBname, $wgVersion;
     $this->setHeaders();
     // Check if user is Admin
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         return;
     }
     // $dbw =& wfGetDB( DB_MASTER );    //commented by Eli caused an error: <b>Strict Standards</b>:  Only variables should be assigned by reference
     $dbw = wfGetDB(DB_MASTER);
     //added by Eli, removed the error message
     // Get request data from, e.g.
     $param = $wgRequest->getText('param');
     // Localisation messages
     $check_only = wfMsg('check_only');
     $del_hist = wfMsg('del_hist');
     $del_hist_opt = wfMsg('del_hist_opt');
     // Escaping URI
     $current_uri = htmlentities($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8');
     // User choice
     $wgOut->addWikiText(wfMsg('what_to_do') . ' :');
     $wgOut->addHTML("<form action=\"{$current_uri}\" method=\"post\">\n            <input type=\"radio\" name=\"choice\" value=\"0\" checked>{$check_only}<br />\n            <input type=\"radio\" name=\"choice\" value=\"1\">{$del_hist}<br />\n            <input type=\"radio\" name=\"choice\" value=\"2\">{$del_hist_opt} (MySQL)<br /><br />\n            <input type=\"submit\" value=\"" . wfMsg('validate') . "\">\n            </form>\n            ");
     // Choosen action choice
     $show_db_size = 0;
     $pwd = getcwd();
     $command = 'php ' . $pwd . '/maintenance/deleteOldRevisions.php --delete';
     if (isset($_POST['choice']) and $_POST['choice'] == "0") {
         $command = 'php ' . $pwd . '/maintenance/deleteOldRevisions.php';
         $out_logs = shell_exec(escapeshellcmd($command));
     } elseif (isset($_POST['choice']) and $_POST['choice'] == "1") {
         $out_logs = shell_exec(escapeshellcmd($command));
     } elseif (isset($_POST['choice']) and $_POST['choice'] == "2") {
         $show_db_size = 1;
         // Change deprecated function
         if ($wgVersion >= 1.18) {
             $dbw->begin();
         } else {
             $dbw->immediateBegin();
         }
         // Get actual database size
         $db_size_old = get_db_size();
         // Delete old history
         $out_logs = shell_exec(escapeshellcmd($command));
         // Get all tables
         $alltables = $dbw->query("SHOW TABLES");
         // Show optimize status
         $out_opt = "<table border=1 style='border-style: double;'>\n                <tr>\n                <th>Tables Names</th>\n                <th>Engine</th>\n                <th>Collation</th>\n                <th>Status</th>\n                </tr>\n                ";
         while ($row = $dbw->fetchRow($alltables)) {
             // Run and show output
             $out_opt .= "<tr>\n<td>";
             // Database name
             $out_opt .= $row[0] . "&nbsp;</td>\n<td>";
             // Get engine and collation
             extract(get_engine_col($row[0]));
             $out_opt .= $engine . "&nbsp;</td>\n<td>";
             $out_opt .= $collation . "&nbsp;</td>\n<td>";
             // Optimize
             $opt_res = $dbw->query("OPTIMIZE TABLE {$row[0]};");
             while ($res = $dbw->fetchRow($opt_res)) {
                 // Set green color on OK and if table is already up to date
                 if (preg_match("/OK/i", $res[3])) {
                     $out_opt .= '<span style="font-weight: bold; color: green"> ' . $res[3] . '&nbsp;</span>';
                 } elseif (preg_match("/Table is already up to date/i", $res[3])) {
                     $out_opt .= '<span style="color: green">' . $res[3] . '&nbsp;</span>';
                 } else {
                     $out_opt .= $res[3] . '&nbsp;';
                 }
             }
         }
         $out_opt .= "</table>";
         // Get size after
         $db_size_new = get_db_size();
     }
     // Fix display pre problem
     if (isset($_POST['choice']) and $_POST['choice'] != "") {
         $wgOut->addHTML("<br />");
         $wgOut->addWikiText('=' . wfMsg('result') . '=');
         // Show DB size if ask to optimize
         if ($show_db_size == 1) {
             function kb_or_mb($db_size_old, $db_size_new)
             {
                 $spacewon = $db_size_old - $db_size_new;
                 if ($spacewon < 1) {
                     $spacewon = $spacewon * 1024 . " KB";
                 } else {
                     $spacewon = $spacewon . " MB";
                 }
                 return $spacewon;
             }
             // Show result
             $wgOut->addHTML("<table border=1'>\n                    <tr>\n                    <td></td>\n                    <th>" . wfMsg('size') . "</th>\n                    </tr><tr>\n                    <th>" . wfMsg('db_size_old') . "</th>\n                    <td>{$db_size_old} MB</td>\n                    </tr><tr>\n                    <th>" . wfMsg('db_size_new') . "</th>\n                    <td>{$db_size_new} MB</td>\n                    </tr><tr>\n                    <th>" . wfMsg('db_space_won') . "</th>\n                    <td align='center'><b>" . kb_or_mb($db_size_old, $db_size_new) . "</b></td>\n                    </tr></table><br />\n                    ");
         }
         if (isset($out_opt)) {
             if ($out_opt) {
                 $wgOut->addWikiText('=' . wfMsg('opt_stat') . '=');
                 $wgOut->addHTML($out_opt . '<br />');
             }
         }
         if ($out_logs) {
             if ($_POST['choice'] == "2") {
                 $wgOut->addWikiText('=' . wfMsg('logs') . '=');
             }
             $wgOut->addHTML("<pre>" . $out_logs . "</pre>");
         }
     }
     return true;
 }
Пример #4
0
}
if (!defined('SUB_PAGE')) {
    define('SUB_PAGE', 'Reports &amp; Stats');
}
$vid_dir = get_directory_size(VIDEOS_DIR);
$thumb_dir = get_directory_size(THUMBS_DIR);
$orig_dir = get_directory_size(ORIGINAL_DIR);
$user_thumbs = get_directory_size(USER_THUMBS_DIR);
$user_bg = get_directory_size(USER_BG_DIR);
$grp_thumbs = get_directory_size(GP_THUMB_DIR);
$cat_thumbs = get_directory_size(CAT_THUMB_DIR);
assign('vid_dir', $vid_dir);
assign('thumb_dir', $thumb_dir);
assign('orig_dir', $orig_dir);
assign('user_thumbs', $user_thumbs);
assign('user_bg', $user_bg);
assign('grp_thumbs', $grp_thumbs);
assign('cat_thumbs', $cat_thumbs);
if (!defined('MAIN_PAGE')) {
    define('MAIN_PAGE', 'Stats And Configurations');
}
if (!defined('SUB_PAGE')) {
    if ($_GET['view'] == 'search') {
        define('SUB_PAGE', 'Search Members');
    } else {
        define('SUB_PAGE', 'Reports & Stats');
    }
}
assign('db_size', formatfilesize(get_db_size()));
template_files('reports.html');
display_it();
Пример #5
0
$version_query = xtc_db_query("SELECT version FROM " . TABLE_DATABASE_VERSION);
$version_array = xtc_db_fetch_array($version_query);
if (substr($version_array['version'], 0, 3) == 'SH_') {
    $db_version_update = 'update_' . substr($version_array['version'], 3);
    if ($version_array['version'] == "SH_1.0.0") {
        $db_version_update = '';
        $version_array['version'] = 'Shophelfer 1.0.0';
    }
} elseif (substr($version_array['version'], 0, 4) == 'MOD_') {
    $db_version_update = '';
    $version_array['version'] = 'modified eCommerce';
} else {
    $db_version_update = '';
    $version_array['version'] = 'unbekannt';
}
$initialDBSize = get_db_size();
// get all SQL update_files
$pfad = './sql/';
$ordner = opendir($pfad);
while ($datei = readdir($ordner)) {
    if (preg_match('/^update_[0-9].[0-9].[0-9]/i', $datei)) {
        //accept only sql files that start(!) with scheme "update_x.x.x.x"
        $farray[] = $pfad . $datei;
    }
}
closedir($ordner);
sort($farray);
//DB seems to be an old xtCommerce installation, so include XTCOMMERCE304_FILE here
if ($db_version_update == '') {
    unset($farray);
    $farray = array();