25
25
$PMA_Config = $_SESSION['PMA_Config'];
27
27
// return if unable to load PMA configuration
28
if (empty($PMA_Config))
28
if (empty($PMA_Config)) {
31
// retrieve current server configuration
32
$serverCfg = $PMA_Config->get('Servers');
34
if (isset($serverCfg[$GLOBALS['server']]))
35
$serverCfg = $serverCfg[$GLOBALS['server']];
32
// At this point we might already know that plugins do not exist
33
// because this was recorded in the session (cache).
34
if (PMA_cacheGet('skip_blobstreaming', true)) {
38
// If we don't know that we can skip blobstreaming, we continue
39
// verifications; anyway, in case we won't skip blobstreaming,
40
// we still need to set some variables in non-persistent settings,
41
// which is done via $PMA_Config->set().
43
/** Retrieve current server configuration;
44
* at this point, $PMA_Config->get('Servers') contains the server parameters
45
* as explicitely defined in config.inc.php, so it cannot be used; it's
46
* better to use $GLOBALS['cfg']['Server'] which contains the explicit
47
* parameters merged with the default ones
50
$serverCfg = $GLOBALS['cfg']['Server'];
39
52
// return if unable to retrieve current server configuration
40
if (!isset($serverCfg))
43
57
// if PHP extension in use is 'mysql', specify element 'PersistentConnections'
44
if (isset($serverCfg['extension']) && "mysql" == $serverCfg['extension'])
58
if ($serverCfg['extension'] == "mysql") {
45
59
$serverCfg['PersistentConnections'] = $PMA_Config->settings['PersistentConnections'];
47
62
// if connection type is TCP, unload socket variable
48
if (isset($serverCfg['connect_type']) && "tcp" == strtolower($serverCfg['connect_type']))
63
if (strtolower($serverCfg['connect_type']) == "tcp") {
49
64
$serverCfg['socket'] = "";
51
// define BS Plugin variables
52
$allPluginsExist = TRUE;
54
$PMA_Config->set('PBXT_NAME', 'pbxt');
55
$PMA_Config->set('PBMS_NAME', 'pbms');
57
$plugins[$PMA_Config->get('PBXT_NAME')]['Library'] = 'libpbxt.so';
58
$plugins[$PMA_Config->get('PBXT_NAME')]['Exists'] = FALSE;
60
$plugins[$PMA_Config->get('PBMS_NAME')]['Library'] = 'libpbms.so';
61
$plugins[$PMA_Config->get('PBMS_NAME')]['Exists'] = FALSE;
63
// retrieve state of BS plugins
64
PMA_PluginsExist($plugins);
66
foreach ($plugins as $plugin_key=>$plugin)
67
if (!$plugin['Exists'])
69
$allPluginsExist = FALSE;
71
} // end if (!$plugin['Exists'])
73
// set variable indicating BS plugin existance
67
$allPluginsExist = false;
68
if (PMA_MYSQL_INT_VERSION >= 50109) {
69
$PMA_Config->set('PBXT_NAME', 'pbxt');
70
$PMA_Config->set('PBMS_NAME', 'pbms');
72
$required_plugins[$PMA_Config->get('PBXT_NAME')]['Library'] = 'libpbxt.so';
73
$required_plugins[$PMA_Config->get('PBMS_NAME')]['Library'] = 'libpbms.so';
74
$number_of_required_plugins_found = 0;
76
// Retrieve MySQL plugins
77
$existing_plugins = PMA_DBI_fetch_result('SHOW PLUGINS');
79
foreach ($existing_plugins as $one_existing_plugin) {
80
// check if required plugins exist
81
foreach ($required_plugins as $one_required_plugin) {
82
if ( strtolower($one_existing_plugin['Library']) == strtolower($one_required_plugin['Library'])
83
&& $one_existing_plugin['Status'] == "ACTIVE") {
84
$number_of_required_plugins_found++;
87
if (2 == $number_of_required_plugins_found) {
88
$allPluginsExist = true;
92
unset($required_plugins, $existing_plugins, $one_required_plugin, $one_existing_plugin, $number_of_required_plugins_found);
95
// set variable indicating BS plugin existence
74
96
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', $allPluginsExist);
76
// do the plugins exist?
98
if ($allPluginsExist) {
79
99
// retrieve BS variables from PMA configuration
80
100
$bs_set_variables = array();
90
110
// retrieve updated BS variables (configurable and unconfigurable)
91
111
$bs_variables = PMA_BS_GetVariables();
93
// if no BS variables exist, set plugin existance to false and return
94
if (count($bs_variables) <= 0)
113
// if no BS variables exist, set plugin existence to false and return
114
if (count($bs_variables) <= 0) {
96
115
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', FALSE);
116
PMA_cacheSet('skip_blobstreaming', true, true);
98
118
} // end if (count($bs_variables) <= 0)
100
120
// switch on BS field references
101
if (strtolower($bs_variables[$PMA_Config->get('PBMS_NAME') . '_field_references']) == "off")
102
if(!PMA_BS_SetFieldReferences('ON'))
121
if (strtolower($bs_variables[$PMA_Config->get('PBMS_NAME') . '_field_references']) == "off") {
122
if (! PMA_BS_SetFieldReferences('ON')) {
123
PMA_cacheSet('skip_blobstreaming', true, true);
105
128
// get BS server port
106
129
$BS_PORT = $bs_variables[$PMA_Config->get('PBMS_NAME') . '_port'];
108
131
// if no BS server port exists, set plugin existance to false and return
111
133
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', FALSE);
134
PMA_cacheSet('skip_blobstreaming', true, true);
113
136
} // end if (!$BS_PORT)
255
275
$PMA_Config->set('BLOBSTREAMABLE_DATABASES', $bs_databases);
259
* checks whether a set of plugins exist
262
* @param array - a list of plugin names and accompanying library filenames to check for
263
* @uses PMA_DBI_query()
264
* @uses PMA_DBI_fetch_assoc()
266
function PMA_PluginsExist(&$plugins)
268
if (PMA_MYSQL_INT_VERSION < 50109) {
271
// run query to retrieve MySQL plugins
272
$query = "SHOW PLUGINS";
273
$result = PMA_DBI_query($query);
275
// while there are records to parse
276
while ($data = @PMA_DBI_fetch_assoc($result))
278
// reset plugin state
281
// check if required plugins exist
282
foreach ($plugins as $plugin_key=>$plugin)
283
if (!$plugin['Exists'])
285
strtolower($data['Library']) == strtolower($plugin['Library']) &&
286
$data['Status'] == "ACTIVE"
288
$plugins[$plugin_key]['Exists'] = TRUE;
293
// break if all necessary plugins are found before all records are parsed
296
} // end while ($data = @PMA_DBI_fetch_assoc($result))
300
281
* checks whether a given set of tables exist in a given database