WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#28748 closed enhancement (wontfix)

Add an action hook before file loading process for Multisite medias starts in wp-includes/ms-files.php

Reported by: ShinichiN Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Media Keywords:
Focuses: multisite Cc:
PR Number:

Description

My suggestion is adding a action hook in wp-includes/ms-files.php so that plugins can stop or do something before the file loading process begins.

I wanted to limit access to files if visitor is not logged in to the network.

Attachments (1)

ms-files-action.diff (502 bytes) - added by ShinichiN 6 years ago.
First patch

Download all attachments as: .zip

Change History (5)

@ShinichiN
6 years ago

First patch

#1 @ericlewis
6 years ago

Can you expand on how you want to "limit access to files to non-logged in users"? There's probably a way to do this already, which wouldn't require a new hook.

All files are publicly accessible if someone has the URL. You would need to do something at the .htaccess level to change this.

Last edited 6 years ago by ericlewis (previous) (diff)

#2 @jeremyfelt
6 years ago

  • Keywords close added

Providing some sort of method of password protection for static assets is appealing, though if handled through ms-files.php, it would likely be security through obscurity as the files all have static locations.

As ms-files was deprecated in 3.5 - see #19235 - and per #20527, we likely won't be adding enhancements to the current core ms-files. As nacin mentions in that ticket - "Rather than using wp-includes/ms-files.php, you could always use wp-content/ms-files.php and change your rewrite rules."

#3 @ShinichiN
6 years ago

Thank you ericlewis and jeremyfelt.

I'll have a look at /wp-content/ms-files.php to change rewrites.

Last edited 6 years ago by ShinichiN (previous) (diff)

#4 @SergeyBiryukov
6 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.