]> git.joonet.de Git - adminer.git/commitdiff
Add more system tables help links
authorJakub Vrana <jakub@vrana.cz>
Thu, 8 Feb 2018 10:21:33 +0000 (11:21 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 8 Feb 2018 10:21:33 +0000 (11:21 +0100)
adminer/drivers/mysql.inc.php
adminer/drivers/pgsql.inc.php
adminer/drivers/sqlite.inc.php
adminer/include/adminer.inc.php
adminer/include/driver.inc.php
adminer/include/editing.inc.php
changes.txt

index 01ca386d2afa33af6291846dcd4eea9ab72fbe42..6eadf94e3fc21fd323a67b32d8a6b22e70f6e901 100644 (file)
@@ -314,6 +314,15 @@ if (!defined("DRIVER")) {
                        }
                }
 
+               function tableHelp($name) {
+                       if (information_schema(DB)) {
+                               return strtolower(str_replace("_", "-", $name)) . "-table.html";
+                       }
+                       if (DB == "mysql") {
+                               return "system-database.html"; //! more precise link
+                       }
+               }
+
        }
 
 
index b27a7aee2e2ed4b2fbe526ae729372131673ef2b..8b32fbf3d763b001af0e7edcafe8ca795415c557 100644 (file)
@@ -216,6 +216,17 @@ if (isset($_GET["pgsql"])) {
                        return $this->_conn->warnings();
                }
 
+               function tableHelp($name) {
+                       $links = array(
+                               "information_schema" => "infoschema",
+                               "pg_catalog" => "catalog",
+                       );
+                       $link = $links[$_GET["ns"]];
+                       if ($link) {
+                               return "$link-" . str_replace("_", "-", $name) . ".html";
+                       }
+               }
+
        }
 
 
index af4f2beb7bb7b52b2f9929a2aa8cf4aa07cb0a44..b34511e58c19902dde404b5087012d16457ce534 100644 (file)
@@ -218,6 +218,15 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
                        return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys(reset($rows))) . ") VALUES\n" . implode(",\n", $values));
                }
 
+               function tableHelp($name) {
+                       if ($name == "sqlite_sequence") {
+                               return "fileformat2.html#seqtab";
+                       }
+                       if ($name == "sqlite_master") {
+                               return "fileformat2.html#$name";
+                       }
+               }
+
        }
 
 
index f05b3cbb695cf4dff0e3e1b37889f2e481e970a2..325b348438556966c59cea0c0495de668852a945 100644 (file)
@@ -160,6 +160,7 @@ class Adminer {
        * @return null
        */
        function selectLinks($tableStatus, $set = "") {
+               global $jush, $driver;
                echo '<p class="links">';
                $links = array("select" => lang('Select data'));
                if (support("table") || support("indexes")) {
@@ -175,9 +176,11 @@ class Adminer {
                if ($set !== null) {
                        $links["edit"] = lang('New item');
                }
+               $name = $tableStatus["Name"];
                foreach ($links as $key => $val) {
-                       echo " <a href='" . h(ME) . "$key=" . urlencode($tableStatus["Name"]) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
+                       echo " <a href='" . h(ME) . "$key=" . urlencode($name) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
                }
+               echo doc_link(array($jush => $driver->tableHelp($name)), "?");
                echo "\n";
        }
 
index 1a4e86ea8caef37eb7999443bc0778e19a3afb5a..da332b26987a068c0a78f7375ec6e52115ba9c6f 100644 (file)
                return '';
        }
        
+       /** Get help link for table
+       * @param string
+       * @return string relative URL or null
+       */
+       function tableHelp($name) {
+       }
+       
 }
index a16bb41d417676152c36b897e89626888b8f3299..4a4e0bcb46a99d82d06af86e1601d41501540994 100644 (file)
@@ -483,9 +483,10 @@ function ini_bytes($ini) {
 
 /** Create link to database documentation
 * @param array $jush => $path
+* @param string HTML code
 * @return string HTML code
 */
-function doc_link($paths) {
+function doc_link($paths, $text = "<sup>?</sup>") {
        global $jush, $connection;
        $version = preg_replace('~^(\\d\\.?\\d).*~s', '\\1', $connection->server_info);
        $urls = array(
@@ -495,7 +496,7 @@ function doc_link($paths) {
                'mssql' => "https://msdn.microsoft.com/library/",
                'oracle' => "https://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",
        );
-       return ($paths[$jush] ? "<a href='$urls[$jush]$paths[$jush]'" . target_blank() . "><sup>?</sup></a>" : "");
+       return ($paths[$jush] ? "<a href='$urls[$jush]$paths[$jush]'" . target_blank() . ">$text</a>" : "");
 }
 
 /** Wrap gzencode() for usage in ob_start()
index 85ab585d9fb378ee1c0ad3bdfc2ab359f05f9500..48849cea599dc8e001a074de9694cfef29672273 100644 (file)
@@ -1,6 +1,7 @@
 Adminer 4.6.1-dev:
 Speed up rendering of long tables (regression from 4.4.0)
 Sticky position of table actions
+Add system tables help links
 MySQL: Support non-utf8 charset in search in column
 MySQL: Support geometry in MySQL 8 (bug #574)
 SQLite: Allow deleting PRIMARY KEY from tables with auto increment