Make WordPress Core

Opened 16 years ago

Closed 5 years ago

Last modified 2 weeks ago

#14781 closed feature request (wontfix)

Allow upload of PHP files as plugin

Reported by: hakre Owned by:
Priority: normal Milestone:
Component: Upgrade/Install Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: administration

Description

Currently allowed are only ZIP packages. Plugins that consist of a single PHP file are not supported. It would be handy if uploading a single PHP file is an option.

Attachments (4)

php_upload_func.patch​ (1.3 KB ) - added by Ornani 16 years ago.
14781_2.diff​ (1.3 KB ) - added by edwardw 15 years ago.
Refresh of existing patch
14781.3.diff​ (1.1 KB ) - added by Mte90 9 years ago.
patch refreshed
14781.4.diff​ (1.5 KB ) - added by pbiron 6 years ago.
refreshing patch

Download all attachments as: .zip

Change History (22)

#1 @hakre
16 years ago

Related: #9757

#2 @hakre
16 years ago

Workaround: Zipping the single one PHP file (not having any directory attached) and uploading it, does the job.

#3 @nacin
16 years ago

  • Component General → Upgrade/Install
  • Type defect (bug) → enhancement

#4 follow-up: @dd32
16 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → Future Release
  • Type enhancement → feature request

Seems like a relatively sane idea, Checks would need to be performed obviously to ensure that the file contains proper plugin headers.

#5 in reply to: ↑ 4 @hakre
16 years ago

Replying to dd32:

Seems like a relatively sane idea, Checks would need to be performed obviously to ensure that the file contains proper plugin headers.

Shouldn't we do the exact checks on the unpacked zip as well?

#6 @dd32
16 years ago

Shouldn't we do the exact checks on the unpacked zip as well?

They are done AFAIK, However skipping the unzip process would bypass that section of code.

#7 @Ornani
16 years ago

  • Keywords needs-testing added

I've attached a patch that fixes this issue functional-wise. Now you can upload a single PHP file or ZIP archives.

The thing that is not done is taking care over the texts and user messages.

Also needs testing.

#8 @Ornani
16 years ago

  • Keywords needs-patch, needs-testing → needs-patch,needs-testing

@edwardw
15 years ago

Refresh of existing patch

#9 @edwardw
15 years ago

  • Keywords has-patch dev-feedback added; needs-patch needs-testing removed

#10 @chriscct7
12 years ago

  • Keywords needs-refresh added; has-patch removed

Seems like a relatively good idea. Patch needs a refresh though

#11 @chriscct7
11 years ago

  • Focuses administration added
  • Keywords has-patch added; dev-feedback removed

#12 @swissspidy
10 years ago

  • Keywords needs-unit-tests added

@Mte90
9 years ago

patch refreshed

#13 @Mte90
9 years ago

I refreshed the patch looking about how to do unit tests.
Seems that WP_Upgrader class doesn't have unit test so someone can help about?
I cannot find also an unit test for the actual code that check if the zip upload is working.

@pbiron
6 years ago

refreshing patch

#14 @pbiron
6 years ago

  • Keywords needs-refresh removed

14781.4.diff​ Refreshed patch so that it cleaning applies.

I did add 1 thing to the refreshed patch: if rename() fails, it sets $result to a WP_Error instance. Without this, the update would appear to succeed when it actually hasn't.

As @dd32 mentions, I think the patch should be extended to check that the uploaded single PHP file actually has plugin headers. That is not yet included in the patch.

I'd also say that I'm not sure that creating a sub-directory and putting the single PHP in there is right thing to do. Since core allows single file plugins to exist directly in WP_PLUGIN_DIR, if this ticket moves forward that might be what should happen.

But since at the moment I'm just triaging tickets in this component and refreshes patches where needed, I won't bother investigating that possibility at this time.

This ticket was mentioned in ​Slack in #core-auto-updates by afragen. ​View the logs.


5 years ago

This ticket was mentioned in ​Slack in #core-auto-updates by francina. ​View the logs.


5 years ago

#17 @francina
5 years ago

  • Milestone Future Release
  • Resolution → wontfix
  • Status new → closed

After reviewing the ticket in the month of May 2021, the people working on this component decided to close the ticket. The developer hub has some best practices for plugin format and those should be followed: ​https://developer.wordpress.org/plugins/plugin-basics/best-practices/#folder-structure
Thank you everyone for the discussion over the years.

EDIT: Deleted. This was erroneously linked when a GitHub PR reference was interpreted as a Trac ticket number.


2 weeks ago
#18

  • Keywords has-unit-tests added; needs-unit-tests removed
Note: See TracTickets for help on using tickets.