The branch, master has been updated via 4ee15be98627dcc5e7de721a9fe69d3aabeefd41 (commit) via 6deed1fd2e0905c055f3f4b1c9da752fda6369f7 (commit) via b202936282dc7949dd5888ae3462999d6f4a999b (commit) from 7e27edbb6d15e0cbac446de4b7083568dbf20210 (commit)
- Log ----------------------------------------------------------------- commit 4ee15be98627dcc5e7de721a9fe69d3aabeefd41 Author: Piotr Przybylski piotrprz@gmail.com Date: Wed Jul 20 18:10:38 2011 +0200
PMA_lookForUse - require whitespace after USE
commit 6deed1fd2e0905c055f3f4b1c9da752fda6369f7 Author: Piotr Przybylski piotrprz@gmail.com Date: Wed Jul 20 18:08:04 2011 +0200
Change NULL to null
commit b202936282dc7949dd5888ae3462999d6f4a999b Author: Piotr Przybylski piotrprz@gmail.com Date: Wed Jul 20 18:03:58 2011 +0200
Unify function comments
-----------------------------------------------------------------------
Summary of changes: libraries/File.class.php | 8 +++--- libraries/Table.class.php | 2 +- libraries/blobstreaming.lib.php | 2 +- libraries/database_interface.lib.php | 2 +- libraries/import.lib.php | 50 ++++++++++++++------------------- libraries/import/csv.php | 6 ++-- libraries/import/ods.php | 4 +- libraries/import/xls.php | 4 +- libraries/import/xlsx.php | 4 +- libraries/import/xml.php | 12 ++++---- libraries/plugin_interface.lib.php | 2 +- tbl_change.php | 2 +- 12 files changed, 45 insertions(+), 53 deletions(-)
diff --git a/libraries/File.class.php b/libraries/File.class.php index c2d5dad..553cc2d 100644 --- a/libraries/File.class.php +++ b/libraries/File.class.php @@ -73,7 +73,7 @@ class PMA_File /** * @staticvar string most recent BLOB repository reference */ - static $_recent_bs_reference = NULL; + static $_recent_bs_reference = null;
/** * constructor @@ -254,7 +254,7 @@ class PMA_File $tmp_file_type = $file['type'];
if (! $tmp_file_type) { - $tmp_file_type = NULL; + $tmp_file_type = null; }
if (! $bs_db || ! $bs_table) { @@ -384,7 +384,7 @@ class PMA_File }
if (! $tmp_file_type) { - $tmp_file_type = NULL; + $tmp_file_type = null; }
if (! $bs_db || !$bs_table) { @@ -828,7 +828,7 @@ class PMA_File static function getRecentBLOBReference() { $ref = PMA_File::$_recent_bs_reference; - PMA_File::$_recent_bs_reference = NULL; + PMA_File::$_recent_bs_reference = null;
return $ref; } diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 83e67fd..66ceaea 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -1370,7 +1370,7 @@ class PMA_Table * @param string $table_create_time Needed for PROP_COLUMN_ORDER and PROP_COLUMN_VISIB * @return boolean|PMA_Message */ - public function setUiProp($property, $value, $table_create_time = NULL) + public function setUiProp($property, $value, $table_create_time = null) { if (! isset($this->uiprefs)) { $this->loadUiPrefs(); diff --git a/libraries/blobstreaming.lib.php b/libraries/blobstreaming.lib.php index cd1e5d4..301403c 100644 --- a/libraries/blobstreaming.lib.php +++ b/libraries/blobstreaming.lib.php @@ -179,7 +179,7 @@ function checkBLOBStreamingPlugins() $PMA_Config->set('FILEINFO_EXISTS', false);
// check if PECL's fileinfo library exist - $finfo = NULL; + $finfo = null;
if (function_exists("finfo_open")) { $finfo = finfo_open(FILEINFO_MIME); diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index ca50600..a43a4af 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -472,7 +472,7 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals $each_tables[$table_name]['TABLE_COMMENT'] =& $each_tables[$table_name]['Comment'];
if (strtoupper($each_tables[$table_name]['Comment']) === 'VIEW' - && $each_tables[$table_name]['Engine'] == NULL) { + && $each_tables[$table_name]['Engine'] == null) { $each_tables[$table_name]['TABLE_TYPE'] = 'VIEW'; } else { /** diff --git a/libraries/import.lib.php b/libraries/import.lib.php index 5b8af20..79b4ade 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -44,7 +44,7 @@ function PMA_checkTimeout() /** * Detects what compression filse uses * - * @param string filename to check + * @param string $filepath filename to check * @return string MIME type of compression, none for none * @access public */ @@ -73,9 +73,9 @@ function PMA_detectCompression($filepath) * Runs query inside import buffer. This is needed to allow displaying * of last SELECT, SHOW or HANDLER results and similar nice stuff. * - * @param string query to run - * @param string query to display, this might be commented - * @param bool whether to use control user for queries + * @param string $sql query to run + * @param string $full query to display, this might be commented + * @param bool $controluser whether to use control user for queries * @access public */ function PMA_importRunQuery($sql = '', $full = '', $controluser = false) @@ -207,17 +207,17 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false) /** * Looks for the presence of USE to possibly change current db * - * @param string buffer to examine - * @param string current db - * @param boolean reload + * @param string $buffer buffer to examine + * @param string $db current db + * @param bool $reload reload * @return array (current or new db, whether to reload) * @access public */ function PMA_lookForUse($buffer, $db, $reload) { - if (preg_match('@^[\s]*USE[[:space:]]*([\S]+)@i', $buffer, $match)) { + if (preg_match('@^[\s]*USE[[:space:]]+([\S]+)@i', $buffer, $match)) { $db = trim($match[1]); - $db = trim($db,';'); // for example, USE abc; + $db = trim($db, ';'); // for example, USE abc; $reload = true; } return(array($db, $reload)); @@ -227,8 +227,7 @@ function PMA_lookForUse($buffer, $db, $reload) /** * Returns next part of imported file/buffer * - * @param integer size of buffer to read (this is maximal size - * function will return) + * @param int $size size of buffer to read (this is maximal size function will return) * @return string part of file/buffer * @access public */ @@ -436,7 +435,6 @@ define("SIZES", 1); /** * Obtains the precision (total # of digits) from a size of type decimal * - * * @access public * * @param string $last_cumulative_size @@ -449,7 +447,6 @@ function PMA_getM($last_cumulative_size) { /** * Obtains the scale (# of digits to the right of the decimal point) from a size of type decimal * - * * @access public * * @param string $last_cumulative_size @@ -462,7 +459,6 @@ function PMA_getD($last_cumulative_size) { /** * Obtains the decimal size of a given cell * - * * @access public * * @param string &$cell @@ -482,7 +478,6 @@ function PMA_getDecimalSize(&$cell) { /** * Obtains the size of the given cell * - * * @todo Handle the error cases more elegantly * * @access public @@ -696,7 +691,6 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type /** * Determines what MySQL type a cell is * - * * @access public * * @param int $last_cumulative_type Last cumulative column type (VARCHAR or INT or BIGINT or DECIMAL or NONE) @@ -710,7 +704,7 @@ function PMA_detectType($last_cumulative_type, &$cell) { */
if (! strcmp('NULL', $cell)) { - if ($last_cumulative_type === NULL || $last_cumulative_type == NONE) { + if ($last_cumulative_type === null || $last_cumulative_type == NONE) { return NONE; } else { return $last_cumulative_type; @@ -733,7 +727,6 @@ function PMA_detectType($last_cumulative_type, &$cell) { /** * Determines if the column types are int, decimal, or string * - * * @link http://wiki.phpmyadmin.net/pma/Import * * @todo Handle the error case more elegantly @@ -823,25 +816,24 @@ function PMA_analyzeTable(&$table) { }
/* Needed to quell the beast that is PMA_Message */ -$import_notice = NULL; +$import_notice = null;
/** * Builds and executes SQL statements to create the database and tables * as necessary, as well as insert all the data. * - * * @link http://wiki.phpmyadmin.net/pma/Import * * @access public * - * @param string $db_name Name of the database - * @param array &$tables Array of tables for the specified database - * @param array &$analyses = NULL Analyses of the tables - * @param array &$additional_sql = NULL Additional SQL statements to be executed - * @param array $options = NULL Associative array of options + * @param string $db_name Name of the database + * @param array &$tables Array of tables for the specified database + * @param array &$analyses Analyses of the tables + * @param array &$additional_sql Additional SQL statements to be executed + * @param array $options Associative array of options * @return void */ -function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql = NULL, $options = NULL) { +function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql = null, $options = null) { /* Take care of the options */ if (isset($options['db_collation'])&& ! is_null($options['db_collation'])) { $collation = $options['db_collation']; @@ -884,7 +876,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql = unset($sql);
/* Run the $additional_sql statements supplied by the caller plug-in */ - if ($additional_sql != NULL) { + if ($additional_sql != null) { /* Clean the SQL first */ $additional_sql_len = count($additional_sql);
@@ -910,7 +902,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql = } }
- if ($analyses != NULL) { + if ($analyses != null) { $type_array = array(NONE => "NULL", VARCHAR => "varchar", INT => "int", DECIMAL => "decimal", BIGINT => "bigint");
/* TODO: Do more checking here to make sure they really are matched */ @@ -975,7 +967,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql = $tempSQLStr .= "(";
for ($k = 0; $k < $num_cols; ++$k) { - if ($analyses != NULL) { + if ($analyses != null) { $is_varchar = ($analyses[$i][TYPES][$col_count] === VARCHAR); } else { $is_varchar = !is_numeric($tables[$i][ROWS][$j][$k]); diff --git a/libraries/import/csv.php b/libraries/import/csv.php index 7735598..a0b3348 100644 --- a/libraries/import/csv.php +++ b/libraries/import/csv.php @@ -258,7 +258,7 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) { // Need to strip trailing enclosing char? if ($need_end && $ch == $csv_enclosed) { if ($finished && $i == $len - 1) { - $ch = NULL; + $ch = null; } elseif ($i == $len - 1) { $i = $fallbacki; $ch = $buffer[$i]; @@ -417,11 +417,11 @@ if ($analyze) { $options = array('create_db' => false); } else { $db_name = 'CSV_DB'; - $options = NULL; + $options = null; }
/* Non-applicable parameters */ - $create = NULL; + $create = null;
/* Created and execute necessary SQL statements from data */ PMA_buildSQL($db_name, $tables, $analyses, $create, $options); diff --git a/libraries/import/ods.php b/libraries/import/ods.php index 7f850c6..79a920b 100644 --- a/libraries/import/ods.php +++ b/libraries/import/ods.php @@ -275,11 +275,11 @@ if (strlen($db)) { $options = array('create_db' => false); } else { $db_name = 'ODS_DB'; - $options = NULL; + $options = null; }
/* Non-applicable parameters */ -$create = NULL; +$create = null;
/* Created and execute necessary SQL statements from data */ PMA_buildSQL($db_name, $tables, $analyses, $create, $options); diff --git a/libraries/import/xls.php b/libraries/import/xls.php index 78cdef5..4db0a28 100644 --- a/libraries/import/xls.php +++ b/libraries/import/xls.php @@ -130,11 +130,11 @@ if (strlen($db)) { $options = array('create_db' => false); } else { $db_name = 'XLS_DB'; - $options = NULL; + $options = null; }
/* Non-applicable parameters */ -$create = NULL; +$create = null;
/* Created and execute necessary SQL statements from data */ PMA_buildSQL($db_name, $tables, $analyses, $create, $options); diff --git a/libraries/import/xlsx.php b/libraries/import/xlsx.php index 33308c6..08d151c 100644 --- a/libraries/import/xlsx.php +++ b/libraries/import/xlsx.php @@ -130,11 +130,11 @@ if (strlen($db)) { $options = array('create_db' => false); } else { $db_name = 'XLSX_DB'; - $options = NULL; + $options = null; }
/* Non-applicable parameters */ -$create = NULL; +$create = null;
/* Created and execute necessary SQL statements from data */ PMA_buildSQL($db_name, $tables, $analyses, $create, $options); diff --git a/libraries/import/xml.php b/libraries/import/xml.php index db9ba6e..17479f5 100644 --- a/libraries/import/xml.php +++ b/libraries/import/xml.php @@ -119,14 +119,14 @@ if ($db_attr instanceof SimpleXMLElement) { */ $db_attr = $xml->children()->attributes(); $db_name = (string)$db_attr['name']; - $collation = NULL; - $charset = NULL; + $collation = null; + $charset = null; }
/** * The XML was malformed */ -if ($db_name === NULL) { +if ($db_name === null) { PMA_Message::error(__('The XML file specified was either malformed or incomplete. Please correct the issue and try again.'))->display(); unset($xml); $GLOBALS['finished'] = false; @@ -259,9 +259,9 @@ if ($data_present) { * to maintain PMA_buildSQL() call integrity */ if (! isset($analyses)) { - $analyses = NULL; + $analyses = null; if (! $struct_present) { - $create = NULL; + $create = null; } } } @@ -286,7 +286,7 @@ if (strlen($db)) { $db_name = $db; $options = array('create_db' => false); } else { - if ($db_name === NULL) { + if ($db_name === null) { $db_name = 'XML_DB'; }
diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index 74e72c3..ea6869a 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -138,7 +138,7 @@ function PMA_pluginIsActive($section, $opt, $val) * @param string $cfgname name of config value, if none same as $name * @return string html select tag */ -function PMA_pluginGetChoice($section, $name, &$list, $cfgname = NULL) +function PMA_pluginGetChoice($section, $name, &$list, $cfgname = null) { if (! isset($cfgname)) { $cfgname = $name; diff --git a/tbl_change.php b/tbl_change.php index 7d5bba3..63f0d56 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -505,7 +505,7 @@ foreach ($rows as $row_id => $vrow) { //when copying row, it is useful to empty auto-increment column to prevent duplicate key error if (isset($default_action) && $default_action === 'insert') { if ($field['Key'] === 'PRI' && strpos($field['Extra'], 'auto_increment') !== false) { - $data = $special_chars_encoded = $special_chars = NULL; + $data = $special_chars_encoded = $special_chars = null; } } // If a timestamp field value is not included in an update
hooks/post-receive