Opened 17 years ago
Closed 17 years ago
#5418 closed defect (bug) (fixed)
remove unused variables from wp-admin/*.php
Reported by: | DD32 | Owned by: | |
---|---|---|---|
Milestone: | 2.5 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
In short, This patch removes unused variables from various admin files.
/*.php, /wp-includes/*.php to follow in coming days, I'm currently working through a automated audit of code for unused variables/PHP versions required for functions/constants
Attachments (7)
Change History (28)
#3
follow-up:
↓ 4
@
17 years ago
Looks like a double declaration in upload.php, line 81:
global $style, $style;
#4
in reply to:
↑ 3
@
17 years ago
Replying to Bobcat:
Looks like a double declaration in upload.php, line 81:
global $style, $style;
Er, Thanks for catching that one :)
I'll include it in the next patch if its not removed by then.
#6
@
17 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Fixed up a few more & corrected the mis-spellings.
just a note on this 2nd patch:
- The nonce field is removed as it never has a value, seems the field is added furthur down the page anyway
- Theres some testing stuff at the end of {{{wp-admin/install-helper.php))) left over from removing a link-table column, i've left that in place.
- I'm marking function arguements as $deprecated if they're no longer used within the function itself. If it seems like the arguement should be used but doesnt, i'll open a ticket for the item.
#8
@
17 years ago
Attaching another patch here, even though ticket specifies wp-admin.
Attached ticket covers wp-includes and root files.
xmlrpc.php
looks ugly in the patch, the mixture of Tab & 2space indents were changed into tabs. Infact thats the same in a few places where some indentings were corrected.
A few typos were corrected as well (see 2nd wp-app.php
& 3rd wp-includes\formatting.php
edits)
This is a huge patch, So It'll probably be good if others can do a glance review of any files they've got good knowledge of, While i'm pretty sure i've not broken anything, as the last patch showed, my spelling isnt that great sometimes :)
3rd party classes and admin import files were ignored once again.
#10
follow-up:
↓ 11
@
17 years ago
That last patch introduced this:
apply_filters('wp_create_file_in_uploads', $file); replicate
The output of the filter was removed, because it wasn't used in the rest of the code, but doesn't that imply that the entire apply_filters call can be removed as well? Why filter if you throw away the output.
This happens in wp-app.php (415), wp-admin/custom-header.php (231) and wp-admin/link-import.php (126).
#11
in reply to:
↑ 10
@
17 years ago
Replying to Nazgul:
That last patch introduced this:
apply_filters('wp_create_file_in_uploads', $file); replicate
Cheers, I forgot to ask about that..
I didnt see the point in storing the return value, but I thought it might currently be in use by plugins/themes.
Eg. a quick google: http://www.google.com/search?hl=en&safe=off&client=opera&rls=en&hs=Qxt&q=add_filter%28+%27wp_create_file_in_uploads%27&btnG=Search seems to suggest K2 uses it to process the custom header image.
#12
follow-up:
↓ 13
@
17 years ago
In that case, do_action('wp_create_file_in_uploads', $file);
would suffice.
#13
in reply to:
↑ 12
;
follow-up:
↓ 14
@
17 years ago
Replying to JeremyVisser:
In that case,
do_action('wp_create_file_in_uploads', $file);
would suffice.
I thought so too, However, That filter is used elsewhere, and in those cases, the output may be modified.
In the lines pointed out, the return value was simply going to be ignored anyway, Yet i thought other scripts may want to hook those events too.
#14
in reply to:
↑ 13
;
follow-up:
↓ 15
@
17 years ago
Replying to DD32:
However, that filter is used elsewhere, and in those cases, the output may be modified.
But in this instance, the value is being ignored, so semantically, I believe it's better to do do_action()
. (Although, I think do_action()
uses apply_filters()
internally, so it's definitely not for optimisation reasons.)
#15
in reply to:
↑ 14
@
17 years ago
Replying to JeremyVisser:
But in this instance, the value is being ignored, so semantically, I believe it's better to do
do_action()
. (Although, I thinkdo_action()
usesapply_filters()
internally, so it's definitely not for optimisation reasons.)
Ah your right, I for some reason had it in my mind, that the action, and filters were stored in seperate arrays.
I'll make the change and then post a patch back.
I'll also add a diff of xmlrpc.php so as to show what was removed from it when spacings are ignored. (not intended to be commited -- just for information purposes)
#16
@
17 years ago
4th iteration over files. Fixes some typo's around the place, adds more of the deprecated marks.
#17
follow-up:
↓ 18
@
17 years ago
Actions and filter hooks such as update_option_home, update_option_siteurl, and cure_update_footer have unused arguments so that they fit the prototype for given action or filter. Instead of saying "deprecated" we should say "unused" or something to that affect.
#18
in reply to:
↑ 17
@
17 years ago
Replying to ryan:
Actions and filter hooks such as update_option_home, update_option_siteurl, and cure_update_footer have unused arguments so that they fit the prototype for given action or filter. Instead of saying "deprecated" we should say "unused" or something to that affect.
Allright, I'll go revert those changes, thanks.
(In [6354]) Remove unused variables. Props DD32. fixes #5418