From 37d50c1822c9b3b8d8bd1f5cb5c8a5e74ee1d268 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Wed, 26 Nov 2003 22:52:25 +0000 Subject: [PATCH] Huge set of optimizations, please test! --- ChangeLog | 21 +- browse_foreigners.php | 16 +- chk_rel.php | 13 +- config.inc.php | 4 - css/phpmyadmin.css.php | 6 +- db_create.php | 12 +- db_datadict.php | 12 +- db_details.php | 8 +- db_details_common.php | 18 +- db_details_db_info.php | 6 +- db_details_export.php | 15 +- db_details_importdocsql.php | 38 +- db_details_qbe.php | 16 +- db_details_structure.php | 30 +- db_printview.php | 23 +- db_search.php | 4 +- export.php | 63 +- footer.inc.php | 23 +- header.inc.php | 291 +- header_printview.inc.php | 8 +- index.php | 8 +- ldi_check.php | 16 +- ldi_table.php | 12 +- left.php | 54 +- libraries/auth/config.auth.lib.php | 162 +- libraries/auth/cookie.auth.lib.php | 928 ++-- libraries/auth/http.auth.lib.php | 378 +- libraries/bookmark.lib.php | 312 +- libraries/charset_conversion.lib.php | 529 ++- libraries/common.lib.php | 3536 ++++++++-------- libraries/config_import.lib.php | 2396 ++++++----- libraries/db_config.lib.php | 151 +- libraries/db_table_exists.lib.php | 6 +- libraries/dbg/profiling.php | 136 +- libraries/dbg/setup.php | 30 +- libraries/defines.lib.php | 162 +- libraries/defines_mysql.lib.php | 40 + libraries/defines_php.lib.php | 132 - libraries/display_export.lib.php | 2 +- libraries/display_tbl.lib.php | 3594 ++++++++-------- libraries/display_tbl_links.lib.php | 34 +- libraries/get_foreign.lib.php | 66 +- libraries/grab_globals.lib.php | 104 +- libraries/ip_allow_deny.lib.php | 532 ++- libraries/kanji-encoding.lib.php | 233 +- libraries/mysql_charsets.lib.php | 13 +- libraries/mysql_wrappers.lib.php | 250 +- libraries/ob.lib.php | 213 +- libraries/read_dump.lib.php | 372 +- libraries/relation.lib.php | 1154 +++-- libraries/relation_cleanup.lib.php | 246 +- libraries/select_lang.lib.php | 482 +-- libraries/sqlparser.data.php | 970 +++-- libraries/sqlparser.lib.php | 3725 ++++++++--------- libraries/sqlvalidator.class.php | 653 ++- libraries/sqlvalidator.lib.php | 121 +- libraries/string.lib.php | 591 ++- libraries/transformations.lib.php | 379 +- libraries/transformations/TEMPLATE | 24 +- libraries/transformations/TEMPLATE_MIMETYPE | 2 +- libraries/transformations/global.inc.php | 46 +- .../image_jpeg__inline.inc.php | 24 +- .../transformations/image_jpeg__link.inc.php | 16 +- .../transformations/image_png__inline.inc.php | 24 +- libraries/transformations/overview.php | 19 +- .../text_plain__dateformat.inc.php | 108 +- .../text_plain__external.inc.php | 118 +- .../text_plain__formatted.inc.php | 10 +- .../text_plain__imagelink.inc.php | 16 +- .../transformations/text_plain__link.inc.php | 18 +- .../text_plain__substr.inc.php | 78 +- libraries/url_generating.lib.php | 149 +- main.php | 25 +- mult_submits.inc.php | 28 +- pdf_pages.php | 38 +- pdf_schema.php | 27 +- phpinfo.php | 6 +- queryframe.php | 10 +- querywindow.php | 44 +- read_dump.php | 38 +- scripts/create-release.sh | 4 +- server_collations.php | 9 +- server_common.inc.php | 19 +- server_databases.php | 9 +- server_export.php | 10 +- server_links.inc.php | 6 +- server_privileges.php | 10 +- server_processlist.php | 4 +- server_status.php | 8 +- server_variables.php | 5 +- sql.php | 40 +- tbl_addfield.php | 17 +- tbl_alter.php | 17 +- tbl_change.php | 18 +- tbl_create.php | 18 +- tbl_indexes.php | 19 +- tbl_move_copy.php | 91 +- tbl_printview.php | 10 +- tbl_properties.inc.php | 22 +- tbl_properties.php | 4 +- tbl_properties_common.php | 18 +- tbl_properties_export.php | 8 +- tbl_properties_links.php | 32 +- tbl_properties_operations.php | 10 +- tbl_properties_structure.php | 27 +- tbl_properties_table_info.php | 7 +- tbl_query_box.php | 32 +- tbl_relation.php | 49 +- tbl_rename.php | 10 +- tbl_replace.php | 20 +- tbl_replace_fields.php | 6 +- tbl_row_delete.php | 24 +- tbl_select.php | 15 +- transformation_wrapper.php | 17 +- user_password.php | 22 +- 115 files changed, 12275 insertions(+), 12579 deletions(-) create mode 100644 libraries/defines_mysql.lib.php delete mode 100644 libraries/defines_php.lib.php diff --git a/ChangeLog b/ChangeLog index 9178d5d67..3e677dc26 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,17 +5,34 @@ phpMyAdmin - Changelog $Id$ $Source$ +2003-11-26 Alexander M. Turek + * Almost every file: + - Replaced all include / require commands by require_once where possible; + - Further php 4.1+ optimizations; + - footer.inc.php now automatically stops the script execution; + - Coding standards. + * config.inc.php: Don't include select_lang.lib.php here. + * libraries/common.lib.php, libraries/defines.lib.php, + libraries/defines_php.lib.php, libraries/defines_mysql.lib.php, + scripts/create-release.sh: + defines.lib.php was included twice. For optimization reasons I moved all + the code that is independent from the MySQL connection out of defines.lib + into defines_php.lib. + To point out the (new) meanings of the files I renamed defines.lib.php to + defines_mysql.lib.php while defines_php.lib.php is now known as + defines.lib.php. + 2003-11-26 Michal Cihar * lang/check_lang.sh: Cleanup. * lang/sort_lang.sh: Cleanup. * lang/czech: Better translated some strings. - + 2003-11-26 Marc Delisle * lang/arabic: update, thanks to Ossama Khayat (okhayat) * lang/hindi: update, thanks to Girish Nair (girish_nair) * lang/slovak: Updated, thanks to Lubos Klokner (erkac). * lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza). - + 2003-11-25 Alexander M. Turek * translators.html: Changed email of Hindi translator, again. * badwords.txt: File is obsolete. diff --git a/browse_foreigners.php b/browse_foreigners.php index b702384c4..677266c37 100644 --- a/browse_foreigners.php +++ b/browse_foreigners.php @@ -5,25 +5,23 @@ /** * Get the variables sent or posted to this script and displays the header */ -require('./libraries/grab_globals.lib.php'); +require_once('./libraries/grab_globals.lib.php'); /** * Gets a core script and starts output buffering work */ -if (!defined('PMA_COMMON_LIB_INCLUDED')) { - include('./libraries/common.lib.php'); -} +require_once('./libraries/common.lib.php'); PMA_checkParameters(array('db', 'table', 'field')); -require('./libraries/ob.lib.php'); +require_once('./libraries/ob.lib.php'); if ($cfg['OBGzip']) { $ob_mode = PMA_outBufferModeGet(); if ($ob_mode) { PMA_outBufferPre($ob_mode); } } -include('./libraries/header_http.inc.php'); +require_once('./libraries/header_http.inc.php'); $field = urldecode($field); /** @@ -58,8 +56,8 @@ PMA_setFontSizes();
diff --git a/chk_rel.php b/chk_rel.php index 206af9d7f..57707a0e2 100644 --- a/chk_rel.php +++ b/chk_rel.php @@ -6,10 +6,10 @@ /** * Gets some core libraries */ -require('./libraries/grab_globals.lib.php'); -require('./libraries/common.lib.php'); -require('./db_details_common.php'); -require('./libraries/relation.lib.php'); +require_once('./libraries/grab_globals.lib.php'); +require_once('./libraries/common.lib.php'); +require_once('./db_details_common.php'); +require_once('./libraries/relation.lib.php'); /** @@ -21,6 +21,5 @@ $cfgRelation = PMA_getRelationsParam(TRUE); /** * Displays the footer */ -echo "\n"; -require('./footer.inc.php'); -?> \ No newline at end of file +require_once('./footer.inc.php'); +?> diff --git a/config.inc.php b/config.inc.php index 4ffcb63a0..4a1afe491 100644 --- a/config.inc.php +++ b/config.inc.php @@ -434,10 +434,6 @@ $cfg['AvailableCharsets'] = array( 'SHIFT_JIS' ); -// Loads language file -require('./libraries/select_lang.lib.php'); - - /** * Customization & design */ diff --git a/css/phpmyadmin.css.php b/css/phpmyadmin.css.php index cd3ff61bf..a58c3cf5b 100644 --- a/css/phpmyadmin.css.php +++ b/css/phpmyadmin.css.php @@ -4,8 +4,8 @@ chdir('..'); $is_minimum_common = TRUE; -require('./libraries/grab_globals.lib.php'); -require('./libraries/common.lib.php'); +require_once('./libraries/grab_globals.lib.php'); +require_once('./libraries/common.lib.php'); // Gets the default font sizes // garvin: TODO: Should be optimized to not include the whole common.lib.php bunch @@ -13,7 +13,7 @@ require('./libraries/common.lib.php'); PMA_setFontSizes(); $ctype = 'css'; -require('./libraries/header_http.inc.php'); +require_once('./libraries/header_http.inc.php'); if (!isset($js_frame)) { $js_frame = 'left'; diff --git a/db_create.php b/db_create.php index a15ca13d9..65ba9c121 100644 --- a/db_create.php +++ b/db_create.php @@ -6,13 +6,11 @@ /** * Gets some core libraries */ -require('./libraries/grab_globals.lib.php'); +require_once('./libraries/grab_globals.lib.php'); $js_to_run = 'functions.js'; -require('./header.inc.php'); +require_once('./header.inc.php'); +require_once('./libraries/common.lib.php'); -if (!defined('PMA_COMMON_LIB_INCLUDED')) { - include('./libraries/common.lib.php'); -} PMA_checkParameters(array('db')); @@ -32,6 +30,6 @@ $result = PMA_mysql_query('CREATE DATABASE ' . PMA_backquote($db)) or PMA_m * Displays the result and calls default page */ $message = $strDatabase . ' ' . htmlspecialchars($db) . ' ' . $strHasBeenCreated; -require('./' . $cfg['DefaultTabDatabase']); +require_once('./' . $cfg['DefaultTabDatabase']); -?> \ No newline at end of file +?> diff --git a/db_datadict.php b/db_datadict.php index 8e1024df2..7df1f896f 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -6,16 +6,16 @@ * Gets the variables sent or posted to this script, then displays headers */ if (!isset($selected_tbl)) { - include('./libraries/grab_globals.lib.php'); - include('./header.inc.php'); + require_once('./libraries/grab_globals.lib.php'); + require_once('./header.inc.php'); } /** * Gets the relations settings */ -require('./libraries/relation.lib.php'); -require('./libraries/transformations.lib.php'); +require_once('./libraries/relation.lib.php'); +require_once('./libraries/transformations.lib.php'); $cfgRelation = PMA_getRelationsParam(); @@ -317,5 +317,5 @@ function printPage()
 ' . "\n"; -require('./footer.inc.php'); -?> \ No newline at end of file +require_once('./footer.inc.php'); +?> diff --git a/db_details.php b/db_details.php index 532ae93da..95ae830ee 100644 --- a/db_details.php +++ b/db_details.php @@ -35,7 +35,7 @@ $sub_part = ''; require('./db_details_db_info.php'); if ($num_tables == 0 && empty($db_query_force)) { $is_info = TRUE; - include('./db_details_structure.php'); + require('./db_details_structure.php'); exit(); } @@ -62,7 +62,7 @@ $auto_sel = ($cfg['TextareaAutoSelect']  :