Remove BLOBstreaming support; will need to run update-po after releasing version 3.5
This commit is contained in:
parent
4bc976136f
commit
87183ee0e1
@ -81,9 +81,6 @@ vim: expandtab ts=4 sw=4 sts=4 tw=78
|
||||
</li>
|
||||
<li>To support upload progress bars, see <a href="#faq2_9">
|
||||
<abbr title="Frequently Asked Questions">FAQ</abbr> 2.9</a>.</li>
|
||||
<li>To support BLOB streaming, see PHP and MySQL requirements
|
||||
in <a href="#faq6_25">
|
||||
<abbr title="Frequently Asked Questions">FAQ</abbr> 6.25</a>.</li>
|
||||
<li>To support XML and Open Document Spreadsheet importing,
|
||||
you need PHP 5.2.17 or newer and the
|
||||
<a href="http://www.php.net/libxml"><tt>libxml</tt></a> extension.</li>
|
||||
@ -4337,25 +4334,7 @@ INSERT INTO REL_towns VALUES ('M', 'Montréal');
|
||||
ones is done whenever you enter Structure page for this table.</p>
|
||||
|
||||
<h4 id="faq6_25">
|
||||
<a href="#faq6_25">6.25 How does BLOB streaming work in phpMyAdmin?</a></h4>
|
||||
|
||||
<p> For general information about BLOB streaming on MySQL, visit <a href="http://blobstreaming.org">blobstreaming.org</a>. You need the following components:</p>
|
||||
<ul>
|
||||
<li>PBMS BLOB Streaming Daemon for MySQL (0.5.15 or later)</li>
|
||||
<li>Streaming enabled PBXT Storage engine for MySQL (1.0.11-6 or
|
||||
later)</li>
|
||||
<li>PBMS Client Library for MySQL (0.5.15 or later)</li>
|
||||
<li>PBMS PHP Extension for MySQL (0.1.1 or later)</li>
|
||||
</ul>
|
||||
|
||||
<p>Here are details about configuration and operation:</p>
|
||||
|
||||
<ol>
|
||||
<li>In <tt>config.inc.php</tt> your host should be defined with a FQDN (fully qualified domain name) instead of "localhost".</li>
|
||||
<li>Ensure that your target table is under the <tt>PBXT</tt> storage engine and has a <tt>LONGBLOB</tt> column (which must be nullable if you want to remove the BLOB reference from it).</li>
|
||||
<li>When you insert or update a row in this table, put a checkmark on the "Upload to BLOB repository" optional choice; otherwise, the upload will be done directly in your LONGBLOB column instead of the repository.</li>
|
||||
<li>Finally when you browse your table, you'll see in your column a link to stream your data, for example "View image". A header containing the correct MIME-type will be sent to your browser; this MIME-type was stored at upload time.</li>
|
||||
</ol>
|
||||
<a href="#faq6_25">6.25 (withdrawn).</a></h4>
|
||||
|
||||
<h4 id="faq6_26">
|
||||
<a href="#faq6_26">6.26 How can I select a range of rows?</a></h4>
|
||||
@ -4920,7 +4899,7 @@ along with this program. If not, see <a href="http://www.gnu.org/licenses/">htt
|
||||
|
||||
<li>Raj Kissu Rajandran (Google Summer of Code 2008)
|
||||
<ul>
|
||||
<li>BLOBstreaming support</li>
|
||||
<li>BLOBstreaming support (withdrawn in release 4.0)</li>
|
||||
</ul></li>
|
||||
|
||||
<li>Piotr Przybylski (Google Summer of Code 2008, 2010 and 2011)
|
||||
@ -4974,7 +4953,7 @@ along with this program. If not, see <a href="http://www.gnu.org/licenses/">htt
|
||||
|
||||
<li>Barrie Leslie
|
||||
<ul>
|
||||
<li>BLOBstreaming support with PBMS PHP extension</li>
|
||||
<li>BLOBstreaming support with PBMS PHP extension (withdrawn in release 4.0)</li>
|
||||
</ul></li>
|
||||
|
||||
<li>Ankit Gupta (Google Summer of Code 2010)
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* @package BLOBStreaming
|
||||
*/
|
||||
|
||||
/**
|
||||
* Core library.
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
// Check URL parameters
|
||||
PMA_checkParameters(array('reference', 'c_type'));
|
||||
|
||||
// Increase time limit, because fetching blob might take some time
|
||||
@set_time_limit(0);
|
||||
|
||||
$reference = $_REQUEST['reference'];
|
||||
/*
|
||||
* FIXME: Maybe it would be better to check MIME type against whitelist as
|
||||
* this code sems to support only few MIME types (check
|
||||
* function PMA_BS_CreateReferenceLink in libraries/blobstreaming.lib.php).
|
||||
*/
|
||||
$c_type = preg_replace('/[^A-Za-z0-9/_-]/', '_', $_REQUEST['c_type']);
|
||||
|
||||
// Get the blob streaming URL
|
||||
$filename = PMA_BS_getURL($reference);
|
||||
if (empty($filename)) {
|
||||
die(__('No blob streaming server configured!'));
|
||||
}
|
||||
|
||||
$hdrs = get_headers($filename, 1);
|
||||
|
||||
if ($hdrs === false) {
|
||||
die(__('Failed to fetch headers'));
|
||||
}
|
||||
|
||||
$fHnd = fopen($filename, "rb");
|
||||
|
||||
if ($fHnd === false) {
|
||||
die(__('Failed to open remote URL'));
|
||||
}
|
||||
|
||||
$f_size = $hdrs['Content-Length'];
|
||||
|
||||
PMA_download_header(basename($filename), $c_type, $f_size);
|
||||
|
||||
$pos = 0;
|
||||
$content = "";
|
||||
|
||||
while (!feof($fHnd)) {
|
||||
$content .= fread($fHnd, $f_size);
|
||||
$pos = strlen($content);
|
||||
|
||||
if ($pos >= $f_size) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo $content;
|
||||
flush();
|
||||
|
||||
fclose($fHnd);
|
||||
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* @package BLOBStreaming
|
||||
*/
|
||||
|
||||
/**
|
||||
* Core library.
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
/*
|
||||
* @var string contains media type of BLOB reference
|
||||
*/
|
||||
$mediaType = isset($_REQUEST['media_type']) ? $_REQUEST['media_type'] : null;
|
||||
|
||||
/*
|
||||
* @var string indicates whether media type is of custom type
|
||||
*/
|
||||
$customType = isset($_REQUEST['custom_type']) ? $_REQUEST['custom_type'] : false;
|
||||
|
||||
/*
|
||||
* @var string contains BLOB reference
|
||||
*/
|
||||
$bsReference = isset($_REQUEST['bs_reference']) ? $_REQUEST['bs_reference'] : null;
|
||||
|
||||
// if media type and BS reference are specified
|
||||
if (isset($mediaType) && isset($bsReference)) {
|
||||
if (isset($customType) && $customType) {
|
||||
$bs_file_path = 'bs_disp_as_mime_type.php' . PMA_generate_common_url(array('reference' => $bsReference, 'c_type' => $mediaType));
|
||||
} else {
|
||||
// Get the BLOB streaming URL
|
||||
$bs_file_path = PMA_BS_getURL($bsReference);
|
||||
if (empty($bs_file_path)) {
|
||||
die(__('No blob streaming server configured!'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
// supported media types
|
||||
switch ($mediaType)
|
||||
{
|
||||
// audio content
|
||||
case 'audio/mpeg':
|
||||
?><embed width=620 height=100 src="<?php echo htmlspecialchars($bs_file_path); ?>" autostart=true></embed><?php
|
||||
break;
|
||||
// video content
|
||||
case 'application/x-flash-video':
|
||||
case 'video/mpeg':
|
||||
?><embed width=620 height=460 src="<?php echo htmlspecialchars($bs_file_path); ?>" autostart=true></embed><?php
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
} // end if (isset($mediaType) && isset($bsReference))
|
||||
|
||||
?>
|
||||
@ -18,9 +18,6 @@
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/mysql_charsets.lib.php';
|
||||
|
||||
// add blobstreaming library functions
|
||||
require_once "./libraries/blobstreaming.lib.php";
|
||||
|
||||
// add a javascript file for jQuery functions to handle Ajax actions
|
||||
// also add jQueryUI
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.16.custom.js';
|
||||
|
||||
@ -125,14 +125,7 @@ $hidden_fields = array();
|
||||
$odd_row = true;
|
||||
$sum_row_count_pre = '';
|
||||
|
||||
$tableReductionCount = 0; // the amount to reduce the table count by
|
||||
|
||||
foreach ($tables as $keyname => $each_table) {
|
||||
if (PMA_BS_IsHiddenTable($keyname)) {
|
||||
$tableReductionCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get valid statistics whatever is the table type
|
||||
|
||||
$table_is_view = false;
|
||||
@ -505,14 +498,9 @@ if ($is_show_stats) {
|
||||
<tr><th></th>
|
||||
<th align="center" nowrap="nowrap" class="tbl_num">
|
||||
<?php
|
||||
// for blobstreaming - if the number of tables is 0, set tableReductionCount to 0
|
||||
// (we don't want negative numbers here)
|
||||
if ($num_tables == 0) {
|
||||
$tableReductionCount = 0;
|
||||
}
|
||||
echo sprintf(
|
||||
_ngettext('%s table', '%s tables', $num_tables - $tableReductionCount),
|
||||
PMA_formatNumber($num_tables - $tableReductionCount, 0)
|
||||
_ngettext('%s table', '%s tables', $num_tables),
|
||||
PMA_formatNumber($num_tables, 0)
|
||||
);
|
||||
?>
|
||||
</th>
|
||||
|
||||
@ -330,29 +330,6 @@ function confirmQuery(theForm1, sqlQuery1)
|
||||
return true;
|
||||
} // end of the 'confirmQuery()' function
|
||||
|
||||
|
||||
/**
|
||||
* Displays a confirmation box before disabling the BLOB repository for a given database.
|
||||
* This function is called while clicking links
|
||||
*
|
||||
* @param object the database
|
||||
*
|
||||
* @return boolean whether to disable the repository or not
|
||||
*/
|
||||
function confirmDisableRepository(theDB)
|
||||
{
|
||||
// Confirmation is not required in the configuration file
|
||||
// or browser is Opera (crappy js implementation)
|
||||
if (PMA_messages['strDoYouReally'] == '' || typeof(window.opera) != 'undefined') {
|
||||
return true;
|
||||
}
|
||||
|
||||
var is_confirmed = confirm(PMA_messages['strBLOBRepositoryDisableStrongWarning'] + '\n' + PMA_messages['strBLOBRepositoryDisableAreYouSure']);
|
||||
|
||||
return is_confirmed;
|
||||
} // end of the 'confirmDisableBLOBRepository()' function
|
||||
|
||||
|
||||
/**
|
||||
* Displays an error message if the user submitted the sql query form with no
|
||||
* sql query, else checks for "DROP/DELETE/ALTER" statements
|
||||
@ -1075,74 +1052,6 @@ function pdfPaperSize(format, axis)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* for playing media from the BLOB repository
|
||||
*
|
||||
* @param var
|
||||
* @param var url_params main purpose is to pass the token
|
||||
* @param var bs_ref BLOB repository reference
|
||||
* @param var m_type type of BLOB repository media
|
||||
* @param var w_width width of popup window
|
||||
* @param var w_height height of popup window
|
||||
*/
|
||||
function popupBSMedia(url_params, bs_ref, m_type, is_cust_type, w_width, w_height)
|
||||
{
|
||||
// if width not specified, use default
|
||||
if (w_width == undefined) {
|
||||
w_width = 640;
|
||||
}
|
||||
|
||||
// if height not specified, use default
|
||||
if (w_height == undefined) {
|
||||
w_height = 480;
|
||||
}
|
||||
|
||||
// open popup window (for displaying video/playing audio)
|
||||
var mediaWin = window.open('bs_play_media.php?' + url_params + '&bs_reference=' + bs_ref + '&media_type=' + m_type + '&custom_type=' + is_cust_type, 'viewBSMedia', 'width=' + w_width + ', height=' + w_height + ', resizable=1, scrollbars=1, status=0');
|
||||
}
|
||||
|
||||
/**
|
||||
* popups a request for changing MIME types for files in the BLOB repository
|
||||
*
|
||||
* @param var db database name
|
||||
* @param var table table name
|
||||
* @param var reference BLOB repository reference
|
||||
* @param var current_mime_type current MIME type associated with BLOB repository reference
|
||||
*/
|
||||
function requestMIMETypeChange(db, table, reference, current_mime_type)
|
||||
{
|
||||
// no mime type specified, set to default (nothing)
|
||||
if (undefined == current_mime_type) {
|
||||
current_mime_type = "";
|
||||
}
|
||||
|
||||
// prompt user for new mime type
|
||||
var new_mime_type = prompt("Enter custom MIME type", current_mime_type);
|
||||
|
||||
// if new mime_type is specified and is not the same as the previous type, request for mime type change
|
||||
if (new_mime_type && new_mime_type != current_mime_type) {
|
||||
changeMIMEType(db, table, reference, new_mime_type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* changes MIME types for files in the BLOB repository
|
||||
*
|
||||
* @param var db database name
|
||||
* @param var table table name
|
||||
* @param var reference BLOB repository reference
|
||||
* @param var mime_type new MIME type to be associated with BLOB repository reference
|
||||
*/
|
||||
function changeMIMEType(db, table, reference, mime_type)
|
||||
{
|
||||
// specify url and parameters for jQuery POST
|
||||
var mime_chg_url = 'bs_change_mime_type.php';
|
||||
var params = {bs_db: db, bs_table: table, bs_reference: reference, bs_new_mime_type: mime_type};
|
||||
|
||||
// jQuery POST
|
||||
jQuery.post(mime_chg_url, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Jquery Coding for inline editing SQL_QUERY
|
||||
*/
|
||||
|
||||
@ -36,10 +36,6 @@ $js_messages['strDeletingTrackingData'] = __('Deleting tracking data');
|
||||
$js_messages['strDroppingPrimaryKeyIndex'] = __('Dropping Primary Key/Index');
|
||||
$js_messages['strOperationTakesLongTime'] = __('This operation could take a long time. Proceed anyway?');
|
||||
|
||||
/* For blobstreaming */
|
||||
$js_messages['strBLOBRepositoryDisableStrongWarning'] = __('You are about to DISABLE a BLOB Repository!');
|
||||
$js_messages['strBLOBRepositoryDisableAreYouSure'] = sprintf(__('Are you sure you want to disable all BLOB references for database %s?'), PMA_escapeJsString($GLOBALS['db']));
|
||||
|
||||
/* For indexes */
|
||||
$js_messages['strFormEmpty'] = __('Missing value in the form!');
|
||||
$js_messages['strNotNumber'] = __('This is not a number!');
|
||||
|
||||
@ -69,11 +69,6 @@ class PMA_File
|
||||
*/
|
||||
var $_charset = null;
|
||||
|
||||
/**
|
||||
* @staticvar string most recent BLOB repository reference
|
||||
*/
|
||||
static $_recent_bs_reference = null;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -238,32 +233,6 @@ class PMA_File
|
||||
}
|
||||
$file = PMA_File::fetchUploadedFromTblChangeRequestMultiple($_FILES['fields_upload'], $rownumber, $key);
|
||||
|
||||
// for blobstreaming
|
||||
$is_bs_upload = false;
|
||||
|
||||
// check if this field requires a repository upload
|
||||
if (isset($_REQUEST['upload_blob_repo']['multi_edit'][$rownumber][$key])) {
|
||||
$is_bs_upload = ($_REQUEST['upload_blob_repo']['multi_edit'][$rownumber][$key] == "on") ? true : false;
|
||||
}
|
||||
// if request is an upload to the BLOB repository
|
||||
if ($is_bs_upload) {
|
||||
$bs_db = $_REQUEST['db'];
|
||||
$bs_table = $_REQUEST['table'];
|
||||
$tmp_filename = $file['tmp_name'];
|
||||
$tmp_file_type = $file['type'];
|
||||
|
||||
if (! $tmp_file_type) {
|
||||
$tmp_file_type = null;
|
||||
}
|
||||
|
||||
if (! $bs_db || ! $bs_table) {
|
||||
$this->_error_message = __('Unknown error while uploading.');
|
||||
return false;
|
||||
}
|
||||
$blob_url = PMA_BS_UpLoadFile($bs_db, $bs_table, $tmp_file_type, $tmp_filename);
|
||||
PMA_File::setRecentBLOBReference($blob_url);
|
||||
} // end if ($is_bs_upload)
|
||||
|
||||
// check for file upload errors
|
||||
switch ($file['error']) {
|
||||
// we do not use the PHP constants here cause not all constants
|
||||
@ -351,48 +320,6 @@ class PMA_File
|
||||
if (! empty($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key])
|
||||
&& is_string($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key])) {
|
||||
// ... whether with multiple rows ...
|
||||
// for blobstreaming
|
||||
$is_bs_upload = false;
|
||||
|
||||
// check if this field requires a repository upload
|
||||
if (isset($_REQUEST['upload_blob_repo']['multi_edit'][$rownumber][$key])) {
|
||||
$is_bs_upload = ($_REQUEST['upload_blob_repo']['multi_edit'][$rownumber][$key] == "on") ? true : false;
|
||||
}
|
||||
|
||||
// is a request to upload file to BLOB repository using uploadDir mechanism
|
||||
if ($is_bs_upload) {
|
||||
$bs_db = $_REQUEST['db'];
|
||||
$bs_table = $_REQUEST['table'];
|
||||
$tmp_filename = $GLOBALS['cfg']['UploadDir'] . '/' . $_REQUEST['fields_uploadlocal_' . $key]['multi_edit'][$rownumber];
|
||||
|
||||
// check if fileinfo library exists
|
||||
if ($PMA_Config->get('FILEINFO_EXISTS')) {
|
||||
// attempt to init fileinfo
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
|
||||
// fileinfo exists
|
||||
if ($finfo) {
|
||||
// pass in filename to fileinfo and close fileinfo handle after
|
||||
$tmp_file_type = finfo_file($finfo, $tmp_filename);
|
||||
finfo_close($finfo);
|
||||
}
|
||||
} else {
|
||||
// no fileinfo library exists, use file command
|
||||
$tmp_file_type = exec("file -bi " . escapeshellarg($tmp_filename));
|
||||
}
|
||||
|
||||
if (! $tmp_file_type) {
|
||||
$tmp_file_type = null;
|
||||
}
|
||||
|
||||
if (! $bs_db || !$bs_table) {
|
||||
$this->_error_message = __('Unknown error while uploading.');
|
||||
return false;
|
||||
}
|
||||
$blob_url = PMA_BS_UpLoadFile($bs_db, $bs_table, $tmp_file_type, $tmp_filename);
|
||||
PMA_File::setRecentBLOBReference($blob_url);
|
||||
} // end if ($is_bs_upload)
|
||||
|
||||
return $this->setLocalSelectedFile($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key]);
|
||||
} else {
|
||||
return false;
|
||||
@ -798,30 +725,5 @@ class PMA_File
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* sets reference to most recent BLOB repository reference
|
||||
*
|
||||
* @access public
|
||||
* @param string - BLOB repository reference
|
||||
*/
|
||||
static function setRecentBLOBReference($ref)
|
||||
{
|
||||
PMA_File::$_recent_bs_reference = $ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* retrieves reference to most recent BLOB repository reference
|
||||
*
|
||||
* @access public
|
||||
* @return string - most recent BLOB repository reference
|
||||
*/
|
||||
static function getRecentBLOBReference()
|
||||
{
|
||||
$ref = PMA_File::$_recent_bs_reference;
|
||||
PMA_File::$_recent_bs_reference = null;
|
||||
|
||||
return $ref;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -1,582 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* @package BLOBStreaming
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initializes PBMS database
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function initPBMSDatabase()
|
||||
{
|
||||
// If no other choice then try this.
|
||||
$query = "create database IF NOT EXISTS pbms;";
|
||||
/*
|
||||
* The user may not have privileges to create the 'pbms' database
|
||||
* so if it doesn't exist then we perform a select on a pbms system
|
||||
* table in an already existing database which will cause the PBMS
|
||||
* daemon to create the 'pbms' database.
|
||||
*/
|
||||
$db_array = PMA_DBI_fetch_result('SHOW DATABASES;');
|
||||
if (! empty($db_array)) {
|
||||
$target = "";
|
||||
foreach ($db_array as $current_db) {
|
||||
if ($current_db == 'pbms') {
|
||||
return true;
|
||||
}
|
||||
if ($target == "") {
|
||||
if ($current_db != 'pbxt'
|
||||
&& ! PMA_is_system_schema($current_db, true)
|
||||
) {
|
||||
$target = $current_db;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($target != "") {
|
||||
// If it exists this table will not contain much
|
||||
$query = "select * from $target.pbms_metadata_header";
|
||||
}
|
||||
}
|
||||
|
||||
$result = PMA_DBI_query($query);
|
||||
if (! $result) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks whether the necessary plugins for BLOBStreaming exist
|
||||
*
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function checkBLOBStreamingPlugins()
|
||||
{
|
||||
if (PMA_cacheGet('skip_blobstreaming', true) === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// load PMA configuration
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
|
||||
// return if unable to load PMA configuration
|
||||
if (empty($PMA_Config)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we don't know that we can skip blobstreaming, we continue
|
||||
// verifications; anyway, in case we won't skip blobstreaming,
|
||||
// we still need to set some variables in non-persistent settings,
|
||||
// which is done via $PMA_Config->set().
|
||||
|
||||
/** Retrieve current server configuration;
|
||||
* at this point, $PMA_Config->get('Servers') contains the server parameters
|
||||
* as explicitely defined in config.inc.php, so it cannot be used; it's
|
||||
* better to use $GLOBALS['cfg']['Server'] which contains the explicit
|
||||
* parameters merged with the default ones
|
||||
*
|
||||
*/
|
||||
$serverCfg = $GLOBALS['cfg']['Server'];
|
||||
|
||||
// return if unable to retrieve current server configuration
|
||||
if (! $serverCfg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if PHP extension in use is 'mysql', specify element 'PersistentConnections'
|
||||
if ($serverCfg['extension'] == "mysql") {
|
||||
$serverCfg['PersistentConnections'] = $PMA_Config->settings['PersistentConnections'];
|
||||
}
|
||||
|
||||
// if connection type is TCP, unload socket variable
|
||||
if (strtolower($serverCfg['connect_type']) == "tcp") {
|
||||
$serverCfg['socket'] = "";
|
||||
}
|
||||
|
||||
$has_blobstreaming = PMA_cacheGet('has_blobstreaming', true);
|
||||
|
||||
if ($has_blobstreaming === null) {
|
||||
if (! PMA_DRIZZLE && PMA_MYSQL_INT_VERSION >= 50109) {
|
||||
|
||||
// Retrieve MySQL plugins
|
||||
$existing_plugins = PMA_DBI_fetch_result('SHOW PLUGINS');
|
||||
|
||||
foreach ($existing_plugins as $one_existing_plugin) {
|
||||
// check if required plugins exist
|
||||
if ( strtolower($one_existing_plugin['Library']) == 'libpbms.so'
|
||||
&& $one_existing_plugin['Status'] == "ACTIVE"
|
||||
) {
|
||||
$has_blobstreaming = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($existing_plugins, $one_existing_plugin);
|
||||
} else if (PMA_DRIZZLE) {
|
||||
$has_blobstreaming = (bool) PMA_DBI_fetch_result(
|
||||
"SELECT 1
|
||||
FROM data_dictionary.plugins
|
||||
WHERE module_name = 'PBMS'
|
||||
AND is_active = true
|
||||
LIMIT 1"
|
||||
);
|
||||
}
|
||||
PMA_cacheSet('has_blobstreaming', $has_blobstreaming, true);
|
||||
}
|
||||
|
||||
// set variable indicating BS plugin existence
|
||||
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', $has_blobstreaming);
|
||||
|
||||
if (! $has_blobstreaming) {
|
||||
PMA_cacheSet('skip_blobstreaming', true, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($has_blobstreaming) {
|
||||
$bs_variables = PMA_BS_GetVariables();
|
||||
|
||||
// if no BS variables exist, set plugin existence to false and return
|
||||
if (count($bs_variables) == 0) {
|
||||
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', false);
|
||||
PMA_cacheSet('skip_blobstreaming', true, true);
|
||||
PMA_cacheSet('has_blobstreaming', false, true);
|
||||
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);
|
||||
PMA_cacheSet('has_blobstreaming', false, 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'];
|
||||
|
||||
// if no BS server port or 'pbms' database exists,
|
||||
// set plugin existance to false and return
|
||||
if ((! $BS_PORT) || (! initPBMSDatabase())) {
|
||||
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', false);
|
||||
PMA_cacheSet('skip_blobstreaming', true, true);
|
||||
return false;
|
||||
} // end if (!$BS_PORT)
|
||||
|
||||
// Ping PBMS: the database doesn't need to exist for this to work.
|
||||
if (pbms_connect($serverCfg['host'], $BS_PORT, "anydb") == false) {
|
||||
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', false);
|
||||
PMA_cacheSet('skip_blobstreaming', true, true);
|
||||
return false;
|
||||
}
|
||||
pbms_close();
|
||||
|
||||
if (function_exists("pbms_pconnect")) {
|
||||
$PMA_Config->set('PBMS_PCONNECT_EXISTS', true);
|
||||
} else {
|
||||
$PMA_Config->set('PBMS_PCONNECT_EXISTS', false);
|
||||
}
|
||||
|
||||
// add selected BS, CURL and fileinfo library variables to PMA configuration
|
||||
$PMA_Config->set('BLOBSTREAMING_PORT', $BS_PORT);
|
||||
$PMA_Config->set('BLOBSTREAMING_HOST', $serverCfg['host']);
|
||||
$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;
|
||||
|
||||
if (function_exists("finfo_open")) {
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
}
|
||||
|
||||
// fileinfo library exists, set necessary variable and close resource
|
||||
if (! empty($finfo)) {
|
||||
$PMA_Config->set('FILEINFO_EXISTS', true);
|
||||
finfo_close($finfo);
|
||||
} // end if (!empty($finfo))
|
||||
|
||||
} else {
|
||||
PMA_cacheSet('skip_blobstreaming', true, true);
|
||||
return false;
|
||||
} // end if ($has_blobstreaming)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a list of BLOBStreaming variables used by MySQL
|
||||
*
|
||||
* @access public
|
||||
* @return array - list of BLOBStreaming variables
|
||||
*/
|
||||
function PMA_BS_GetVariables()
|
||||
{
|
||||
// load PMA configuration
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
|
||||
// return if unable to load PMA configuration
|
||||
if (empty($PMA_Config)) {
|
||||
return null;
|
||||
}
|
||||
// run query to retrieve BS variables
|
||||
$query = "SHOW VARIABLES LIKE '%pbms%'";
|
||||
$result = PMA_DBI_query($query);
|
||||
|
||||
$BS_Variables = array();
|
||||
|
||||
// while there are records to retrieve
|
||||
while ($data = @PMA_DBI_fetch_assoc($result)) {
|
||||
$BS_Variables[$data['Variable_name']] = $data['Value'];
|
||||
}
|
||||
// return BS variables
|
||||
return $BS_Variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves and shows PBMS error.
|
||||
*
|
||||
* @param sting $msg error message
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_BS_ReportPBMSError($msg)
|
||||
{
|
||||
$tmp_err = pbms_error();
|
||||
PMA_showMessage(__('PBMS error') . " $msg $tmp_err");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to connect to PBMS server.
|
||||
*
|
||||
* @param string $db_name Database name
|
||||
* @param bool $quiet Whether to report errors
|
||||
*
|
||||
* @return bool Connection status.
|
||||
*/
|
||||
function PMA_do_connect($db_name, $quiet)
|
||||
{
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
|
||||
// return if unable to load PMA configuration
|
||||
if (empty($PMA_Config)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// generate bs reference link
|
||||
$pbms_host = $PMA_Config->get('BLOBSTREAMING_HOST');
|
||||
$pbms_port = $PMA_Config->get('BLOBSTREAMING_PORT');
|
||||
|
||||
if ($PMA_Config->get('PBMS_PCONNECT_EXISTS')) {
|
||||
// Open a persistent connection.
|
||||
$ok = pbms_pconnect($pbms_host, $pbms_port, $db_name);
|
||||
} else {
|
||||
$ok = pbms_connect($pbms_host, $pbms_port, $db_name);
|
||||
}
|
||||
|
||||
if ($ok == false) {
|
||||
if ($quiet == false) {
|
||||
PMA_BS_ReportPBMSError(
|
||||
__('PBMS connection failed:')
|
||||
. " pbms_connect($pbms_host, $pbms_port, $db_name)"
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnects from PBMS server.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_do_disconnect()
|
||||
{
|
||||
pbms_close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the BLOB reference looks valid
|
||||
*
|
||||
* @param string $bs_reference BLOB reference
|
||||
* @param string $db_name Database name
|
||||
*
|
||||
* @return bool True on success.
|
||||
*/
|
||||
function PMA_BS_IsPBMSReference($bs_reference, $db_name)
|
||||
{
|
||||
if (PMA_cacheGet('skip_blobstreaming', true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// You do not really need a connection to the PBMS Daemon
|
||||
// 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 ;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_CreateReferenceLink($bs_reference, $db_name)
|
||||
{
|
||||
if (PMA_do_connect($db_name, false) == false) {
|
||||
return __('Error');
|
||||
}
|
||||
|
||||
if (pbms_get_info(trim($bs_reference)) == false) {
|
||||
PMA_BS_ReportPBMSError(
|
||||
__('PBMS get BLOB info failed:')
|
||||
. " pbms_get_info($bs_reference)"
|
||||
);
|
||||
PMA_do_disconnect();
|
||||
return __('Error');
|
||||
}
|
||||
|
||||
$content_type = pbms_get_metadata_value("Content-Type");
|
||||
if ($content_type == false) {
|
||||
$br = trim($bs_reference);
|
||||
PMA_BS_ReportPBMSError(
|
||||
"PMA_BS_CreateReferenceLink('$br', '$db_name'): "
|
||||
. __('PBMS get BLOB Content-Type failed')
|
||||
);
|
||||
}
|
||||
|
||||
PMA_do_disconnect();
|
||||
|
||||
if (! $content_type) {
|
||||
$content_type = "image/jpeg";
|
||||
}
|
||||
|
||||
$bs_url = PMA_BS_getURL($bs_reference);
|
||||
if (empty($bs_url)) {
|
||||
PMA_BS_ReportPBMSError(__('No blob streaming server configured!'));
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
$output = $content_type;
|
||||
|
||||
// specify custom HTML for various content types
|
||||
switch ($content_type) {
|
||||
// no content specified
|
||||
case null:
|
||||
$output = "NULL";
|
||||
break;
|
||||
// image content
|
||||
case 'image/jpeg':
|
||||
case 'image/png':
|
||||
$output .= ' (<a href="' . $bs_url . '" target="new">'
|
||||
. __('View image') . '</a>)';
|
||||
break;
|
||||
// audio content
|
||||
case 'audio/mpeg':
|
||||
$output .= ' (<a href="#" onclick="popupBSMedia(\''
|
||||
. PMA_generate_common_url() . '\',\'' . urlencode($bs_reference)
|
||||
. '\', \'' . urlencode($content_type) . '\','
|
||||
. ($is_custom_type ? 1 : 0) . ', 640, 120)">' . __('Play audio')
|
||||
. '</a>)';
|
||||
break;
|
||||
// video content
|
||||
case 'application/x-flash-video':
|
||||
case 'video/mpeg':
|
||||
$output .= ' (<a href="#" onclick="popupBSMedia(\''
|
||||
. PMA_generate_common_url() . '\',\'' . urlencode($bs_reference)
|
||||
. '\', \'' . urlencode($content_type) . '\','
|
||||
. ($is_custom_type ? 1 : 0) . ', 640, 480)">' . __('View video')
|
||||
. '</a>)';
|
||||
break;
|
||||
// unsupported content. specify download
|
||||
default:
|
||||
$output .= ' (<a href="' . $bs_url . '" target="new">'
|
||||
. __('Download file') . '</a>)';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* In the future there may be server variables to turn on/off PBMS
|
||||
* BLOB streaming on a per table or database basis. So in anticipation of this
|
||||
* PMA_BS_IsTablePBMSEnabled() passes in the table and database name even though
|
||||
* they are not currently needed.
|
||||
*
|
||||
* @param string $db_name database name
|
||||
* @param string $tbl_name table name
|
||||
* @param string $tbl_type table type
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function PMA_BS_IsTablePBMSEnabled($db_name, $tbl_name, $tbl_type)
|
||||
{
|
||||
if (PMA_cacheGet('skip_blobstreaming', true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((isset($tbl_type) == false) || (strlen($tbl_type) == 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// load PMA configuration
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
|
||||
// return if unable to load PMA configuration
|
||||
if (empty($PMA_Config)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// This information should be cached rather than selecting it each time.
|
||||
// $query = "SELECT count(*) FROM information_schema.TABLES T,
|
||||
// pbms.pbms_enabled E where T.table_schema = ". PMA_backquote($db_name) . "
|
||||
// and T.table_name = ". PMA_backquote($tbl_name) . " and T.engine = E.name";
|
||||
$query = "SELECT count(*) FROM pbms.pbms_enabled E where E.name = '"
|
||||
. PMA_sqlAddSlashes($tbl_type) . "'";
|
||||
$result = PMA_DBI_query($query);
|
||||
|
||||
$data = PMA_DBI_fetch_row($result);
|
||||
if ($data[0] == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_UpLoadFile($db_name, $tbl_name, $file_type, $file_name)
|
||||
{
|
||||
|
||||
if (PMA_cacheGet('skip_blobstreaming', true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (PMA_do_connect($db_name, false) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fh = fopen($file_name, 'r');
|
||||
if (! $fh) {
|
||||
PMA_do_disconnect();
|
||||
PMA_showMessage(sprintf(__('Could not open file: %s'), $file_name));
|
||||
return false;
|
||||
}
|
||||
|
||||
pbms_add_metadata("Content-Type", $file_type);
|
||||
|
||||
$pbms_blob_url = pbms_read_stream($fh, filesize($file_name), $tbl_name);
|
||||
if (! $pbms_blob_url) {
|
||||
PMA_BS_ReportPBMSError("pbms_read_stream()");
|
||||
}
|
||||
|
||||
fclose($fh);
|
||||
PMA_do_disconnect();
|
||||
return $pbms_blob_url;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_SetContentType($db_name, $bsTable, $blobReference, $contentType)
|
||||
{
|
||||
if (PMA_cacheGet('skip_blobstreaming', true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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 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);
|
||||
//error_log(" $query\n", 3, "/tmp/mylog");
|
||||
|
||||
// if record exists
|
||||
if ($data = PMA_DBI_fetch_assoc($result)) {
|
||||
$where = "WHERE Repository_id=" . $data['Repository_id']
|
||||
. " AND Repo_blob_offset=" . $data['Repo_blob_offset'] ;
|
||||
$query = "SELECT name from pbms_metadata $where";
|
||||
$result = PMA_DBI_query($query);
|
||||
|
||||
if (PMA_DBI_num_rows($result) == 0) {
|
||||
$query = "INSERT into pbms_metadata Values( ". $data['Repository_id']
|
||||
. ", " . $data['Repo_blob_offset'] . ", 'Content_type', '"
|
||||
. PMA_sqlAddSlashes($contentType) . "')";
|
||||
} else {
|
||||
$query = "UPDATE pbms_metadata SET name = 'Content_type', Value = '"
|
||||
. PMA_sqlAddSlashes($contentType) . "' $where";
|
||||
}
|
||||
//error_log("$query\n", 3, "/tmp/mylog");
|
||||
PMA_DBI_query($query);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_IsHiddenTable($table)
|
||||
{
|
||||
if ($table === 'pbms_repository'
|
||||
|| $table === 'pbms_reference'
|
||||
|| $table === 'pbms_metadata'
|
||||
|| $table === 'pbms_metadata_header'
|
||||
|| $table === 'pbms_dump'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_getURL($reference)
|
||||
{
|
||||
// load PMA configuration
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
if (empty($PMA_Config)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// retrieve BS server variables from PMA configuration
|
||||
$bs_server = $PMA_Config->get('BLOBSTREAMING_SERVER');
|
||||
if (empty($bs_server)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$bs_url = PMA_linkURL('http://' . $bs_server . '/' . rtrim($reference));
|
||||
return $bs_url;
|
||||
}
|
||||
|
||||
?>
|
||||
@ -485,11 +485,7 @@ if (! PMA_isValid($_REQUEST['token']) || $_SESSION[' PMA_token '] != $_REQUEST['
|
||||
/* Cookie preferences */
|
||||
'pma_lang', 'pma_collation_connection',
|
||||
/* Possible login form */
|
||||
'pma_servername', 'pma_username', 'pma_password',
|
||||
/* for playing blobstreamable media */
|
||||
'media_type', 'custom_type', 'bs_reference',
|
||||
/* for changing BLOB repository file MIME type */
|
||||
'bs_db', 'bs_table', 'bs_ref', 'bs_new_mime_type',
|
||||
'pma_servername', 'pma_username', 'pma_password'
|
||||
);
|
||||
/**
|
||||
* Require cleanup functions
|
||||
@ -1007,13 +1003,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
unset($_SESSION['profiling']);
|
||||
}
|
||||
|
||||
// library file for blobstreaming
|
||||
include_once './libraries/blobstreaming.lib.php';
|
||||
|
||||
// checks for blobstreaming plugins and databases that support
|
||||
// blobstreaming (by having the necessary tables for blobstreaming)
|
||||
checkBLOBStreamingPlugins();
|
||||
|
||||
} // end if !defined('PMA_MINIMUM_COMMON')
|
||||
|
||||
// load user preferences
|
||||
|
||||
@ -754,17 +754,10 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count =
|
||||
|
||||
$table_groups = array();
|
||||
|
||||
// for blobstreaming - list of blobstreaming tables
|
||||
|
||||
// load PMA configuration
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
|
||||
foreach ($tables as $table_name => $table) {
|
||||
// if BS tables exist
|
||||
if (PMA_BS_IsHiddenTable($table_name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check for correct row count
|
||||
if (null === $table['Rows']) {
|
||||
// Do not check exact row count here,
|
||||
|
||||
@ -292,14 +292,6 @@ function PMA_getTableCount($db)
|
||||
null, PMA_DBI_QUERY_STORE);
|
||||
if ($tables) {
|
||||
$num_tables = PMA_DBI_num_rows($tables);
|
||||
|
||||
// do not count hidden blobstreaming tables
|
||||
while ((($num_tables > 0)) && $data = PMA_DBI_fetch_assoc($tables)) {
|
||||
if (PMA_BS_IsHiddenTable($data['Tables_in_' . $db])) {
|
||||
$num_tables--;
|
||||
}
|
||||
}
|
||||
|
||||
PMA_DBI_free_result($tables);
|
||||
} else {
|
||||
$num_tables = 0;
|
||||
|
||||
@ -1581,13 +1581,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
|
||||
if (! isset($row[$i]) || is_null($row[$i])) {
|
||||
$vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta);
|
||||
} else {
|
||||
// for blobstreaming
|
||||
// if valid BS reference exists
|
||||
if (PMA_BS_IsPBMSReference($row[$i], $db)) {
|
||||
$blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
|
||||
} else {
|
||||
$blobtext = PMA_handle_non_printable_contents('BLOB', (isset($row[$i]) ? $row[$i] : ''), $transform_function, $transform_options, $default_function, $meta, $_url_params);
|
||||
}
|
||||
$blobtext = PMA_handle_non_printable_contents('BLOB', (isset($row[$i]) ? $row[$i] : ''), $transform_function, $transform_options, $default_function, $meta, $_url_params);
|
||||
|
||||
$vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $blobtext);
|
||||
unset($blobtext);
|
||||
|
||||
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* @package PhpMyAdmin-Engines
|
||||
*/
|
||||
|
||||
/**
|
||||
* the PBMS daemon
|
||||
* @package PhpMyAdmin-Engines
|
||||
*/
|
||||
class PMA_StorageEngine_pbms extends PMA_StorageEngine
|
||||
{
|
||||
/**
|
||||
* returns array with variable names dedicated to PBMS daemon
|
||||
*
|
||||
* @return array variable names
|
||||
*/
|
||||
function engine_init()
|
||||
{
|
||||
$this->engine = "PBMS";
|
||||
$this->title = "PrimeBase Media Streaming Daemon";
|
||||
$this->comment = "Provides BLOB streaming service for storage engines,";
|
||||
$this->support = PMA_ENGINE_SUPPORT_YES;
|
||||
}
|
||||
|
||||
function getVariables()
|
||||
{
|
||||
return array(
|
||||
'pbms_garbage_threshold' => array(
|
||||
'title' => __('Garbage Threshold'),
|
||||
'desc' => __('The percentage of garbage in a repository file before it is compacted.'),
|
||||
'type' => PMA_ENGINE_DETAILS_TYPE_PLAINTEXT
|
||||
),
|
||||
'pbms_port' => array(
|
||||
'title' => __('Port'),
|
||||
'desc' => __('The port for the PBMS stream-based communications. Setting this value to 0 will disable HTTP communication with the daemon.'),
|
||||
'type' => PMA_ENGINE_DETAILS_TYPE_PLAINTEXT
|
||||
),
|
||||
'pbms_repository_threshold' => array(
|
||||
'title' => __('Repository Threshold'),
|
||||
'desc' => __('The maximum size of a BLOB repository file. You may use Kb, MB or GB to indicate the unit of the value. A value in bytes is assumed when no unit is specified.'),
|
||||
'type' => PMA_ENGINE_DETAILS_TYPE_PLAINTEXT
|
||||
),
|
||||
'pbms_temp_blob_timeout' => array(
|
||||
'title' => __('Temp Blob Timeout'),
|
||||
'desc' => __('The timeout, in seconds, for temporary BLOBs. Uploaded BLOB data is removed after this time, unless they are referenced by a record in the database.'),
|
||||
'type' => PMA_ENGINE_DETAILS_TYPE_PLAINTEXT
|
||||
),
|
||||
'pbms_temp_log_threshold' => array(
|
||||
'title' => __('Temp Log Threshold'),
|
||||
'desc' => __('The maximum size of a temporary BLOB log file. You may use Kb, MB or GB to indicate the unit of the value. A value in bytes is assumed when no unit is specified.'),
|
||||
'type' => PMA_ENGINE_DETAILS_TYPE_PLAINTEXT
|
||||
),
|
||||
'pbms_max_keep_alive' => array(
|
||||
'title' => __('Max Keep Alive'),
|
||||
'desc' => __('The timeout for inactive connection with the keep-alive flag set. After this time the connection will be closed. The time-out is in milliseconds (1/1000).'),
|
||||
'type' => PMA_ENGINE_DETAILS_TYPE_PLAINTEXT
|
||||
),
|
||||
'pbms_http_metadata_headers' => array(
|
||||
'title' => __('Metadata Headers'),
|
||||
'desc' => __('A ":" delimited list of metadata headers to be used to initialize the pbms_metadata_header table when a database is created.'),
|
||||
'type' => PMA_ENGINE_DETAILS_TYPE_PLAINTEXT
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
function getInfoPages()
|
||||
{
|
||||
$pages = array();
|
||||
$pages['Documentation'] = __('Documentation');
|
||||
return $pages;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
function getPage($id)
|
||||
{
|
||||
if (! array_key_exists($id, $this->getInfoPages())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = 'getPage' . $id;
|
||||
|
||||
return $this->$id();
|
||||
}
|
||||
|
||||
function getPageConfigure()
|
||||
{
|
||||
}
|
||||
|
||||
function getPageDocumentation()
|
||||
{
|
||||
$output = '<p>'
|
||||
. sprintf(__('Documentation and further information about PBMS can be found on %sThe PrimeBase Media Streaming home page%s.'), '<a href="' . PMA_linkURL('http://www.blobstreaming.org/') . '" target="_blank">', '</a>')
|
||||
. '</p>' . "\n"
|
||||
. '<h3>' . __('Related Links') . '</h3>' . "\n"
|
||||
. '<ul>' . "\n"
|
||||
. '<li><a href="' . PMA_linkURL('http://bpbdev.blogspot.com/') . '" target="_blank">' . __('The PrimeBase Media Streaming Blog by Barry Leslie') . '</a></li>' . "\n"
|
||||
. '<li><a href="' . PMA_linkURL('http://www.primebase.com/xt') . '" target="_blank">' . __('PrimeBase XT Home Page') . '</a></li>' . "\n"
|
||||
. '</ul>' . "\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -127,7 +127,6 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine
|
||||
. '<h3>' . __('Related Links') . '</h3>' . "\n"
|
||||
. '<ul>' . "\n"
|
||||
. '<li><a href="' . PMA_linkURL('http://pbxt.blogspot.com/') . '" target="_blank">' . __('The PrimeBase XT Blog by Paul McCullagh') . '</a></li>' . "\n"
|
||||
. '<li><a href="' . PMA_linkURL('http://www.blobstreaming.org/') . '" target="_blank">' . __('The PrimeBase Media Streaming (PBMS) home page') . '</a></li>' . "\n"
|
||||
. '</ul>' . "\n";
|
||||
|
||||
return $output;
|
||||
|
||||
@ -78,20 +78,6 @@ if (empty($_REQUEST['engine'])
|
||||
$odd_row = !$odd_row;
|
||||
}
|
||||
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) {
|
||||
// Special case for PBMS daemon which is not listed as an engine
|
||||
echo '<tr class="'
|
||||
. ($odd_row ? 'odd' : 'even')
|
||||
. '">' . "\n"
|
||||
. ' <td><a href="./server_engines.php'
|
||||
. PMA_generate_common_url(array('engine' => "PBMS")) . '">' . "\n"
|
||||
. ' ' . "PBMS\n"
|
||||
. ' </a></td>' . "\n"
|
||||
. ' <td>' . htmlspecialchars("PrimeBase MediaStream (PBMS) daemon") . '</td>' . "\n"
|
||||
. '</tr>' . "\n";
|
||||
}
|
||||
|
||||
unset($odd_row, $engine, $details);
|
||||
echo '</tbody>' . "\n"
|
||||
. '</table>' . "\n";
|
||||
|
||||
@ -808,24 +808,12 @@ foreach ($rows as $row_id => $vrow) {
|
||||
if (($cfg['ProtectBinary'] && $field['is_blob'])
|
||||
|| ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])
|
||||
) {
|
||||
echo "\n";
|
||||
// for blobstreaming
|
||||
if (PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type)
|
||||
&& PMA_BS_IsPBMSReference($data, $db)
|
||||
) {
|
||||
echo '<input type="hidden" name="remove_blob_ref_' . $field['Field_md5'] . $vkey . '" value="' . $data . '" />';
|
||||
echo '<input type="checkbox" name="remove_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Remove BLOB Repository Reference') . "<br />";
|
||||
echo PMA_BS_CreateReferenceLink($data, $db);
|
||||
echo "<br />";
|
||||
} else {
|
||||
echo __('Binary - do not edit');
|
||||
if (isset($data)) {
|
||||
$data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
|
||||
echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
|
||||
unset($data_size);
|
||||
}
|
||||
echo "\n";
|
||||
} // end if (PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type) && PMA_BS_IsPBMSReference($data, $db))
|
||||
echo __('Binary - do not edit');
|
||||
if (isset($data)) {
|
||||
$data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
|
||||
echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
|
||||
unset($data_size);
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="protected" />
|
||||
<input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
|
||||
@ -863,14 +851,6 @@ foreach ($rows as $row_id => $vrow) {
|
||||
// (displayed whatever value the ProtectBinary has)
|
||||
|
||||
if ($is_upload && $field['is_blob']) {
|
||||
// check if field type is of longblob and if the table is PBMS enabled.
|
||||
if (($field['pma_type'] == "longblob")
|
||||
&& PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type)
|
||||
) {
|
||||
echo '<br />';
|
||||
echo '<input type="checkbox" name="upload_blob_repo' . $vkey . '[' . $field['Field_md5'] . ']" /> ' . __('Upload to BLOB repository');
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
echo '<input type="file" name="fields_upload' . $vkey . '[' . $field['Field_md5'] . ']" class="textfield" id="field_' . $idindex . '_3" size="10" ' . $unnullify_trigger . '/> ';
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) {
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
$blob_streaming_active = $GLOBALS['PMA_Config']->get('BLOBSTREAMING_PLUGINS_EXIST');
|
||||
|
||||
// Check parameters
|
||||
PMA_checkParameters(array('db', 'table', 'goto'));
|
||||
@ -241,31 +240,6 @@ foreach ($loop_array as $rownumber => $where_clause) {
|
||||
|
||||
include './libraries/tbl_replace_fields.inc.php';
|
||||
|
||||
// for blobstreaming
|
||||
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;
|
||||
|
||||
// checks if an existing blob repository reference should be removed
|
||||
if (isset($remove_blob_repo) && ! isset($upload_blob_repo)) {
|
||||
$remove_blob_reference = $_REQUEST['remove_blob_ref_' . $key];
|
||||
if (isset($remove_blob_reference)) {
|
||||
$val = "NULL";
|
||||
}
|
||||
}
|
||||
|
||||
// checks if this field requires a bs reference attached to it
|
||||
if (isset($upload_blob_repo)) {
|
||||
// get the most recent BLOB reference
|
||||
$bs_reference = PMA_File::getRecentBLOBReference();
|
||||
|
||||
// if the most recent BLOB reference exists, set it as a field value
|
||||
if (!is_null($bs_reference)) {
|
||||
$val = "'" . PMA_sqlAddSlashes($bs_reference) . "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($me_funcs[$key])) {
|
||||
$cur_value = $val;
|
||||
} elseif ('UUID' === $me_funcs[$key]) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user