[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5-6111-gc1bf813

Marc Delisle lem9 at users.sourceforge.net
Thu Jul 29 16:06:54 CEST 2010


The branch, master has been updated
       via  c1bf8133cd5c0d0da463f11e25b9c84eb4bede38 (commit)
       via  92a54bc0e2aadb3e123cfeb4f1f995e11b22df99 (commit)
       via  279a8f8f21dfdd595e05fe8cc570caf723b18445 (commit)
      from  09fd3ecc33d602c2ebdaea63b2f3df3ee8c979b1 (commit)


- Log -----------------------------------------------------------------
commit c1bf8133cd5c0d0da463f11e25b9c84eb4bede38
Author: Barry Leslie <barry_leslie at users.sourceforge.net>
Date:   Wed Jul 28 12:24:41 2010 -0700

    fixed pbms_connection_pool_size problem

commit 92a54bc0e2aadb3e123cfeb4f1f995e11b22df99
Author: Barry Leslie <barry_leslie at users.sourceforge.net>
Date:   Fri Jul 23 09:07:31 2010 -0700

    Check for pbms functions.

commit 279a8f8f21dfdd595e05fe8cc570caf723b18445
Author: Barry Leslie <barry_leslie at users.sourceforge.net>
Date:   Fri Jul 23 08:06:24 2010 -0700

    The use of PBMS is not dependent on a primary key

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

Summary of changes:
 libraries/blobstreaming.lib.php |   70 +++++++++++++++++++++------------------
 tbl_replace.php                 |    6 +---
 2 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/libraries/blobstreaming.lib.php b/libraries/blobstreaming.lib.php
index 17a05e0..f0f74c8 100644
--- a/libraries/blobstreaming.lib.php
+++ b/libraries/blobstreaming.lib.php
@@ -121,6 +121,35 @@ function checkBLOBStreamingPlugins()
             return FALSE;
         } // end if (count($bs_variables) <= 0)
 
+        // Check that the required pbms functions exist:
+        if ((function_exists("pbms_connect") == FALSE) ||
+            (function_exists("pbms_error") == FALSE) ||
+            (function_exists("pbms_close") == FALSE) ||
+            (function_exists("pbms_is_blob_reference") == FALSE) ||
+            (function_exists("pbms_get_info") == FALSE) ||
+            (function_exists("pbms_get_metadata_value") == FALSE) ||
+            (function_exists("pbms_add_metadata") == FALSE) ||
+            (function_exists("pbms_read_stream") == FALSE)) {
+
+            // We should probably notify the user that they need to install
+            // the pbms client lib and PHP extension to make use of blob streaming.
+            $PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', FALSE);
+            PMA_cacheSet('skip_blobstreaming', true, true);
+            return FALSE;
+        }
+
+        if (function_exists("pbms_connection_pool_size")) {
+            if ( isset($PMA_Config->settings['pbms_connection_pool_size'])) {
+                $pool_size = $PMA_Config->settings['pbms_connection_pool_size'];
+                if ($pool_size == "")
+                    $pool_size = 1;
+             } else {
+                $pool_size = 1;
+           }
+               
+           pbms_connection_pool_size($pool_size);
+        }
+
          // get BS server port
         $BS_PORT = $bs_variables['pbms_port'];
 
@@ -151,7 +180,7 @@ function checkBLOBStreamingPlugins()
         $PMA_Config->set('BLOBSTREAMING_SERVER', $serverCfg['host'] . ':' . $BS_PORT);
         $PMA_Config->set('PHP_PBMS_EXISTS', FALSE);
         $PMA_Config->set('FILEINFO_EXISTS', FALSE);
-
+		
         // check if PECL's fileinfo library exist
         $finfo = NULL;
 
@@ -290,7 +319,14 @@ function PMA_BS_IsPBMSReference($bs_reference, $db_name)
     }
 
     // You do not really need a connection to the PBMS Daemon
-    // to check if a reference looks valid.
+    // to check if a reference looks valid but unfortunalty the API
+    // requires one  at this point so until the API is updated
+    // we need to oepen one here. If you use pool connections this
+    // will not be a performance problem.
+     if (PMA_do_connect($db_name, FALSE) == FALSE) {
+        return FALSE;
+    }
+   
     $ok = pbms_is_blob_reference($bs_reference);
     return $ok ;
 }
@@ -494,34 +530,4 @@ function PMA_BS_getURL($reference)
     return $bs_url;
 }
 
-/**
- * returns the field name for a primary key of a given table in a given database
- *
- * @access  public
- * @param   string - database name
- * @param   string - table name
- * @uses    PMA_DBI_select_db()
- * @uses    PMA_backquote()
- * @uses    PMA_DBI_query()
- * @uses    PMA_DBI_fetch_assoc()
- * @return  string - field name for primary key
-*/
-function PMA_BS_GetPrimaryField($db_name, $tbl_name)
-{
-    // select specified database
-    PMA_DBI_select_db($db_name);
-
-    // retrieve table fields
-    $query = "SHOW FULL FIELDS FROM " . PMA_backquote($tbl_name);
-    $result = PMA_DBI_query($query);
-
-    // while there are records to parse
-    while ($data = PMA_DBI_fetch_assoc($result)) {
-        if ("PRI" == $data['Key']) {
-            return $data['Field'];
-        }
-    }
-    // return NULL on no primary key
-    return NULL;
-}
 ?>
diff --git a/tbl_replace.php b/tbl_replace.php
index 92331b9..6d4fd83 100644
--- a/tbl_replace.php
+++ b/tbl_replace.php
@@ -210,10 +210,6 @@ foreach ($loop_array as $rowcount => $where_clause) {
         ? $_REQUEST['auto_increment']['multi_edit'][$rowcount]
         : null;
 
-    if ($blob_streaming_active) {
-        $primary_field = PMA_BS_GetPrimaryField($GLOBALS['db'], $GLOBALS['table']);
-    }
-
     // Fetch the current values of a row to use in case we have a protected field
     // @todo possibly move to ./libraries/tbl_replace_fields.inc.php
     if ($is_insert && $using_key && isset($me_fields_type) && is_array($me_fields_type) && isset($where_clause)) {
@@ -226,7 +222,7 @@ foreach ($loop_array as $rowcount => $where_clause) {
         require './libraries/tbl_replace_fields.inc.php';
 
         // for blobstreaming
-        if ($blob_streaming_active && (NULL != $primary_field || strlen($primary_field) > 0)) {
+        if ($blob_streaming_active) {
             $remove_blob_repo = isset($_REQUEST['remove_blob_repo_' . $key]) ? $_REQUEST['remove_blob_repo_' . $key] : NULL;
             $upload_blob_repo = isset($_REQUEST['upload_blob_repo_' . $key]) ? $_REQUEST['upload_blob_repo_' . $key] : NULL;
 


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list