Skip to content

Commit

Permalink
Bug #3591442 Fatal error when dropping table
Browse files Browse the repository at this point in the history
  • Loading branch information
lem9 committed Dec 10, 2012
1 parent 181db4a commit 7ff92fd
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 57 deletions.
57 changes: 57 additions & 0 deletions libraries/Util.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4064,5 +4064,62 @@ public static function parseEnumSetValues($definition)

return $values;
}

/**
* fills given tooltip arrays
*
* @param array &$tooltip_truename tooltip data
* @param array &$tooltip_aliasname tooltip data
* @param array $table tabledata
*
* @return void
*/
public static function PMA_fillTooltip(
&$tooltip_truename, &$tooltip_aliasname, $table)
{
if (strstr($table['Comment'], '; InnoDB free') === false) {
if (!strstr($table['Comment'], 'InnoDB free') === false) {
// here we have just InnoDB generated part
$table['Comment'] = '';
}
} else {
// remove InnoDB comment from end, just the minimal part
// (*? is non greedy)
$table['Comment'] = preg_replace(
'@; InnoDB free:.*?$@', '', $table['Comment']
);
}
// views have VIEW as comment so it's not a real comment put by a user
if ('VIEW' == $table['Comment']) {
$table['Comment'] = '';
}
if (empty($table['Comment'])) {
$table['Comment'] = $table['Name'];
} else {
// todo: why?
$table['Comment'] .= ' ';
}

$tooltip_truename[$table['Name']] = $table['Name'];
$tooltip_aliasname[$table['Name']] = $table['Comment'];

if (isset($table['Create_time']) && !empty($table['Create_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Creation')
. ': '
. PMA_Util::localisedDate(strtotime($table['Create_time']));
}

if (! empty($table['Update_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Last update')
. ': '
. PMA_Util::localisedDate(strtotime($table['Update_time']));
}

if (! empty($table['Check_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Last check')
. ': '
. PMA_Util::localisedDate(strtotime($table['Check_time']));
}
}
}
?>
61 changes: 4 additions & 57 deletions libraries/db_info.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,61 +29,6 @@
}
$pos = $_SESSION['tmp_user_values']['table_limit_offset'];

/**
* fills given tooltip arrays
*
* @param array &$tooltip_truename tooltip data
* @param array &$tooltip_aliasname tooltip data
* @param array $table tabledata
*
* @return void
*/
function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table)
{
if (strstr($table['Comment'], '; InnoDB free') === false) {
if (!strstr($table['Comment'], 'InnoDB free') === false) {
// here we have just InnoDB generated part
$table['Comment'] = '';
}
} else {
// remove InnoDB comment from end, just the minimal part (*? is non greedy)
$table['Comment'] = preg_replace(
'@; InnoDB free:.*?$@', '', $table['Comment']
);
}
// views have VIEW as comment so it's not a real comment put by a user
if ('VIEW' == $table['Comment']) {
$table['Comment'] = '';
}
if (empty($table['Comment'])) {
$table['Comment'] = $table['Name'];
} else {
// why?
$table['Comment'] .= ' ';
}

$tooltip_truename[$table['Name']] = $table['Name'];
$tooltip_aliasname[$table['Name']] = $table['Comment'];

if (isset($table['Create_time']) && !empty($table['Create_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Creation')
. ': '
. PMA_Util::localisedDate(strtotime($table['Create_time']));
}

if (! empty($table['Update_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Last update')
. ': '
. PMA_Util::localisedDate(strtotime($table['Update_time']));
}

if (! empty($table['Check_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Last check')
. ': '
. PMA_Util::localisedDate(strtotime($table['Check_time']));
}
}

PMA_Util::checkParameters(array('db'));

/**
Expand Down Expand Up @@ -164,7 +109,7 @@ function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table)
}

if ($cfg['ShowTooltip']) {
PMA_fillTooltip(
PMA_Util::PMA_fillTooltip(

This comment has been minimized.

Copy link
@roccivic

roccivic Dec 10, 2012

Contributor

Seems redundant to have the PMA_ prefix twice here...

This comment has been minimized.

Copy link
@lem9

lem9 Dec 10, 2012

Author Contributor

Indeed; now fixed.

$tooltip_truename, $tooltip_aliasname, $sts_tmp
);
}
Expand Down Expand Up @@ -250,7 +195,9 @@ function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table)

if ($cfg['ShowTooltip']) {
foreach ($tables as $each_table) {
PMA_fillTooltip($tooltip_truename, $tooltip_aliasname, $each_table);
PMA_Util::PMA_fillTooltip(
$tooltip_truename, $tooltip_aliasname, $each_table
);
}
}
}
Expand Down

0 comments on commit 7ff92fd

Please sign in to comment.