Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
This commit is contained in:
@@ -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'];
|
||||
|
||||
@@ -240,7 +269,7 @@ function PMA_BS_GetVariables()
|
||||
function PMA_BS_ReportPBMSError($msg)
|
||||
{
|
||||
$tmp_err = pbms_error();
|
||||
PMA_showMessage("PBMS error, $msg $tmp_err");
|
||||
PMA_showMessage(__('PBMS error') . " $msg $tmp_err");
|
||||
}
|
||||
|
||||
//------------
|
||||
@@ -249,8 +278,9 @@ function PMA_do_connect($db_name, $quiet)
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
|
||||
// return if unable to load PMA configuration
|
||||
if (empty($PMA_Config))
|
||||
if (empty($PMA_Config)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// generate bs reference link
|
||||
$pbms_host = $PMA_Config->get('BLOBSTREAMING_HOST');
|
||||
@@ -265,7 +295,7 @@ function PMA_do_connect($db_name, $quiet)
|
||||
|
||||
if ($ok == FALSE) {
|
||||
if ($quiet == FALSE) {
|
||||
PMA_BS_ReportPBMSError("PBMS Connection failed: pbms_connect($pbms_host, $pbms_port, $db_name)");
|
||||
PMA_BS_ReportPBMSError(__('PBMS connection failed:') . " pbms_connect($pbms_host, $pbms_port, $db_name)");
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -290,7 +320,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 epen 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 ;
|
||||
}
|
||||
@@ -299,19 +336,19 @@ function PMA_BS_IsPBMSReference($bs_reference, $db_name)
|
||||
function PMA_BS_CreateReferenceLink($bs_reference, $db_name)
|
||||
{
|
||||
if (PMA_do_connect($db_name, FALSE) == FALSE) {
|
||||
return 'Error';
|
||||
return __('Error');
|
||||
}
|
||||
|
||||
if (pbms_get_info(trim($bs_reference)) == FALSE) {
|
||||
PMA_BS_ReportPBMSError("PBMS get BLOB info failed: pbms_get_info($bs_reference)");
|
||||
PMA_BS_ReportPBMSError(__('PBMS get BLOB info failed:') . " pbms_get_info($bs_reference)");
|
||||
PMA_do_disconnect();
|
||||
return 'Error';
|
||||
return __('Error');
|
||||
}
|
||||
|
||||
$content_type = pbms_get_metadata_value("Content-Type");
|
||||
if ($content_type == FALSE) {
|
||||
$br = trim($bs_reference);
|
||||
PMA_BS_ReportPBMSError("'$content_type' PMA_BS_CreateReferenceLink('$br', '$db_name'): get BLOB Content-Type failed: ");
|
||||
PMA_BS_ReportPBMSError("PMA_BS_CreateReferenceLink('$br', '$db_name'): " . __('get BLOB Content-Type failed'));
|
||||
}
|
||||
|
||||
PMA_do_disconnect();
|
||||
@@ -322,7 +359,7 @@ function PMA_BS_CreateReferenceLink($bs_reference, $db_name)
|
||||
|
||||
$bs_url = PMA_BS_getURL($bs_reference);
|
||||
if (empty($bs_url)) {
|
||||
PMA_BS_ReportPBMSError("No blob streaming server configured!");
|
||||
PMA_BS_ReportPBMSError(__('No blob streaming server configured!'));
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
@@ -411,7 +448,7 @@ function PMA_BS_UpLoadFile($db_name, $tbl_name, $file_type, $file_name)
|
||||
$fh = fopen($file_name, 'r');
|
||||
if (! $fh) {
|
||||
PMA_do_disconnect();
|
||||
PMA_showMessage("Could not open file: $file_name");
|
||||
PMA_showMessage(sprintf(__('Could not open file: %s'), $file_name));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -419,7 +456,7 @@ function PMA_BS_UpLoadFile($db_name, $tbl_name, $file_type, $file_name)
|
||||
|
||||
$pbms_blob_url = pbms_read_stream($fh, filesize($file_name), $tbl_name);
|
||||
if (! $pbms_blob_url) {
|
||||
PMA_BS_ReportPBMSError("pbms_read_stream() Failed");
|
||||
PMA_BS_ReportPBMSError("pbms_read_stream()");
|
||||
}
|
||||
|
||||
fclose($fh);
|
||||
@@ -436,7 +473,7 @@ function PMA_BS_SetContentType($db_name, $bsTable, $blobReference, $contentType)
|
||||
|
||||
// This is a really ugly way to do this but currently there is nothing better.
|
||||
// In a future version of PBMS the system tables will be redesigned to make this
|
||||
// more eficient.
|
||||
// more efficient.
|
||||
$query = "SELECT Repository_id, Repo_blob_offset FROM pbms_reference WHERE Blob_url='" . PMA_sqlAddslashes($blobReference) . "'";
|
||||
//error_log(" PMA_BS_SetContentType: $query\n", 3, "/tmp/mylog");
|
||||
$result = PMA_DBI_query($query);
|
||||
@@ -494,34 +531,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;
|
||||
}
|
||||
?>
|
||||
|
@@ -1389,7 +1389,7 @@ function PMA_DBI_get_triggers($db, $table, $delimiter = '//')
|
||||
// instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
|
||||
$triggers = PMA_DBI_fetch_result("SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddslashes($db,true) . "' and EVENT_OBJECT_TABLE = '" . PMA_sqlAddslashes($table, true) . "';");
|
||||
} else {
|
||||
$triggers = PMA_DBI_fetch_result("SHOW TRIGGERS FROM " . PMA_sqlAddslashes($db,true) . " LIKE '" . PMA_sqlAddslashes($table, true) . "';");
|
||||
$triggers = PMA_DBI_fetch_result("SHOW TRIGGERS FROM " . PMA_backquote(PMA_sqlAddslashes($db,true)) . " LIKE '" . PMA_sqlAddslashes($table, true) . "';");
|
||||
}
|
||||
|
||||
if ($triggers) {
|
||||
|
Reference in New Issue
Block a user