Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21553 closed enhancement (fixed)

Remove dupe/deprecated code from sites.php

Reported by: wonderboymusic's profile wonderboymusic Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.0
Component: Multisite Keywords: has-patch commit
Focuses: Cc:

Description

current_user_can( 'manage_sites' ) is called at the top of sites.php, so it doesn't need to be present in every single case in the switch statement.

The "updated" message is currently being output in the middle of an H2, I moved that below it.

The form handler is looking at every action and then passing a different action to the redirect that is only read by the message switch statement. This is weird, so I moved the action name to the "updated" query arg, since updated having a value is the same thing as updated=true&action=non-colliding-name.

There is no row action for matureblog and unmatureblog (I scanned the whole codebase), so I removed them.

Attachments (1)

sites-bloat.diff (12.3 KB) - added by wonderboymusic 12 years ago.

Download all attachments as: .zip

Change History (8)

#1 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.5

The matureblog and unmatureblog handlers are there in case plugins add simple mature/unmature action links. We do actually support "mature" blogs in core, just not in the UI.

Otherwise, looks good.

#2 @wonderboymusic
12 years ago

updated the patch, matureblog/unmatureblog restored

#3 follow-up: @kawauso
12 years ago

Any reason to be using strict comparison in the $doaction comparisons? Switches use loose comparison (http://php.net/manual/en/control-structures.switch.php), so you could have an action argument that was capitalised and would go to the correct case, but fail in the strict comparison.

Being slightly pedantic, but still seems odd.

#4 in reply to: ↑ 3 @nacin
12 years ago

Replying to kawauso:

Any reason to be using strict comparison in the $doaction comparisons? Switches use loose comparison (http://php.net/manual/en/control-structures.switch.php), so you could have an action argument that was capitalised and would go to the correct case, but fail in the strict comparison.

Loose comparisons are not case-insensitive.

var_dump( 'apple' == 'APPLE', 'apple' === 'APPLE' );
// bool(false)
// bool(false)

#5 @martythornley
12 years ago

  • Cc marty@… added

#6 @nacin
12 years ago

  • Keywords commit added
  • Owner set to nacin
  • Status changed from new to assigned

Looks like this just needs final review and commit.

#7 @ryan
12 years ago

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

In [22064]:

Remove dupe/deprecated code from sites.php.

Props wonderboymusic
fixes #21553

Note: See TracTickets for help on using tickets.