1
0

Initial commit.

This commit is contained in:
rWatcher 2010-04-02 09:32:23 +08:00 committed by Tim Almdal
parent 0ec53f5234
commit eb1632d11f
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class database_info_block_Core {
static function get_admin_list() {
return array("database_info" => t("Database info"));
}
static function get($block_id) {
$block = new Block();
switch ($block_id) {
case "database_info":
$block->css_id = "g-database-info";
$block->title = t("Database information");
$block->content = new View("admin_block_db.html");
break;
}
return $block;
}
}

View File

@ -0,0 +1,3 @@
name = "Database Info"
description = "View information about your Gallery 3 database on the admin dashboard."
version = 1

View File

@ -0,0 +1,18 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?
$db = Database::instance();
$tables = $db->query("SHOW TABLE STATUS");
$database_size = 0;
foreach($tables as $table) {
$database_size += ($table->Data_length + $table->Index_length);
}
$database_size = $database_size / 1024 / 1024;
?>
<ul>
<li>
<?= t("Database size: %dbsize MB", array("dbsize" => number_format($database_size, 2))) ?>
</li>
<li>
<?= t("Number of tables: %dbtables", array("dbtables" => count($tables))) ?>
</li>
</ul>