Making WordPress.org

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#5242 closed enhancement (fixed)

Plugins should use svn timestamps for accurate last-updated value

Reported by: tellyworth's profile tellyworth Owned by: coreymckrill's profile coreymckrill
Milestone: Priority: low
Component: Plugin Directory Keywords:
Cc:

Description

Currently, the svn import script uses current_time() as the value for a plugin's "last updated" timestamp. That's fine in most circumstances. But it gives an incorrect value in some cases, for example if the import script is run manually.

Ideally, it should use the Last Changed Date as given by svn info.

Attachments (1)

5242.diff (5.9 KB) - added by coreymckrill 4 years ago.

Download all attachments as: .zip

Change History (5)

@coreymckrill
4 years ago

#1 @coreymckrill
4 years ago

  • Owner set to coreymckrill
  • Status changed from new to accepted

The above patch adds a new info method to the Tools\SVN class. It also refactors a portion of the export_and_parse_plugin method in CLI\Import to use the new SVN method to find the correct location of the stable tag before running an export. Finally it uses the data from the new method to populate the plugin's "Last updated" timestamp.

In testing, using bin/import-plugin.php, the "Last updated" was getting set to the correct value from the svn repo. One (possibly trivial) side benefit is that the refactor of the export process seems to have cut the time to process a single plugin in half--1.4 seconds vs 2.6 seconds on my sandbox.

This probably needs more testing before merge, especially to make sure there aren't any regressions in how export_and_parse_plugin handles edge cases. I'm not sure yet how best to find and test those edge cases though.

Last edited 4 years ago by coreymckrill (previous) (diff)

#2 @dd32
4 years ago

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

In 10044:

Plugin Directory: When importing plugins, use the last commit date to the stable tag as the Last Updated value for the plugin.

This allows for WordPress.org to re-import plugins/blocks without affecting the last-updated date displayed.

Props coreymckrill, dd32.
Fixes #5242.

#3 @dd32
4 years ago

I did some testing, and rearranged a bit of logic in the patch to account for edge-cases that I could think of, but other than a second review from myself, the best way to test it seemed to be to just push it to production and watch for any errors.

#4 @dd32
4 years ago

In 10046:

Plugin Directory: Fix a typo I introduced.

See #5242.

Note: See TracTickets for help on using tickets.