wearerequired / traduttore

🗼 A WordPress plugin to improve the I18N workflow for your own projects based on @GlotPress.
https://wearerequired.github.io/traduttore/
72 stars 15 forks source link

Add a CLI command to unlock a project #247

Open 2ndkauboy opened 1 year ago

2ndkauboy commented 1 year ago

Description In certain situations, a project can get locked. If this happens, there is currently no way to unlock it, except for removing the lock in the database directly.

How has this been tested? In a custom plugin, this command has been registered as a new command in a different namespace, and it could be tested successfully as expected.

Types of changes New feature (non-breaking change which adds functionality)

Checklist:

swissspidy commented 1 year ago

Would wp post meta delete <projectid> _traduttore_update_lock work just as well here?

In certain situations, a project can get locked.

Do you perhaps know what happened in your case? Was there some kind of error perhaps?

I am asking because the lock is supposed to be removed right away after updating:

https://github.com/wearerequired/traduttore/blob/a9faec1a8e3b3ddbcb5222d12c2c3bbf17f069fc/inc/Runner.php#L84-L98

So I am curious to get to the bottom of this.

As an alternative, we could think about simply adding a timestamp as the meta value for the lock and then create some cron job to clean up stale locks.

No manual intervention needed in this case :-)

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 0% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 71.57%. Comparing base (5f49923) to head (92431e9).

Files Patch % Lines
inc/CLI/ProjectCommand.php 0.00% 16 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #247 +/- ## ============================================ - Coverage 72.47% 71.57% -0.91% Complexity 350 350 ============================================ Files 29 29 Lines 1268 1284 +16 ============================================ Hits 919 919 - Misses 349 365 +16 ``` | [Flag](https://app.codecov.io/gh/wearerequired/traduttore/pull/247/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=wearerequired) | Coverage Δ | | |---|---|---| | [feature](https://app.codecov.io/gh/wearerequired/traduttore/pull/247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=wearerequired) | `13.39% <0.00%> (-0.17%)` | :arrow_down: | | [php](https://app.codecov.io/gh/wearerequired/traduttore/pull/247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=wearerequired) | `79.78% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=wearerequired#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

2ndkauboy commented 2 months ago

I don't mind having a different solution to that. Just as of now, there is no straightforward way to unlock a project. This issue came up trying to unlock a project on a WordPress VIP hosting environment, where you don't have direct access to the database and also some WP-CLI commands are forbidden.