Re: Unused globals
Reply #1 –
Ah yes, I remember now... Do you guys have any new global variables that are used in Elk but not in SMF?
So that I can add them to the list of 'undeclared globals'. (I have to explicitly list them.)
Re: Unused globals
Reply #3 –
install and upgrade are straightforward when it comes to unneeded globals. Plus, I have my false-positive detection code.
The latest script version has an option to remove false positives from the list, so here's a full list of 'sure fire' errors it found for ElkArte. Feel free to fix them manually. Or, if you don't want to, I can ask the script to do it for me, and I'll do a pull request.
Unused global in /install/install.php:132 (initialize_inputs) -- $databases
Unused global in /install/install.php:132 (initialize_inputs) -- $incontext
Unused global in /install/install.php:301 (installExit) -- $txt
Unused global in /install/install.php:2016 (template_install_above) -- $oursite
Unused global in /install/install.php:2132 (template_welcome_message) -- $installurl
Unused global in /install/install.php:2280 (template_database_settings) -- $installurl
Unused global in /install/install.php:2375 (template_forum_settings) -- $installurl
Unused global in /install/install.php:2421 (template_populate_database) -- $installurl
Unused global in /install/install.php:2464 (template_admin_account) -- $installurl
Unused global in /install/upgrade.php:507 (initialize_inputs) -- $upcontext
Unused global in /install/upgrade.php:507 (initialize_inputs) -- $db_type
Unused global in /install/upgrade.php:856 (action_upgradeOptions) -- $db_prefix
Unused global in /install/upgrade.php:857 (action_upgradeOptions) -- $boardurl
Unused global in /install/upgrade.php:857 (action_upgradeOptions) -- $mmessage
Unused global in /install/upgrade.php:1078 (action_databaseChanges) -- $language
Unused global in /install/upgrade.php:1078 (action_databaseChanges) -- $boardurl
Unused global in /install/upgrade.php:1410 (convertSettingstoOptions) -- $db_prefix
Unused global in /install/upgrade.php:1538 (db_version_check) -- $db_connection
Unused global in /install/upgrade.php:1551 (getMemberGroups) -- $db_prefix
Unused global in /install/upgrade.php:1608 (parse_sql) -- $db_connection
Unused global in /install/upgrade.php:2149 (textfield_alter) -- $databases
Unused global in /install/upgrade.php:2149 (textfield_alter) -- $db_type
Unused global in /install/upgrade.php:2304 (nextSubstep) -- $file_steps
Unused global in /install/upgrade.php:2304 (nextSubstep) -- $modSettings
Unused global in /install.php:158 (initialize_inputs) -- $databases
Unused global in /install.php:158 (initialize_inputs) -- $incontext
Unused global in /install.php:347 (installExit) -- $txt
Unused global in /install.php:2015 (template_install_above) -- $oursite
Unused global in /install.php:2133 (template_welcome_message) -- $installurl
Unused global in /install.php:2281 (template_database_settings) -- $installurl
Unused global in /install.php:2401 (template_forum_settings) -- $installurl
Unused global in /install.php:2447 (template_populate_database) -- $installurl
Unused global in /install.php:2490 (template_admin_account) -- $installurl
Found duplicate globals in /sources/admin/ManageBoards.controller.php (action_main) -- $txt, $context, $cat_tree, $boards, $boardList, $scripturl, $txt
Found duplicate globals in /sources/admin/ManageSmileys.controller.php (action_editsmiley) -- $modSettings, $context, $txt, $scripturl, $modSettings
Found duplicate globals in /sources/admin/PackageServers.controller.php (action_browse) -- $txt, $context, $scripturl, $forum_version, $context
Found duplicate globals in /sources/controllers/Notify.controller.php (action_notify) -- $topic, $scripturl, $txt, $topic, $user_info, $context
Unused global in /sources/controllers/Stats.controller.php:127 (loadGeneralStatistics) -- $txt
Unused global in /sources/ext/simple_html_dom.php:865 (get_display_size) -- $debug_object
Unused global in /sources/ext/simple_html_dom.php:1045 (load) -- $debug_object
Unused global in /themes/default/BoardIndex.template.php:31 (template_boards_list) -- $settings
Unused global in /themes/default/BoardIndex.template.php:31 (template_boards_list) -- $scripturl
Unused global in /themes/default/Display.template.php:99 (template_messages) -- $modSettings
Unused global in /themes/default/MessageIndex.template.php:31 (template_display_child_boards_above) -- $scripturl
Unused global in /themes/default/MessageIndex.template.php:31 (template_display_child_boards_above) -- $settings
Unused global in /themes/default/ModerationCenter.template.php:486 (template_user_watch_post_callback) -- $delete_button
Unused global in /themes/default/Stats.template.php:23 (template_statistics) -- $settings
Unused global in /themes/default/Stats.template.php:23 (template_statistics) -- $txt
Unused global in /themes/default/Stats.template.php:23 (template_statistics) -- $scripturl
Unused global in /themes/default/Stats.template.php:23 (template_statistics) -- $modSettings
Unused global in /themes/default/Stats.template.php:45 (template_general_statistics) -- $scripturl
Unused global in /themes/default/Stats.template.php:45 (template_general_statistics) -- $modSettings
Unused global in /themes/default/Stats.template.php:108 (template_top_statistics) -- $settings
Unused global in /themes/default/Stats.template.php:108 (template_top_statistics) -- $scripturl
Unused global in /themes/default/Stats.template.php:108 (template_top_statistics) -- $modSettings
Unused global in /themes/default/Stats.template.php:233 (template_forum_history) -- $scripturl
PS: quick edit is broken, and quick reply has a 100px wide window for typing text, or something... I have to maximize my window again to ensure it triggers a larger width. Nasty bug...! Also, it doesn't focus when I click the textarea; only when I click near the beginning. That's not a textarea right, it's a wysiwyg div..? But wysiwyg is disabled on my page, so... That's odd.
Re: Unused globals
Reply #6 –
Current versions of my script are geared towards php 5.3 lambda functions so I was pretty much forced to give up on auto fixing because of an increased level of complexity. Feel free to use previous revisions of it, though! Their only drawback is that they don't do create_function and I did find a few unused globals in these, after converting them to lambdas.