]> git.joonet.de Git - adminer.git/commitdiff
CockroachDB: Do not use version number when linking docs
authorJakub Vrana <jakub@vrana.cz>
Wed, 19 Mar 2025 05:14:02 +0000 (06:14 +0100)
committerJakub Vrana <jakub@vrana.cz>
Wed, 19 Mar 2025 05:49:48 +0000 (06:49 +0100)
adminer/include/adminer.inc.php
adminer/include/editing.inc.php
adminer/static/editing.js

index 55177ad89b48b996cd8fbcc1aa033401e867e4cb..e9c3c0f4d940c7e26e3e5c53191fe92711df45d3 100644 (file)
@@ -1066,7 +1066,9 @@ class Adminer {
                        }
                        echo "</script>\n";
                }
-               echo script("bodyLoad('" . (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '\1', $connection->server_info) : "") . "'" . ($connection->maria ? ", true" : "") . ");");
+               echo script("syntaxHighlighting('" . (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '\1', $connection->server_info) : "") . "'"
+                       . ($connection->maria ? ", 'maria'" : ($connection->cockroach ? ", 'cockroach'" : "")) . ");"
+               );
        }
 
        /** Prints databases list in menu
index 7412325be1eeb7b59c5541939da77b2ef2290a58..ebdfb75761bbdba3919070a0aee6bb0070a758fa 100644 (file)
@@ -596,7 +596,7 @@ function doc_link($paths, $text = "<sup>?</sup>") {
        $urls = array(
                'sql' => "https://dev.mysql.com/doc/refman/$version/en/",
                'sqlite' => "https://www.sqlite.org/",
-               'pgsql' => "https://www.postgresql.org/docs/$version/",
+               'pgsql' => "https://www.postgresql.org/docs/" . ($connection->cockroach ? "current" : $version) . "/",
                'mssql' => "https://learn.microsoft.com/en-us/sql/",
                'oracle' => "https://www.oracle.com/pls/topic/lookup?ctx=db" . preg_replace('~^.* (\d+)\.(\d+)\.\d+\.\d+\.\d+.*~s', '\1\2', $server_info) . "&id=",
        );
index ab895cf9775150306aaeef27194b5166a75d2cd5..8e09c7ca63974551ba5a3748df2e631139824283 100644 (file)
@@ -2,9 +2,9 @@
 
 /** Load syntax highlighting
 * @param string first three characters of database system version
-* @param [boolean]
+* @param [string]
 */
-function bodyLoad(version, maria) {
+function syntaxHighlighting(version, vendor) {
        if (window.jush) {
                jush.create_links = ' target="_blank" rel="noreferrer noopener"';
                if (version) {
@@ -13,7 +13,7 @@ function bodyLoad(version, maria) {
                                if (typeof obj[key] != 'string') {
                                        obj = obj[key];
                                        key = 0;
-                                       if (maria) {
+                                       if (vendor == 'maria') {
                                                for (var i = 1; i < obj.length; i++) {
                                                        obj[i] = obj[i]
                                                                .replace('.html', '/')
@@ -29,10 +29,12 @@ function bodyLoad(version, maria) {
                                        }
                                }
 
-                               obj[key] = (maria ? obj[key].replace('dev.mysql.com/doc/mysql', 'mariadb.com/kb') : obj[key]) // MariaDB
+                               obj[key] = (vendor == 'maria' ? obj[key].replace('dev.mysql.com/doc/mysql', 'mariadb.com/kb') : obj[key]) // MariaDB
                                        .replace('/doc/mysql', '/doc/refman/' + version) // MySQL
-                                       .replace('/docs/current', '/docs/' + version) // PostgreSQL
                                ;
+                               if (vendor != 'cockroach') {
+                                       obj[key] = obj[key].replace('/docs/current', '/docs/' + version); // PostgreSQL
+                               }
                        }
                }
                if (window.jushLinks) {