Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit.

  • Loading branch information...
commit eb1632d11f8bad8f14b85a395c963ad857a11151 1 parent 0ec53f5
rWatcher authored talmdal committed
View
36 modules/database_info/helpers/database_info_block.php
@@ -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
3  modules/database_info/module.info
@@ -0,0 +1,3 @@
+name = "Database Info"
+description = "View information about your Gallery 3 database on the admin dashboard."
+version = 1
View
18 modules/database_info/views/admin_block_db.html.php
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.