diff --git a/Documentation.html b/Documentation.html index 2f937e2b3e..f3f2c462f1 100644 --- a/Documentation.html +++ b/Documentation.html @@ -81,9 +81,6 @@ vim: expandtab ts=4 sw=4 sts=4 tw=78
  • To support upload progress bars, see FAQ 2.9.
  • -
  • To support BLOB streaming, see PHP and MySQL requirements - in - FAQ 6.25.
  • To support XML and Open Document Spreadsheet importing, you need PHP 5.2.17 or newer and the libxml extension.
  • @@ -4337,25 +4334,7 @@ INSERT INTO REL_towns VALUES ('M', 'Montréal'); ones is done whenever you enter Structure page for this table.

    - 6.25 How does BLOB streaming work in phpMyAdmin?

    - -

    For general information about BLOB streaming on MySQL, visit blobstreaming.org. You need the following components:

    - - -

    Here are details about configuration and operation:

    - -
      -
    1. In config.inc.php your host should be defined with a FQDN (fully qualified domain name) instead of "localhost".
    2. -
    3. Ensure that your target table is under the PBXT storage engine and has a LONGBLOB column (which must be nullable if you want to remove the BLOB reference from it).
    4. -
    5. 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.
    6. -
    7. 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.
    8. -
    + 6.25 (withdrawn).

    6.26 How can I select a range of rows?

    @@ -4920,7 +4899,7 @@ along with this program. If not, see htt
  • Raj Kissu Rajandran (Google Summer of Code 2008)
  • Piotr Przybylski (Google Summer of Code 2008, 2010 and 2011) @@ -4974,7 +4953,7 @@ along with this program. If not, see htt
  • Barrie Leslie
  • Ankit Gupta (Google Summer of Code 2010) diff --git a/bs_disp_as_mime_type.php b/bs_disp_as_mime_type.php deleted file mode 100644 index 5284e553fa..0000000000 --- a/bs_disp_as_mime_type.php +++ /dev/null @@ -1,63 +0,0 @@ -= $f_size) { - break; - } -} - -echo $content; -flush(); - -fclose($fHnd); diff --git a/bs_play_media.php b/bs_play_media.php deleted file mode 100644 index d9ba62ae90..0000000000 --- a/bs_play_media.php +++ /dev/null @@ -1,66 +0,0 @@ - $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!')); - } - } - ?> - - - - - - - - diff --git a/db_operations.php b/db_operations.php index e4c559119a..6b8ae78974 100644 --- a/db_operations.php +++ b/db_operations.php @@ -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'; diff --git a/db_structure.php b/db_structure.php index 2ddf775b96..14586833b5 100644 --- a/db_structure.php +++ b/db_structure.php @@ -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) { diff --git a/js/functions.js b/js/functions.js index ae702d31ae..d07410037e 100644 --- a/js/functions.js +++ b/js/functions.js @@ -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 */ diff --git a/js/messages.php b/js/messages.php index 7b10563258..aa7c56ef81 100644 --- a/js/messages.php +++ b/js/messages.php @@ -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!'); diff --git a/libraries/File.class.php b/libraries/File.class.php index 3745866929..11a1a04167 100644 --- a/libraries/File.class.php +++ b/libraries/File.class.php @@ -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; - } } ?> diff --git a/libraries/blobstreaming.lib.php b/libraries/blobstreaming.lib.php deleted file mode 100644 index 8d416d8626..0000000000 --- a/libraries/blobstreaming.lib.php +++ /dev/null @@ -1,582 +0,0 @@ -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 .= ' (' - . __('View image') . ')'; - break; - // audio content - case 'audio/mpeg': - $output .= ' (' . __('Play audio') - . ')'; - break; - // video content - case 'application/x-flash-video': - case 'video/mpeg': - $output .= ' (' . __('View video') - . ')'; - break; - // unsupported content. specify download - default: - $output .= ' (' - . __('Download file') . ')'; - } - - 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; -} - -?> diff --git a/libraries/common.inc.php b/libraries/common.inc.php index ad5d613279..ea14f94800 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -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 diff --git a/libraries/common.lib.php b/libraries/common.lib.php index cd56d03f49..ed9947abeb 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -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, diff --git a/libraries/core.lib.php b/libraries/core.lib.php index 9587071b96..db8e9d821b 100644 --- a/libraries/core.lib.php +++ b/libraries/core.lib.php @@ -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; diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 63121ac73a..8eb35e9a32 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -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); diff --git a/libraries/engines/pbms.lib.php b/libraries/engines/pbms.lib.php deleted file mode 100644 index e86c29186c..0000000000 --- a/libraries/engines/pbms.lib.php +++ /dev/null @@ -1,106 +0,0 @@ -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 = '

    ' - . sprintf(__('Documentation and further information about PBMS can be found on %sThe PrimeBase Media Streaming home page%s.'), '', '') - . '

    ' . "\n" - . '

    ' . __('Related Links') . '

    ' . "\n" - . '' . "\n"; - - return $output; - } -} - -?> diff --git a/libraries/engines/pbxt.lib.php b/libraries/engines/pbxt.lib.php index 847d49091c..feb021a94c 100644 --- a/libraries/engines/pbxt.lib.php +++ b/libraries/engines/pbxt.lib.php @@ -127,7 +127,6 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine . '

    ' . __('Related Links') . '

    ' . "\n" . '' . "\n"; return $output; diff --git a/server_engines.php b/server_engines.php index 9dcfc12cf4..d7fd4ce4e0 100644 --- a/server_engines.php +++ b/server_engines.php @@ -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 '' . "\n" - . ' ' . "\n" - . ' ' . "PBMS\n" - . ' ' . "\n" - . ' ' . htmlspecialchars("PrimeBase MediaStream (PBMS) daemon") . '' . "\n" - . '' . "\n"; - } - unset($odd_row, $engine, $details); echo '' . "\n" . '' . "\n"; diff --git a/tbl_change.php b/tbl_change.php index 2cffd16ebd..bcd798071b 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -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 ''; - echo ' ' . __('Remove BLOB Repository Reference') . "
    "; - echo PMA_BS_CreateReferenceLink($data, $db); - echo "
    "; - } 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); + } ?> @@ -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 '
    '; - echo ' ' . __('Upload to BLOB repository'); - } - echo '
    '; echo ' '; diff --git a/tbl_replace.php b/tbl_replace.php index 6ba156de56..28e31e11c6 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -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]) {