[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_4-5333-g90ce4c7

Marc Delisle lem9 at users.sourceforge.net
Thu Jul 8 14:29:37 CEST 2010


The branch, master has been updated
       via  90ce4c77b38f5e51b35fea23125df861ed3bd1cc (commit)
      from  c1be602a1edf316ce75234cdca36c4a60ba16aa3 (commit)


- Log -----------------------------------------------------------------
commit 90ce4c77b38f5e51b35fea23125df861ed3bd1cc
Author: Marc Delisle <marc at infomarc.info>
Date:   Thu Jul 8 08:29:27 2010 -0400

    clarify code

-----------------------------------------------------------------------

Summary of changes:
 db_structure.php              |   20 ++++++++++----------
 libraries/replication.inc.php |   15 +++++++++------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/db_structure.php b/db_structure.php
index 90b7824..e99cfa3 100644
--- a/db_structure.php
+++ b/db_structure.php
@@ -360,24 +360,24 @@ foreach ($tables as $keyname => $each_table) {
         ) {
             $do = true;
         }
-        foreach ($server_slave_Wild_Do_Table as $table) {
-            if (($db == PMA_replication_strout($table)) && (preg_match("@^" . substr(PMA_replication_strout($table, true), 0, strlen(PMA_replication_strout($table, true)) - 1) . "@", $truename)))
+        foreach ($server_slave_Wild_Do_Table as $db_table) {
+            $table_part = PMA_extract_db_or_table($db_table, 'table');
+            if (($db == PMA_extract_db_or_table($db_table, 'db')) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename))) {
                 $do = true;
+            }
         }
         ////////////////////////////////////////////////////////////////////
         if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0)  || (strlen(array_search($db, $server_slave_Ignore_DB)) > 0)) {
             $ignored = true;
         }
-        foreach ($server_slave_Wild_Ignore_Table as $table) {
-            if (($db == PMA_replication_strout($table)) && (preg_match("@^" . substr(PMA_replication_strout($table, true), 0, strlen(PMA_replication_strout($table, true)) - 1) . "@", $truename)))
+        foreach ($server_slave_Wild_Ignore_Table as $db_table) {
+            $table_part = PMA_extract_db_or_table($db_table, 'table');
+            if (($db == PMA_extract_db_or_table($db_table)) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename))) {
                 $ignored = true;
+            }
         }
-    }/* elseif ($server_master_status) {
-        if ((strlen(array_search($db, $server_master_Do_DB))>0) || count($server_master_Do_DB)==1)
-            $do = true;
-        elseif ((strlen(array_search($db, $server_master_Ignore_DB))>0) || count($server_master_Ignore_DB)==1)
-            $ignored = true;
-    }*/
+        unset($table_part);
+    }
     ?>
 <tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
     <td align="center">
diff --git a/libraries/replication.inc.php b/libraries/replication.inc.php
index f2681a6..7b8ca0a 100644
--- a/libraries/replication.inc.php
+++ b/libraries/replication.inc.php
@@ -116,14 +116,17 @@ foreach ($replication_types as $type) {
 
 
 /**
- * @param $string - 
- * @param $table - 
- * @return 
+ * @param $string contains "dbname.tablename"
+ * @param $what   what to extract (db|table)
+ * @return $string the extracted part
  */
-function PMA_replication_strout($string, $table = false) {
+function PMA_extract_db_or_table($string, $what = 'db') {
     $list = explode(".", $string);
-
-    return $list[(int)$table];
+    if ('db' == $what) {
+        return $list[0];
+    } else {
+        return $list[1];
+    }
 }
 /**
  * @param String $action - possible values: START or STOP


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list