Resolve conflicts due to changes in some method names

This commit is contained in:
Chanaka Indrajith 2012-05-13 12:47:45 +05:30
commit f04a4f8989
17 changed files with 414 additions and 224 deletions

View File

@ -67,28 +67,28 @@ class PMA_Error extends PMA_Message
*
* @var string
*/
protected $_file = '';
protected $file = '';
/**
* The line in which the error occured
*
* @var integer
*/
protected $_line = 0;
protected $line = 0;
/**
* Holds the backtrace for this error
*
* @var array
*/
protected $_backtrace = array();
protected $backtrace = array();
/**
* Unique id
*
* @var string
*/
protected $_hash = null;
protected $hash = null;
/**
* Constructor
@ -122,7 +122,7 @@ class PMA_Error extends PMA_Message
*/
public function setBacktrace($backtrace)
{
$this->_backtrace = $backtrace;
$this->backtrace = $backtrace;
}
/**
@ -134,7 +134,7 @@ class PMA_Error extends PMA_Message
*/
public function setLine($line)
{
$this->_line = $line;
$this->line = $line;
}
/**
@ -146,14 +146,14 @@ class PMA_Error extends PMA_Message
*/
public function setFile($file)
{
$this->_file = PMA_Error::relPath($file);
$this->file = PMA_Error::relPath($file);
}
/**
* returns unique PMA_Error::$_hash, if not exists it will be created
* returns unique PMA_Error::$hash, if not exists it will be created
*
* @return string PMA_Error::$_hash
* @return string PMA_Error::$hash
*/
public function getHash()
{
@ -162,8 +162,8 @@ class PMA_Error extends PMA_Message
} catch(Exception $e){
$backtrace = '';
}
if (null === $this->_hash) {
$this->_hash = md5(
if ($this->hash === null) {
$this->hash = md5(
$this->getNumber() .
$this->getMessage() .
$this->getFile() .
@ -172,7 +172,7 @@ class PMA_Error extends PMA_Message
);
}
return $this->_hash;
return $this->hash;
}
/**
@ -182,27 +182,27 @@ class PMA_Error extends PMA_Message
*/
public function getBacktrace()
{
return $this->_backtrace;
return $this->backtrace;
}
/**
* returns PMA_Error::$_file
* returns PMA_Error::$file
*
* @return string PMA_Error::$_file
* @return string PMA_Error::$file
*/
public function getFile()
{
return $this->_file;
return $this->file;
}
/**
* returns PMA_Error::$_line
* returns PMA_Error::$line
*
* @return integer PMA_Error::$_line
* @return integer PMA_Error::$line
*/
public function getLine()
{
return $this->_line;
return $this->line;
}
/**
@ -246,45 +246,52 @@ class PMA_Error extends PMA_Message
}
/**
* Display HTML backtrace
* Get HTML backtrace
*
* @return void
*/
public function displayBacktrace()
public function getBacktraceDisplay()
{
$retval = '';
foreach ($this->getBacktrace() as $step) {
echo PMA_Error::relPath($step['file']) . '#' . $step['line'] . ': ';
$retval .= PMA_Error::relPath($step['file']) . '#' . $step['line'] . ': ';
if (isset($step['class'])) {
echo $step['class'] . $step['type'];
$retval .= $step['class'] . $step['type'];
}
echo $step['function'] . '(';
$retval .= $step['function'] . '(';
if (isset($step['args']) && (count($step['args']) > 1)) {
echo "<br />\n";
$retval .= "<br />\n";
foreach ($step['args'] as $arg) {
echo "\t";
$this->displayArg($arg, $step['function']);
echo ',' . "<br />\n";
$retval .= "\t";
$retval .= $this->getArg($arg, $step['function']);
$retval .= ',' . "<br />\n";
}
} elseif (isset($step['args']) && (count($step['args']) > 0)) {
foreach ($step['args'] as $arg) {
$this->displayArg($arg, $step['function']);
$retval .= $this->getArg($arg, $step['function']);
}
}
echo ')' . "<br />\n";
$retval .= ')' . "<br />\n";
}
return $retval;
}
/**
* Display a single function argument
* if $function is one of include/require the $arg is converted te relative path
* Get a single function argument
*
* if $function is one of include/require
* the $arg is converted to a relative path
*
* @param string $arg
* @param string $function
*
* @return void
* @return string
*/
protected function displayArg($arg, $function)
protected function getArg($arg, $function)
{
$retval = '';
$include_functions = array(
'include',
'include_once',
@ -293,37 +300,40 @@ class PMA_Error extends PMA_Message
);
if (in_array($function, $include_functions)) {
echo PMA_Error::relPath($arg);
$retval .= PMA_Error::relPath($arg);
} elseif (is_scalar($arg)) {
echo gettype($arg) . ' ' . htmlspecialchars($arg);
$retval .= getType($arg) . ' ' . htmlspecialchars($arg);
} else {
echo gettype($arg);
$retval .= getType($arg);
}
return $retval;
}
/**
* Displays the error in HTML
* Gets the error as string of HTML
*
* @return void
* @return string
*/
public function display()
public function getDisplay()
{
echo '<div class="' . $this->getLevel() . '">';
$retval = '<div class="' . $this->getLevel() . '">';
if (! $this->isUserError()) {
echo '<strong>' . $this->getType() . '</strong>';
echo ' in ' . $this->getFile() . '#' . $this->getLine();
echo "<br />\n";
$retval .= '<strong>' . $this->getType() . '</strong>';
$retval .= ' in ' . $this->getFile() . '#' . $this->getLine();
$retval .= "<br />\n";
}
echo $this->getMessage();
$retval .= $this->getMessage();
if (! $this->isUserError()) {
echo "<br />\n";
echo "<br />\n";
echo "<strong>Backtrace</strong><br />\n";
echo "<br />\n";
echo $this->displayBacktrace();
$retval .= "<br />\n";
$retval .= "<br />\n";
$retval .= "<strong>Backtrace</strong><br />\n";
$retval .= "<br />\n";
$retval .= $this->getBacktraceDisplay();
}
echo '</div>';
$this->isDisplayed(true);
$retval .= '</div>';
return $retval;
}
/**
@ -357,7 +367,10 @@ class PMA_Error extends PMA_Message
$path_separator = '/';
}
$Ahere = explode($path_separator, realpath(dirname(__FILE__) . $path_separator . '..'));
$Ahere = explode(
$path_separator,
realpath(dirname(__FILE__) . $path_separator . '..')
);
$Adest = explode($path_separator, $dest);
$result = '.';
@ -371,7 +384,11 @@ class PMA_Error extends PMA_Message
}
}
$path = $result . str_replace(implode($path_separator, $Adest), '', $dest);
return str_replace($path_separator . $path_separator, $path_separator, $path);
return str_replace(
$path_separator . $path_separator,
$path_separator,
$path
);
}
}
?>

View File

@ -23,7 +23,7 @@ class PMA_Error_Handler
*
* @var array of PMA_Error
*/
protected $_errors = array();
protected $errors = array();
/**
* Constructor - set PHP error handler
@ -49,13 +49,16 @@ class PMA_Error_Handler
if ($GLOBALS['cfg']['Error_Handler']['gather']) {
// remember all errors
$_SESSION['errors'] = array_merge($_SESSION['errors'], $this->_errors);
$_SESSION['errors'] = array_merge(
$_SESSION['errors'],
$this->errors
);
} else {
// remember only not displayed errors
foreach ($this->_errors as $key => $error) {
foreach ($this->errors as $key => $error) {
/**
* We don't want to store all errors here as it would explode user
* session. In case you want them all set
* We don't want to store all errors here as it would
* explode user session. In case you want them all set
* $GLOBALS['cfg']['Error_Handler']['gather'] to true
*/
if (count($_SESSION['errors']) >= 20) {
@ -77,8 +80,8 @@ class PMA_Error_Handler
*/
protected function getErrors()
{
$this->_checkSavedErrors();
return $this->_errors;
$this->checkSavedErrors();
return $this->errors;
}
/**
@ -102,10 +105,15 @@ class PMA_Error_Handler
public function handleError($errno, $errstr, $errfile, $errline)
{
// create error object
$error = new PMA_Error($errno, htmlspecialchars($errstr), $errfile, $errline);
$error = new PMA_Error(
$errno,
htmlspecialchars($errstr),
$errfile,
$errline
);
// do not repeat errors
$this->_errors[$error->getHash()] = $error;
$this->errors[$error->getHash()] = $error;
switch ($error->getNumber()) {
case E_USER_NOTICE:
@ -127,7 +135,7 @@ class PMA_Error_Handler
case E_COMPILE_ERROR:
default:
// FATAL error, dislay it and exit
$this->_dispFatalError($error);
$this->dispFatalError($error);
exit;
break;
}
@ -142,7 +150,7 @@ class PMA_Error_Handler
*
* @todo finish!
*/
protected function _logError($error)
protected function logError($error)
{
return error_log($error->getMessage());
}
@ -152,14 +160,16 @@ class PMA_Error_Handler
*
* @param string $errorInfo error message
* @param integer $errorNumber error number
* @param string $file
* @param integer $line
* @param string $file file name
* @param integer $line line number
*
* @return void
*/
public function triggerError($errorInfo, $errorNumber = null, $file = null, $line = null)
{
// we could also extract file and line from backtrace and call handleError() directly
public function triggerError($errorInfo, $errorNumber = null,
$file = null, $line = null
) {
// we could also extract file and line from backtrace
// and call handleError() directly
trigger_error($errorInfo, $errorNumber);
}
@ -170,13 +180,13 @@ class PMA_Error_Handler
*
* @return void
*/
protected function _dispFatalError($error)
protected function dispFatalError($error)
{
if (! headers_sent()) {
$this->_dispPageStart($error);
$this->dispPageStart($error);
}
$error->display();
$this->_dispPageEnd();
$this->dispPageEnd();
exit;
}
@ -188,10 +198,10 @@ class PMA_Error_Handler
public function dispErrorPage()
{
if (! headers_sent()) {
$this->_dispPageStart();
$this->dispPageStart();
}
$this->dispAllErrors();
$this->_dispPageEnd();
$this->dispPageEnd();
}
/**
@ -215,7 +225,7 @@ class PMA_Error_Handler
*
* @return void
*/
protected function _dispPageStart($error = null)
protected function dispPageStart($error = null)
{
echo '<html><head><title>';
if ($error) {
@ -231,7 +241,7 @@ class PMA_Error_Handler
*
* @return void
*/
protected function _dispPageEnd()
protected function dispPageEnd()
{
echo '</body></html>';
}
@ -275,17 +285,17 @@ class PMA_Error_Handler
*
* @return void
*/
protected function _checkSavedErrors()
protected function checkSavedErrors()
{
if (isset($_SESSION['errors'])) {
// restore saved errors
foreach ($_SESSION['errors'] as $hash => $error) {
if ($error instanceof PMA_Error && ! isset($this->_errors[$hash])) {
$this->_errors[$hash] = $error;
if ($error instanceof PMA_Error && ! isset($this->errors[$hash])) {
$this->errors[$hash] = $error;
}
}
//$this->_errors = array_merge($_SESSION['errors'], $this->_errors);
//$this->errors = array_merge($_SESSION['errors'], $this->errors);
// delet stored errors
$_SESSION['errors'] = array();

View File

@ -10,9 +10,9 @@ if (! defined('PHPMYADMIN')) {
}
/**
* @since phpMyAdmin 3.0.0
*
* @package PhpMyAdmin
* @since phpMyAdmin 3.0.0
*/
class PMA_Index
{

View File

@ -11,9 +11,9 @@ if (! defined('PHPMYADMIN')) {
/**
* @todo add caching
* @since phpMyAdmin 2.9.10
* @abstract
* @package PhpMyAdmin
* @since phpMyAdmin 2.9.10
*/
abstract class PMA_List extends ArrayObject
{

View File

@ -24,8 +24,9 @@ require_once './libraries/List.class.php';
* @todo this object should be attached to the PMA_Server object
* @todo ? make use of INFORMATION_SCHEMA
* @todo ? support --skip-showdatabases and user has only global rights
* @since phpMyAdmin 2.9.10
*
* @package PhpMyAdmin
* @since phpMyAdmin 2.9.10
*/
class PMA_List_Database extends PMA_List
{

View File

@ -54,6 +54,7 @@
* // strSomeLocaleMessage <sup>1</sup> strSomeMoreLocale<br />
* // strSomeEvenMoreLocale - some final words
* </code>
*
* @package PhpMyAdmin
*/
class PMA_Message
@ -116,7 +117,7 @@ class PMA_Message
* @access protected
* @var string
*/
protected $_hash = null;
protected $hash = null;
/**
* holds parameters
@ -137,10 +138,11 @@ class PMA_Message
/**
* Constructor
*
* @param string $string
* @param integer $number
* @param array $params
* @param integer $sanitize
* @param string $string The message to be displayed
* @param integer $number A numeric representation of the type of message
* @param array $params An array of parameters to use in the message
* @param integer $sanitize A flag to indicate what to sanitize, see
* constant definitions above
*/
public function __construct($string = '', $number = PMA_Message::NOTICE,
$params = array(), $sanitize = PMA_Message::SANITIZE_NONE
@ -165,8 +167,9 @@ class PMA_Message
*
* shorthand for getting a simple success message
*
* @param string $string a localized string
* e.g. __('Your SQL query has been executed successfully')
* @param string $string A localized string
* e.g. __('Your SQL query has been
* executed successfully')
*
* @return PMA_Message
* @static
@ -185,7 +188,7 @@ class PMA_Message
*
* shorthand for getting a simple error message
*
* @param string $string a localized string e.g. __('Error')
* @param string $string A localized string e.g. __('Error')
*
* @return PMA_Message
* @static
@ -204,9 +207,10 @@ class PMA_Message
*
* shorthand for getting a simple notice message
*
* @param string $string a localized string
* e.g. __('The additional features for working with linked
* tables have been deactivated. To find out why click %shere%s.')
* @param string $string A localized string
* e.g. __('The additional features for working with
* linked tables have been deactivated. To find out
* why click %shere%s.')
*
* @return PMA_Message
* @static
@ -221,8 +225,8 @@ class PMA_Message
*
* shorthand for getting a customized message
*
* @param string $message
* @param integer $type
* @param string $message A localized string
* @param integer $type A numeric representation of the type of message
*
* @return PMA_Message
* @static
@ -246,7 +250,9 @@ class PMA_Message
*/
static public function affected_rows($rows)
{
$message = PMA_Message::success(_ngettext('%1$d row affected.', '%1$d rows affected.', $rows));
$message = PMA_Message::success(
_ngettext('%1$d row affected.', '%1$d rows affected.', $rows)
);
$message->addParam($rows);
return $message;
}
@ -263,7 +269,9 @@ class PMA_Message
*/
static public function deleted_rows($rows)
{
$message = PMA_Message::success(_ngettext('%1$d row deleted.', '%1$d rows deleted.', $rows));
$message = PMA_Message::success(
_ngettext('%1$d row deleted.', '%1$d rows deleted.', $rows)
);
$message->addParam($rows);
return $message;
}
@ -280,7 +288,9 @@ class PMA_Message
*/
static public function inserted_rows($rows)
{
$message = PMA_Message::success(_ngettext('%1$d row inserted.', '%1$d rows inserted.', $rows));
$message = PMA_Message::success(
_ngettext('%1$d row inserted.', '%1$d rows inserted.', $rows)
);
$message->addParam($rows);
return $message;
}
@ -290,7 +300,7 @@ class PMA_Message
*
* shorthand for getting a customized error message
*
* @param string $message
* @param string $message A localized string
*
* @return PMA_Message
* @static
@ -305,7 +315,7 @@ class PMA_Message
*
* shorthand for getting a customized notice message
*
* @param string $message
* @param string $message A localized string
*
* @return PMA_Message
* @static
@ -320,7 +330,7 @@ class PMA_Message
*
* shorthand for getting a customized success message
*
* @param string $message
* @param string $message A localized string
*
* @return PMA_Message
* @static
@ -334,7 +344,7 @@ class PMA_Message
* returns whether this message is a success message or not
* and optionaly makes this message a success message
*
* @param boolean $set
* @param boolean $set Whether to make this message of SUCCESS type
*
* @return boolean whether this is a success message or not
*/
@ -351,7 +361,7 @@ class PMA_Message
* returns whether this message is a notice message or not
* and optionally makes this message a notice message
*
* @param boolean $set
* @param boolean $set Whether to make this message of NOTICE type
*
* @return boolean whether this is a notice message or not
*/
@ -368,9 +378,9 @@ class PMA_Message
* returns whether this message is an error message or not
* and optionally makes this message an error message
*
* @param boolean $set
* @param boolean $set Whether to make this message of ERROR type
*
* @return boolean whether this is an error message or not
* @return boolean Whether this is an error message or not
*/
public function isError($set = false)
{
@ -384,8 +394,10 @@ class PMA_Message
/**
* set raw message (overrides string)
*
* @param string $message
* @param boolean $sanitize whether to sanitize $message or not
* @param string $message A localized string
* @param boolean $sanitize Whether to sanitize $message or not
*
* @return void
*/
public function setMessage($message, $sanitize = false)
{
@ -398,9 +410,11 @@ class PMA_Message
/**
* set string (does not take effect if raw message is set)
*
* @param string $_string
* @param string $_string
*
* @param boolean $sanitize whether to sanitize $string or not
*
* @return void
*/
public function setString($_string, $sanitize = true)
{
@ -588,21 +602,21 @@ class PMA_Message
}
/**
* returns unique PMA_Message::$_hash, if not exists it will be created
* returns unique PMA_Message::$hash, if not exists it will be created
*
* @return string PMA_Message::$_hash
* @return string PMA_Message::$hash
*/
public function getHash()
{
if (null === $this->_hash) {
$this->_hash = md5(
if (null === $this->hash) {
$this->hash = md5(
$this->getNumber() .
$this->_string .
$this->_message
);
}
return $this->_hash;
return $this->hash;
}
/**
@ -671,6 +685,7 @@ class PMA_Message
/**
* Displays the message in HTML
*
* @return void
*/
public function display()
{

View File

@ -1,6 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Holds the PMA_Table class
*
* @package PhpMyAdmin
*/
@ -9,6 +10,8 @@ if (! defined('PHPMYADMIN')) {
}
/**
* Handles everything related to tables
*
* @todo make use of PMA_Message and PMA_Error
* @package PhpMyAdmin
*/
@ -307,6 +310,15 @@ class PMA_Table
return in_array(strtoupper($engine), array('MERGE', 'MRG_MYISAM'));
}
/**
* Returns tooltip for the table
* Format : <table_comment> (<number_of_rows>)
*
* @param string $db database name
* @param string $table table name
*
* @return string tooltip fot the table
*/
static public function sGetToolTip($db, $table)
{
return PMA_Table::sGetStatusInfo($db, $table, 'Comment')
@ -320,7 +332,7 @@ class PMA_Table
*
* @param string $db database name
* @param string $table table name
* @param string $info
* @param string $info specific information to be fetched
* @param boolean $force_read read new rather than serving from cache
* @param boolean $disable_error if true, disables error message
*
@ -329,8 +341,9 @@ class PMA_Table
*
* @return mixed
*/
static public function sGetStatusInfo($db, $table, $info = null, $force_read = false, $disable_error = false)
{
static public function sGetStatusInfo($db, $table, $info = null,
$force_read = false, $disable_error = false
) {
if (! isset(PMA_Table::$cache[$db][$table]) || $force_read) {
PMA_DBI_get_tables_full($db, $table);
}
@ -365,7 +378,7 @@ class PMA_Table
*
* @param string $name name
* @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
* @param string $index
* @param string $index index
* @param string $length length ('2', '5,2', '', ...)
* @param string $attribute attribute
* @param string $collation collation
@ -385,10 +398,10 @@ class PMA_Table
*
* @return string field specification
*/
static function generateFieldSpec($name, $type, $index, $length = '', $attribute = '',
$collation = '', $null = false, $default_type = 'USER_DEFINED',
$default_value = '', $extra = '', $comment = '',
&$field_primary = null, $move_to = ''
static function generateFieldSpec($name, $type, $index, $length = '',
$attribute = '', $collation = '', $null = false,
$default_type = 'USER_DEFINED', $default_value = '', $extra = '',
$comment = '', &$field_primary = null, $move_to = ''
) {
$is_timestamp = strpos(strtoupper($type), 'TIMESTAMP') !== false;
@ -397,7 +410,8 @@ class PMA_Table
if ($length != ''
&& ! preg_match(
'@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|'
. 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN|UUID)$@i', $type
. 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN|UUID)$@i',
$type
)
) {
$query .= '(' . $length . ')';
@ -407,9 +421,11 @@ class PMA_Table
$query .= ' ' . $attribute;
}
if (! empty($collation) && $collation != 'NULL'
&& preg_match('@^(TINYTEXT|TEXT|MEDIUMTEXT|LONGTEXT|VARCHAR|CHAR|ENUM|SET)$@i', $type)
) {
$matches = preg_match(
'@^(TINYTEXT|TEXT|MEDIUMTEXT|LONGTEXT|VARCHAR|CHAR|ENUM|SET)$@i',
$type
);
if (! empty($collation) && $collation != 'NULL' && $matches) {
$query .= PMA_generateCharsetQueryPart($collation);
}
@ -438,7 +454,8 @@ class PMA_Table
$query .= ' DEFAULT FALSE';
} else {
// Invalid BOOLEAN value
$query .= ' DEFAULT \'' . PMA_sqlAddSlashes($default_value) . '\'';
$query .= ' DEFAULT \''
. PMA_sqlAddSlashes($default_value) . '\'';
}
} else {
$query .= ' DEFAULT \'' . PMA_sqlAddSlashes($default_value) . '\'';
@ -517,8 +534,9 @@ class PMA_Table
* @return mixed the number of records if "retain" param is true,
* otherwise true
*/
static public function countRecords($db, $table, $force_exact = false, $is_view = null)
{
static public function countRecords($db, $table, $force_exact = false,
$is_view = null
) {
if (isset(PMA_Table::$cache[$db][$table]['ExactRows'])) {
$row_count = PMA_Table::$cache[$db][$table]['ExactRows'];
} else {
@ -543,7 +561,9 @@ class PMA_Table
}
// for a VIEW, $row_count is always false at this point
if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) {
if (false === $row_count
|| $row_count < $GLOBALS['cfg']['MaxExactCount']
) {
// Make an exception for views in I_S and D_D schema in
// Drizzle, as these map to in-memory data and should execute
// fast enough
@ -601,7 +621,7 @@ class PMA_Table
* @param string $extra 'AUTO_INCREMENT'
* @param string $comment field comment
* @param array &$field_primary list of fields for PRIMARY KEY
* @param string $index
* @param string $index index
* @param string $move_to new position for column
*
* @see PMA_Table::generateFieldSpec()
@ -640,8 +660,9 @@ class PMA_Table
*
* @return int|true
*/
static public function duplicateInfo($work, $pma_table, $get_fields, $where_fields, $new_fields)
{
static public function duplicateInfo($work, $pma_table, $get_fields,
$where_fields, $new_fields
) {
$last_id = -1;
if (isset($GLOBALS['cfgRelation']) && $GLOBALS['cfgRelation'][$work]) {
@ -720,8 +741,9 @@ class PMA_Table
*
* @return bool true if success, false otherwise
*/
static public function moveCopy($source_db, $source_table, $target_db, $target_table, $what, $move, $mode)
{
static public function moveCopy($source_db, $source_table, $target_db,
$target_table, $what, $move, $mode
) {
global $err_url;
/* Try moving table directly */
@ -744,16 +766,20 @@ class PMA_Table
// Ensure the target is valid
if (! $GLOBALS['pma']->databases->exists($source_db, $target_db)) {
if (! $GLOBALS['pma']->databases->exists($source_db)) {
$GLOBALS['message'] = PMA_Message::rawError(sprintf(
__('Source database `%s` was not found!'),
htmlspecialchars($source_db)
));
$GLOBALS['message'] = PMA_Message::rawError(
sprintf(
__('Source database `%s` was not found!'),
htmlspecialchars($source_db)
)
);
}
if (! $GLOBALS['pma']->databases->exists($target_db)) {
$GLOBALS['message'] = PMA_Message::rawError(sprintf(
__('Target database `%s` was not found!'),
htmlspecialchars($target_db)
));
$GLOBALS['message'] = PMA_Message::rawError(
sprintf(
__('Target database `%s` was not found!'),
htmlspecialchars($target_db)
)
);
}
return false;
}
@ -799,7 +825,11 @@ class PMA_Table
if (PMA_DRIZZLE) {
$table_delimiter = 'quote_backtick';
} else {
$server_sql_mode = PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'sql_mode'", 0, 1);
$server_sql_mode = PMA_DBI_fetch_value(
"SHOW VARIABLES LIKE 'sql_mode'",
0,
1
);
// ANSI_QUOTES might be a subset of sql_mode, for example
// REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
if (false !== strpos($server_sql_mode, 'ANSI_QUOTES')) {
@ -1073,30 +1103,88 @@ class PMA_Table
// just once per db
$get_fields = array('display_field');
$where_fields = array('db_name' => $source_db, 'table_name' => $source_table);
$new_fields = array('db_name' => $target_db, 'table_name' => $target_table);
PMA_Table::duplicateInfo('displaywork', 'table_info', $get_fields, $where_fields, $new_fields);
$where_fields = array(
'db_name' => $source_db,
'table_name' => $source_table
);
$new_fields = array(
'db_name' => $target_db,
'table_name' => $target_table
);
PMA_Table::duplicateInfo(
'displaywork',
'table_info',
$get_fields,
$where_fields,
$new_fields
);
/**
* @todo revise this code when we support cross-db relations
*/
$get_fields = array('master_field', 'foreign_table', 'foreign_field');
$where_fields = array('master_db' => $source_db, 'master_table' => $source_table);
$new_fields = array('master_db' => $target_db, 'foreign_db' => $target_db, 'master_table' => $target_table);
PMA_Table::duplicateInfo('relwork', 'relation', $get_fields, $where_fields, $new_fields);
$get_fields = array(
'master_field',
'foreign_table',
'foreign_field'
);
$where_fields = array(
'master_db' => $source_db,
'master_table' => $source_table
);
$new_fields = array(
'master_db' => $target_db,
'foreign_db' => $target_db,
'master_table' => $target_table
);
PMA_Table::duplicateInfo(
'relwork',
'relation',
$get_fields,
$where_fields,
$new_fields
);
$get_fields = array('foreign_field', 'master_table', 'master_field');
$where_fields = array('foreign_db' => $source_db, 'foreign_table' => $source_table);
$new_fields = array('master_db' => $target_db, 'foreign_db' => $target_db, 'foreign_table' => $target_table);
PMA_Table::duplicateInfo('relwork', 'relation', $get_fields, $where_fields, $new_fields);
$get_fields = array(
'foreign_field',
'master_table',
'master_field'
);
$where_fields = array(
'foreign_db' => $source_db,
'foreign_table' => $source_table
);
$new_fields = array(
'master_db' => $target_db,
'foreign_db' => $target_db,
'foreign_table' => $target_table
);
PMA_Table::duplicateInfo(
'relwork',
'relation',
$get_fields,
$where_fields,
$new_fields
);
$get_fields = array('x', 'y', 'v', 'h');
$where_fields = array('db_name' => $source_db, 'table_name' => $source_table);
$new_fields = array('db_name' => $target_db, 'table_name' => $target_table);
PMA_Table::duplicateInfo('designerwork', 'designer_coords', $get_fields, $where_fields, $new_fields);
$where_fields = array(
'db_name' => $source_db,
'table_name' => $source_table
);
$new_fields = array(
'db_name' => $target_db,
'table_name' => $target_table
);
PMA_Table::duplicateInfo(
'designerwork',
'designer_coords',
$get_fields,
$where_fields,
$new_fields
);
/**
* @todo Can't get duplicating PDFs the right way. The
@ -1108,13 +1196,32 @@ class PMA_Table
$get_fields = array('page_descr');
$where_fields = array('db_name' => $source_db);
$new_fields = array('db_name' => $target_db);
$last_id = PMA_Table::duplicateInfo('pdfwork', 'pdf_pages', $get_fields, $where_fields, $new_fields);
$last_id = PMA_Table::duplicateInfo(
'pdfwork',
'pdf_pages',
$get_fields,
$where_fields,
$new_fields
);
if (isset($last_id) && $last_id >= 0) {
$get_fields = array('x', 'y');
$where_fields = array('db_name' => $source_db, 'table_name' => $source_table);
$new_fields = array('db_name' => $target_db, 'table_name' => $target_table, 'pdf_page_number' => $last_id);
PMA_Table::duplicateInfo('pdfwork', 'table_coords', $get_fields, $where_fields, $new_fields);
$where_fields = array(
'db_name' => $source_db,
'table_name' => $source_table
);
$new_fields = array(
'db_name' => $target_db,
'table_name' => $target_table,
'pdf_page_number' => $last_id
);
PMA_Table::duplicateInfo(
'pdfwork',
'table_coords',
$get_fields,
$where_fields,
$new_fields
);
}
*/
}
@ -1183,7 +1290,8 @@ class PMA_Table
}
if (! PMA_Table::isValidName($new_name)) {
$this->errors[] = __('Invalid table name') . ': ' . $new_table->getFullName();
$this->errors[] = __('Invalid table name') . ': '
. $new_table->getFullName();
return false;
}
@ -1192,8 +1300,8 @@ class PMA_Table
$handle_triggers = $this->getDbName() != $new_db && $triggers;
if ($handle_triggers) {
foreach ($triggers as $trigger) {
$sql = 'DROP TRIGGER IF EXISTS ' . PMA_backquote($this->getDbName()) . '.'
. PMA_backquote($trigger['name']) . ';';
$sql = 'DROP TRIGGER IF EXISTS ' . PMA_backquote($this->getDbName())
. '.' . PMA_backquote($trigger['name']) . ';';
PMA_DBI_query($sql);
}
}
@ -1227,7 +1335,8 @@ class PMA_Table
$this->setDbName($new_db);
/**
* @todo move into extra function PMA_Relation::renameTable($new_name, $old_name, $new_db, $old_db)
* @todo move into extra function
* PMA_Relation::renameTable($new_name, $old_name, $new_db, $old_db)
*/
// Move old entries from comments to new table
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
@ -1474,7 +1583,9 @@ class PMA_Table
)
);
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
$message->addMessage(
PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink']))
);
print_r($message);
return $message;
}
@ -1545,7 +1656,9 @@ class PMA_Table
} elseif ($property == self::PROP_COLUMN_ORDER
|| $property == self::PROP_COLUMN_VISIB
) {
if (! PMA_Table::isView($this->db_name, $this->name) && isset($this->uiprefs[$property])) {
if (! PMA_Table::isView($this->db_name, $this->name)
&& isset($this->uiprefs[$property])
) {
// check if the table has not been modified
if (self::sGetStatusInfo($this->db_name, $this->name, 'Create_time') == $this->uiprefs['CREATE_TIME']) {
return $this->uiprefs[$property];
@ -1573,7 +1686,8 @@ class PMA_Table
*
* @param string $property Property
* @param mixed $value Value for the property
* @param string $table_create_time Needed for PROP_COLUMN_ORDER and PROP_COLUMN_VISIB
* @param string $table_create_time Needed for PROP_COLUMN_ORDER
* and PROP_COLUMN_VISIB
*
* @return boolean|PMA_Message
*/
@ -1584,9 +1698,14 @@ class PMA_Table
}
// we want to save the create time if the property is PROP_COLUMN_ORDER
if (! PMA_Table::isView($this->db_name, $this->name)
&& ($property == self::PROP_COLUMN_ORDER || $property == self::PROP_COLUMN_VISIB)
&& ($property == self::PROP_COLUMN_ORDER
|| $property == self::PROP_COLUMN_VISIB)
) {
$curr_create_time = self::sGetStatusInfo($this->db_name, $this->name, 'CREATE_TIME');
$curr_create_time = self::sGetStatusInfo(
$this->db_name,
$this->name,
'CREATE_TIME'
);
if (isset($table_create_time)
&& $table_create_time == $curr_create_time
) {

View File

@ -1684,8 +1684,8 @@ function PMA_localisedDate($timestamp = -1, $format = '')
* returns a tab for tabbed navigation.
* If the variables $link and $args ar left empty, an inactive tab is created
*
* @param array $tab array with all options
* @param array $url_params
* @param array $tab array with all options
* @param array $url_params tab specific URL parameters
*
* @return string html code for one tab, a link if valid otherwise a span
*
@ -1788,8 +1788,8 @@ function PMA_generateHtmlTab($tab, $url_params = array())
* returns html-code for a tab navigation
*
* @param array $tabs one element per tab
* @param string $url_params
* @param string $menu_id
* @param string $url_params additional URL parameters
* @param string $menu_id HTML id attribute for the menu container
*
* @return string html-code for tab-navigation
*/
@ -2712,9 +2712,11 @@ function PMA_getDivForSliderEffect($id, $message)
*/
return '<div id="' . $id . '"'
. (($GLOBALS['cfg']['InitialSlidersState'] == 'closed') ? ' style="display: none; overflow:auto;"' : '')
. (($GLOBALS['cfg']['InitialSlidersState'] == 'closed')
? ' style="display: none; overflow:auto;"'
: '')
. ' class="pma_auto_slider" title="' . htmlspecialchars($message) . '">';
}
/**

View File

@ -506,7 +506,7 @@ function PMA_getenv($var_name)
/**
* Send HTTP header, taking IIS limits into account (600 seems ok)
*
* @param string $uri the header to send
* @param string $uri the header to send
* @param bool $use_refresh whether to use Refresh: header when running on IIS
*
* @return boolean always true
@ -744,9 +744,9 @@ function PMA_linkURL($url)
/**
* Returns HTML code to include javascript file.
*
* @param string $url Location of javascript, relative to js/ folder.
* @param optional string $ie_conditional true - wrap with IE conditional comment
* 'lt 9' etc. - wrap for specific IE version
* @param string $url Location of javascript, relative to js/ folder.
* @param string $ie_conditional true - wrap with IE conditional comment
* 'lt 9' etc. - wrap for specific IE version
*
* @return string HTML code for javascript inclusion.
*/

View File

@ -1142,9 +1142,9 @@ function PMA_DBI_get_columns($database, $table, $column = null, $full = false, $
/**
* Returns all column names in given table
*
* @param string $database name of database
* @param string $table name of table to retrieve columns from
* @param mixed $link mysql link resource
* @param string $database name of database
* @param string $table name of table to retrieve columns from
* @param mixed $link mysql link resource
*
* @return null|array
*/
@ -1263,6 +1263,8 @@ function PMA_DBI_get_variable($var, $type = PMA_DBI_GETVAR_SESSION, $link = null
*
* @param mixed $link mysql link resource|object
* @param boolean $is_controluser whether link is for control user
*
* @return void
*/
function PMA_DBI_postConnect($link, $is_controluser = false)
{
@ -1511,13 +1513,13 @@ function PMA_DBI_fetch_single_row($result, $type = 'ASSOC', $link = null)
* // $users['admin']['John Doe'] = '123'
* </code>
*
* @param string|mysql_result $result query or mysql result
* @param string|integer $key field-name or offset
* used as key for array
* @param string|integer $value value-name or offset
* used as value for array
* @param resource $link mysql link
* @param mixed $options
* @param string|mysql_result $result query or mysql result
* @param string|integer $key field-name or offset
* used as key for array
* @param string|integer $value value-name or offset
* used as value for array
* @param resource $link mysql link
* @param mixed $options query options
*
* @return array resultrows or values indexed by $key
*/

View File

@ -1,6 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Common includes for the database level views
*
* @package PhpMyAdmin
*/

View File

@ -11,6 +11,8 @@ if (! defined('PHPMYADMIN')) {
/**
* Prints details about the current Git commit revision
*
* @return void
*/
function PMA_printGitRevision()
{
@ -22,10 +24,14 @@ function PMA_printGitRevision()
$GLOBALS['PMA_Config']->checkGitRevision();
// if using a remote commit fast-forwarded, link to Github
$commit_hash = substr($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH'), 0, 7);
$commit_hash = substr(
$GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH'),
0,
7
);
$commit_hash = '<strong title="'
. htmlspecialchars($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_MESSAGE')) . '">'
. $commit_hash . '</strong>';
. htmlspecialchars($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_MESSAGE'))
. '">' . $commit_hash . '</strong>';
if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTECOMMIT')) {
$commit_hash = '<a href="'
. PMA_linkURL(

View File

@ -1,6 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles plugins that show the upload progress
*
* @package PhpMyAdmin
*/
@ -25,13 +26,16 @@ $upload_id = uniqid("");
/**
* list of available plugins
*
* Each plugin has own checkfunction in display_import_ajax.lib.php
* and own file with functions in upload_#KEY#.php
*/
$plugins = array(
"session",
"uploadprogress",
"apc",
"noplugin"
); // available plugins. Each plugin has own checkfunction in display_import_ajax.lib.php and own file with functions in upload_#KEY#.php
"session",
"uploadprogress",
"apc",
"noplugin"
);
// select available plugin
foreach ($plugins as $plugin) {
@ -47,11 +51,15 @@ foreach ($plugins as $plugin) {
/**
* Checks if APC bar extension is available and configured correctly.
*
* @return true if APC extension is available and if rfc1867 is enabled, false if it is not
* @return boolean true if APC extension is available and if rfc1867 is enabled,
* false if it is not
*/
function PMA_import_apcCheck()
{
if (! extension_loaded('apc') || ! function_exists('apc_fetch') || ! function_exists('getallheaders')) {
if (! extension_loaded('apc')
|| ! function_exists('apc_fetch')
|| ! function_exists('getallheaders')
) {
return false;
}
return (ini_get('apc.enabled') && ini_get('apc.rfc1867'));
@ -60,11 +68,14 @@ function PMA_import_apcCheck()
/**
* Checks if UploadProgress bar extension is available.
*
* @return true if UploadProgress extension is available, false if it is not
* @return boolean true if UploadProgress extension is available,
* false if it is not
*/
function PMA_import_uploadprogressCheck()
{
if (! function_exists("uploadprogress_get_info") || ! function_exists('getallheaders')) {
if (! function_exists("uploadprogress_get_info")
|| ! function_exists('getallheaders')
) {
return false;
}
return true;
@ -75,7 +86,8 @@ function PMA_import_uploadprogressCheck()
* Due to a bug in PHP 5.4's session upload feature (see /import_status.php),
* we need to check for cURL support.
*
* @return true if PHP 5.4 session upload-progress is available, false if it is not
* @return boolean true if PHP 5.4 session upload-progress is available,
* false if it is not
*/
function PMA_import_sessionCheck()
{
@ -89,9 +101,10 @@ function PMA_import_sessionCheck()
}
/**
* Default plugin for handling import. If no other plugin is available, noplugin is used.
* Default plugin for handling import.
* If no other plugin is available, noplugin is used.
*
* @return true
* @return boolean true
*/
function PMA_import_nopluginCheck()
{
@ -99,9 +112,13 @@ function PMA_import_nopluginCheck()
}
/**
* The function outputs json encoded status of uploaded. It uses PMA_getUploadStatus, which is defined in plugin's file.
* The function outputs json encoded status of uploaded.
* It uses PMA_getUploadStatus, which is defined in plugin's file.
*
* @param $id - ID of transfer, usually $upload_id from display_import_ajax.lib.php
* @param string $id ID of transfer, usually $upload_id
* from display_import_ajax.lib.php
*
* @return void
*/
function PMA_importAjaxStatus($id)
{

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.0.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2012-05-09 13:14+0200\n"
"PO-Revision-Date: 2012-05-10 12:37+0200\n"
"PO-Revision-Date: 2012-05-12 00:58+0200\n"
"Last-Translator: Yuichiro Takahashi <yuichiro@pop07.odn.ne.jp>\n"
"Language-Team: japanese <jp@li.org>\n"
"Language: ja\n"
@ -2818,8 +2818,7 @@ msgstr ""
msgid ""
"A fixed-point number (M, D) - the maximum number of digits (M) is 65 "
"(default 10), the maximum number of decimals (D) is 30 (default 0)"
msgstr ""
"固定小数 (M, D) - 整数部の最大桁数 (M) は 65 (デフォルトは 10)、小数部のの最大桁数 (D) は 30 (デフォルトは 0)"
msgstr "固定小数 (M, D) - 整数部の最大桁数 M は 65 (デフォルトは 10)、小数部のの最大桁数 D は 30 (デフォルトは 0)"
#: libraries/Types.class.php:301
msgid ""
@ -3076,6 +3075,8 @@ msgstr "TRUE または FALSE"
#: libraries/Types.class.php:713
msgid "An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE"
msgstr ""
"BIGINT NOT NULL AUTO_INCREMENT UNIQUE の別名 "
"(BIGINT、NULLなし、AUTO_INCREMENT、ユニークキー)"
#: libraries/Types.class.php:715
msgid "Stores a Universally Unique Identifier (UUID)"
@ -3086,6 +3087,8 @@ msgid ""
"A timestamp, range is '0001-01-01 00:00:00' UTC to '9999-12-31 23:59:59' "
"UTC; TIMESTAMP(6) can store microseconds"
msgstr ""
"タイムスタンプ、範囲は 0001-01-01 00:00:00 UTC から 9999-12-31 23:59:59、TIMESTAMP(6) "
"でマイクロ秒まで保存できるようになります"
#: libraries/Types.class.php:729
msgid ""

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.0.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2012-05-09 13:14+0200\n"
"PO-Revision-Date: 2012-05-07 10:57+0200\n"
"PO-Revision-Date: 2012-05-11 19:33+0200\n"
"Last-Translator: Madhura Jayaratne <madhura.cj@gmail.com>\n"
"Language-Team: sinhala <si@li.org>\n"
"Language: si\n"
@ -12,7 +12,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Weblate 0.10\n"
"X-Generator: Weblate 1.0\n"
#: browse_foreigners.php:35 browse_foreigners.php:59 js/messages.php:358
#: libraries/display_tbl.lib.php:399 server_privileges.php:1828
@ -11640,7 +11640,7 @@ msgstr "තීර අනුපිළිවල සකසන්න"
#: tbl_structure.php:622
msgid "Move the columns by dragging them up and down."
msgstr ""
msgstr "ඉහළ පහළ ඇදීමෙන් තීර අනුපිළිවෙල සකසන්න."
#: tbl_structure.php:648
msgid "Edit view"

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.0.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2012-05-09 13:14+0200\n"
"PO-Revision-Date: 2012-05-08 19:29+0200\n"
"PO-Revision-Date: 2012-05-11 20:42+0200\n"
"Last-Translator: ProUser <stefan@inkopsforum.se>\n"
"Language-Team: swedish <sv@li.org>\n"
"Language: sv\n"
@ -12,7 +12,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Weblate 0.10\n"
"X-Generator: Weblate 1.0\n"
#: browse_foreigners.php:35 browse_foreigners.php:59 js/messages.php:358
#: libraries/display_tbl.lib.php:399 server_privileges.php:1828
@ -3016,21 +3016,18 @@ msgid "Numeric"
msgstr ""
#: libraries/Types.class.php:638 libraries/Types.class.php:974
#, fuzzy
#| msgid "Create an index"
msgctxt "date and time types"
msgid "Date and time"
msgstr "Skapa index"
msgstr "Datum och tid"
#: libraries/Types.class.php:647 libraries/Types.class.php:977
#, fuzzy
#| msgid "Linestring"
msgctxt "string types"
msgid "String"
msgstr "Linestring"
msgstr "Sträng"
#: libraries/Types.class.php:668
#, fuzzy
#| msgid "Spatial"
msgctxt "spatial types"
msgid "Spatial"

View File

@ -22,7 +22,7 @@ class PMA_GetDivForSliderEffectTest extends PHPUnit_Framework_TestCase
$id = "test_id";
$message = "test_message";
$this->expectOutputString('<div id="' . $id . '" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">' . "\n" . ' ');
$this->expectOutputString('<div id="' . $id . '" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">');
PMA_getDivForSliderEffect($id, $message);
}
@ -34,7 +34,7 @@ class PMA_GetDivForSliderEffectTest extends PHPUnit_Framework_TestCase
$id = "test_id";
$message = "test_message";
$this->expectOutputString('<div id="' . $id . '" style="display: none; overflow:auto;" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">' . "\n" . ' ');
$this->expectOutputString('<div id="' . $id . '" style="display: none; overflow:auto;" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">');
PMA_getDivForSliderEffect($id, $message);
}