]> git.joonet.de Git - adminer.git/commitdiff
Remove unsupported features in single driver version
authorJakub Vrana <jakub@vrana.cz>
Fri, 21 May 2010 13:42:17 +0000 (15:42 +0200)
committerJakub Vrana <jakub@vrana.cz>
Fri, 21 May 2010 13:42:17 +0000 (15:42 +0200)
adminer/create.inc.php
adminer/db.inc.php
compile.php

index 5bc501dea5240d86dd03c41ae805e3f981c766f5..101ac2abbcab503de9b8fa2aa654106782072180 100644 (file)
@@ -178,13 +178,15 @@ if (support("partitioning")) {
 <table cellspacing="0" id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>>
 <thead><tr><th><?php echo lang('Partition name'); ?><th><?php echo lang('Values'); ?></thead>
 <?php
-foreach ($row["partition_names"] as $key => $val) {
-       echo '<tr>';
-       echo '<td><input name="partition_names[]" value="' . h($val) . '"' . ($key == count($row["partition_names"]) - 1 ? ' onchange="partitionNameChange(this);"' : '') . '>';
-       echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">';
-}
-?>
+       foreach ($row["partition_names"] as $key => $val) {
+               echo '<tr>';
+               echo '<td><input name="partition_names[]" value="' . h($val) . '"' . ($key == count($row["partition_names"]) - 1 ? ' onchange="partitionNameChange(this);"' : '') . '>';
+               echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">';
+       }
+       ?>
 </table>
 </div></fieldset>
-<?php } ?>
+<?php
+}
+?>
 </form>
index 41fbc3bc5da45c304507678f360fd3add03e87ae..d0251637503aabf070996a3f9ea84533f1205adb 100644 (file)
@@ -33,7 +33,9 @@ if ($tables_views && !$error && !$_POST["search"]) {
 
 page_header(($_GET["ns"] == "" ? lang('Database') . ": " . h(DB) : lang('Schema') . ": " . h($_GET["ns"])), $error, true);
 echo '<p>' . ($_GET["ns"] == "" ? '<a href="' . h(ME) . 'database=">' . lang('Alter database') . "</a>\n" : "");
-echo (support("scheme") ? "<a href='" . h(ME) . "scheme='>" . ($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema')) . "</a>\n" : "");
+if (support("scheme")) {
+       echo "<a href='" . h(ME) . "scheme='>" . ($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema')) . "</a>\n";
+}
 if ($_GET["ns"] !== "") {
        echo '<a href="' . h(ME) . 'schema=">' . lang('Database schema') . "</a>\n";
        $sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
index 2c579faf45735b77c3424c84f2f7490b8c5ec62a..44a37f79b386a1cfa95216fa578606c389464efa 100644 (file)
@@ -207,6 +207,7 @@ foreach (glob(dirname(__FILE__) . "/adminer/drivers/" . ($driver ? $driver : "*"
 }
 
 include dirname(__FILE__) . "/adminer/include/pdo.inc.php";
+$features = array("view", "event", "privileges", "user", "processlist", "variables", "trigger", "scheme", "sequence");
 foreach (array("adminer", "editor") as $project) {
        $lang_ids = array(); // global variable simplifies usage in a callback function
        $file = file_get_contents(dirname(__FILE__) . "/$project/index.php");
@@ -214,7 +215,7 @@ foreach (array("adminer", "editor") as $project) {
                $connection = (object) array("server_info" => 5.1); // MySQL support is version specific
                $_GET[$driver] = true; // to load the driver
                include_once dirname(__FILE__) . "/adminer/drivers/$driver.inc.php";
-               foreach (array("view", "event", "privileges", "user", "processlist", "variables", "trigger", "scheme", "sequence") as $feature) {
+               foreach ($features as $feature) {
                        if (!support($feature)) {
                                $file = str_replace("} elseif (isset(\$_GET[\"$feature\"])) {\n\tinclude \"./$feature.inc.php\";\n", "", $file);
                        }
@@ -231,6 +232,13 @@ foreach (array("adminer", "editor") as $project) {
                $file = preg_replace('(include "../adminer/drivers/(?!' . preg_quote($driver) . ').*\\s*)', '', $file);
        }
        $file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file); // bootstrap.inc.php
+       if ($driver) {
+               foreach ($features as $feature) {
+                       if (!support($feature)) {
+                               $file = preg_replace("((\t*)" . preg_quote('if (support("' . $feature . '")') . ".*\n\\1\\})sU", '', $file);
+                       }
+               }
+       }
        $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
        $file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file);
        if ($_SESSION["lang"]) {