Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#16117 closed defect (bug) (fixed)

Deleting theme in multisite throws errors

Reported by: talus's profile talus Owned by:
Milestone: 3.1 Priority: normal
Severity: major Version: 3.1
Component: Multisite Keywords: has-patch
Focuses: multisite Cc:

Description

Deleting a theme in multisite (3.1-RC2-17229) threw the following error:
(Attempting to delete constructor theme below)

Warning: fopen(/home/~~username~~/public_html/~~sitename~~.com/wp-content/themes/constructor/style.css) [function.fopen]: failed to open stream: No such file or directory in /home/~~username~~/public_html/~~sitename~~.com/wp-includes/functions.php on line 4273

Warning: fread(): supplied argument is not a valid stream resource in /home/~~username~~/public_html/~~sitename~~.com/wp-includes/functions.php on line 4276

Warning: fclose(): supplied argument is not a valid stream resource in /home/~~username~~/public_html/~~sitename~~.com/wp-includes/functions.php on line 4279

Then asks to confirm delete of Theme (blank space) by Anonymous.

Attachments (6)

16117.patch (645 bytes) - added by SergeyBiryukov 14 years ago.
greuben-16117.diff (494 bytes) - added by greuben 14 years ago.
remove unnecessary query args before redirecting
greuben-16117-rev2.diff (566 bytes) - added by greuben 14 years ago.
I think this looks better than my previous patch
16117-3.diff (574 bytes) - added by greuben 14 years ago.
16117-4.diff (690 bytes) - added by greuben 14 years ago.
as nacin suggested
16117.diff (1.6 KB) - added by ryan 14 years ago.
Fix redirect after connection information

Download all attachments as: .zip

Change History (30)

#1 @SergeyBiryukov
14 years ago

I'm only able to reproduce this if I delete style.css manually before clicking the Delete link. Added check for file existence (just in case).

#2 @nacin
14 years ago

This is really edge -- if the theme doesn't have a style.css then it won't be listed.

@greuben
14 years ago

remove unnecessary query args before redirecting

#3 @greuben
14 years ago

It displays the delete form again because action='delete-selected' is set.

#4 @nacin
14 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.1

@greuben
14 years ago

I think this looks better than my previous patch

#5 @ryan
14 years ago

It'd be nice to delete what files there are rather than skipping the theme.

#6 @ryan
14 years ago

This seems so edge case that I think it can wait until 3.2.

#7 @talus
14 years ago

Please note: I did not delete any files manually. In fact, to repro the test, I installed Constructor from the theme install, then deleted it immediately. Constructor is a "Featured" theme from WordPress.org, and this error occurred with every theme I tried.

#8 follow-up: @greuben
14 years ago

You can't delete a theme if you don't have style.css because it wont show up in list.

@ryan
3.2? releasing 3.1 with errors is bad.

#9 @greuben
14 years ago

This is caused by r17130

Last edited 14 years ago by greuben (previous) (diff)

@greuben
14 years ago

#10 @nacin
14 years ago

If we're going to avoid remove_query_arg(), can we use add_query_arg() instead? Looks better.

For what it's worth though, I think remove_query_arg() is proper here.

#11 @nacin
14 years ago

Should this be part of $temp_args higher up? Does it apply to other redirects?

#12 @greuben
14 years ago

It does not apply to other redirects because query arg action in $referer is only set in the delete-selected verify form. Yes, it can move to $temp_args.

@greuben
14 years ago

as nacin suggested

#13 in reply to: ↑ 8 @ryan
14 years ago

Replying to greuben:

You can't delete a theme if you don't have style.css because it wont show up in list.

I know. We have a broken themes list elsewhere, perhaps that should be included here.

@ryan
3.2? releasing 3.1 with errors is bad.

There are always errors. :-)

The latest patch seems good though.

#14 @ryan
14 years ago

Are any of you testing with FTP? I can't get any themes to delete, with or without these patches. Tons of notices are thrown on the Connection Information screen. It looks like all of the things admin.php sets up are not being set up.

#15 @ryan
14 years ago

Deleting a plugin throws the same notices but actually works in the end.

#16 @ryan
14 years ago

The redirect url in delete_theme() needs to be updated for network admin. Either pass a redirect url or add an is_network_admin() check inside the function.

@ryan
14 years ago

Fix redirect after connection information

#17 @PeteMall
14 years ago

Attached patch by ryan works for the theme deletion over ftp issue. Need another patch for the notices.

#18 @ryan
14 years ago

(In [17237]) Fix net admin theme deletion over FTP. see #16117

#19 @ryan
14 years ago

The other patches will break deletion over FTP.

#20 @ryan
14 years ago

Actually, -3 works with FTP. -4 does not.

#21 @ryan
14 years ago

(In [17238]) Fix post theme delete redirect. Props greuben. see #16117

#22 @ryan
14 years ago

The notices when showing the Connection Information form during a delete via FTP are also present in 3.0. I think we can ignore those for 3.1. If someone wants to try to track the root cause down, however, that would be great.

#23 @ryan
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

See #16143 for the notices. Closing this ticket as fixed.

Note: See TracTickets for help on using tickets.