Making WordPress.org

Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#3123 closed enhancement (fixed)

Plugin Directory: Add "Requires PHP" header to readme standard

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: obenland's profile obenland
Milestone: Plugin Directory v3.0 Priority: normal
Component: Plugin Directory Keywords: good-first-bug has-patch
Cc:

Description

#2952 implemented a Requires PHP header for plugins.

The readme validator currently displays a warning if the header is missing, which is good for the ongoing initiative to encourage people to use more recent PHP versions.

The new header should be added to the readme.txt example and documented in the Plugin Developer Handbook.

Attachments (7)

readme.txt (4.5 KB) - added by xkon 7 years ago.
Adding Requres PHP
3123.diff (9.9 KB) - added by xkon 7 years ago.
Adding readme.txt under the wp.org Plugins Theme
3123.2.diff (9.8 KB) - added by xkon 7 years ago.
Updates to markdown + plugin-directory
3123.3.partial.diff (9.9 KB) - added by xkon 7 years ago.
readme.txt into plugin-directory
3123.4.diff (6.1 KB) - added by xkon 7 years ago.
readme.txt to vcs proposal
3123.5.diff (11.0 KB) - added by xkon 7 years ago.
Added into plugin-directory with a redirect
3123.6.diff (11.0 KB) - added by xkon 7 years ago.
using text/plain

Download all attachments as: .zip

Change History (31)

This ticket was mentioned in Slack in #core-php by sergey. View the logs.


7 years ago

#2 @Otto42
7 years ago

Additionally: The readme.txt example is currently just an uploaded file to the site using the media system. It should be stored in version control instead. Either through the plugin-directory plugin, or the plugin directory's theme.

#3 @Otto42
7 years ago

  • Keywords good-first-bug added

#4 follow-up: @xkon
7 years ago

Well hello there !

I was thinking as well to continue @Otto42 thought that maybe the readme.txt could be transfered inside the Handbook as well as there is the Header mockup there could be a full readme there as a base to have everything grouped up nice.

If you want it within the plugin as you say would a shortcode be an option? for example [show-plugin-readme-example] that would output what readme.txt currently has? I'm not sure what you mean exactly as even the .txt itself could be added on the version control even.

I've made the proposals on the #docs channel and for now I'm adding the readme.txt up with the change adding the Requires PHP hoping for some replies from the docs team to see how we can get it going with the Handbooks as well.

Last edited 7 years ago by xkon (previous) (diff)

@xkon
7 years ago

Adding Requres PHP

This ticket was mentioned in Slack in #docs by xkon. View the logs.


7 years ago

#6 @xkon
7 years ago

As a follow up, the Handbooks have been updated including the Requires PHP ( thanks to @milana_cap ).

https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/

There have been suggestions on moving / merging the Handbook pages that are about the readme.txt into one place for easier access + maintenance, also updating the page at https://wordpress.org/plugins/developers/ to instead linking on the readme.txt file to link on a Handbook page instead about it.

I don't know if you want extra tickets for those :) .

#7 in reply to: ↑ 4 @SergeyBiryukov
7 years ago

Replying to xkon:

I was thinking as well to continue @Otto42 thought that maybe the readme.txt could be transfered inside the Handbook as well as there is the Header mockup there could be a full readme there as a base to have everything grouped up nice.

Having the readme example under a permanent, non-date-based URL would resolve #3022 as well.

@xkon
7 years ago

Adding readme.txt under the wp.org Plugins Theme

#8 @xkon
7 years ago

  • Keywords has-patch added

3123.diff adds the readme.txt ( updated with the Requires PHP as well ) under the wporg-plugins theme in a new folder named files that can host more assets in the future if needed.

Probably this tackles #3022 as well as suggested above.

#9 @SergeyBiryukov
7 years ago

Apparently the file was already added to the theme in [3442], it's just not referenced anywhere:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/readme.txt@4223

There was also a change in [3444] to recommend the Markdown format, which went unnoticed.

I think it should probably be moved to the plugin-directory plugin though, since it's not related to the theme, and the theme is not the most obvious location for it.

It would also be nice to create a rewrite rule so that the URL could be https://wordpress.org/plugins/files/readme.txt instead of
https://wordpress.org/plugins/wp-content/plugins/plugin-directory/files/readme.txt

@xkon
7 years ago

Updates to markdown + plugin-directory

#10 @xkon
7 years ago

3123.2.diff add the readme.txt into the plugin-directory instead under folder files again and is converted to markdown as well.

As for the rewrite rule we could do this to support all files under the /files directory that might exist in the future

RewriteRule ^plugins/files/(.*)$ /plugins/wp-content/plugins/plugin-directory/files/$1 [R=301,NC,L]
Last edited 7 years ago by xkon (previous) (diff)

#11 @Otto42
7 years ago

We can't use RewriteRule's like that. We don't run Apache, we run nginx. Any such URL munging should be done in WordPress, in the relevant plugin code.

Version 0, edited 7 years ago by Otto42 (next)

#12 @xkon
7 years ago

Alright @Otto42 thanks for pointing out! Learning something new every 5 seconds here. I'll look into that as well and probably provide a .diff with everything included.

#13 @Otto42
7 years ago

We're also not converting the readme.txt to another flavor of markdown. That is out of scope for this ticket. I'll likely revert [3444], because it's ridiculous.

@xkon
7 years ago

readme.txt into plugin-directory

#14 @xkon
7 years ago

  • Keywords has-patch removed

I'm adding a partial 3123.3.partial.diff to get the readme.txt back to the normal one as Otto said above with the Requires PHP, while adding it into the plugin-directory folder, but my mind doesn't want to achieve the rewrite rules at the moment.

I've gotta run to work but will get back to it later on today as well if nobody else has already.

@xkon
7 years ago

readme.txt to vcs proposal

#15 @xkon
7 years ago

  • Keywords has-patch added

Ok after giving it a lot of research on getting to read something under the plugins folder without making it work I decided to propose the way I'd do it without an actual 'url rewrite'.

This way in 3123.4.diff we achieve all of the above as well.

1) We include it on the version control.
2) It adds a custom template to /plugins/readme.txt to show readme.txt's contents.

I know that this goes off from what @SergeyBiryukov suggested on getting it into the plugin, but it does the job or at least it's a start I think with everything needed here.

What I simply did is added a plugin-readme-txt.php file within the wporg-plugins template and created a custom function to show that file when someone goes to /plugins/readme.txt. It's a basic html template nothing more to it.

I've tested this on a normal template but I'm at work without access to VVV so if you can test it it'll be awesome.


Edit:

Testing in VVV now and apparently this doesn't work since everything under /plugins/ trigger a search instead. Going back at it now that I have VVV at least I can test. Sorry for all the spam ! Trying hard here..

Last edited 7 years ago by xkon (previous) (diff)

@xkon
7 years ago

Added into plugin-directory with a redirect

#16 @xkon
7 years ago

3123.5.diff addresses everything ( I think ) after a long day of researching VVV and learning so I'm happy and I think this is ready for a final review.

  • Adds a redirect on /plugins/readme.txt to read the file contents.
  • readme.txt is added into vcs now in the \files\ folder of the plugin-directory
  • readme.txt has the Requires PHP as well

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.


7 years ago

@xkon
7 years ago

using text/plain

#18 @xkon
7 years ago

After reading the slack chat on #meta since I was not able to be there yesterday ( sorry ! ) I saw some concerns for <pre>. In 3123.6.diff I changed <pre> into using text/plain instead as suggested to avoid validation issues that might rise.

This ticket was mentioned in Slack in #meta by xkon. View the logs.


7 years ago

#20 @obenland
6 years ago

  • Type changed from task to enhancement

@Otto42 What do you think of 3123.6.diff?

#21 @Otto42
6 years ago

In 6392:

Plugins: Point to new readme.txt file to add Requires PHP line, see #3123

#22 @Otto42
6 years ago

The addition of the rewrites makes sense if we're going to use the one in the theme, rather than the one we maintain in the WordPress media library right now. Especially since when I updated it, the date changed so I had to alter the theme anyway.

#23 @obenland
6 years ago

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

In 6411:

Plugins: Move example readme file to plugin.

Gives the file a version history and makes it available from the Plugin Directory root.
It also removes the need to update the URL every time a new version gets uploaded.

Props xkon.
Fixes #3123.

#24 @dd32
5 years ago

In 8587:

Plugin Directory: https://wordpress.org/plugins/readme.txt should return a 200, not 404.

See #3123.

Note: See TracTickets for help on using tickets.