Closed benoitchantre closed 2 years ago
Hey ☕
thanks for reporting. Can you maybe see more when you run with -vvv
and provide some example composer.json / wp-translation-downloader.json so that i can try to reproduce it? :)
@benoitchantre did some small improvements when iterating over TranslatablePackage
to ensure that those languageDirectory()
exist before download & unzip the files. Additionally i improved the trim()
of trailing slashes for directory input via wp-translation-downloader
-configuration. Could you quickly test with dev-master
? :)
See changes in: https://github.com/inpsyde/wp-translation-downloader/commit/098c71316e07c1f27876814b4dd57ec1b6cbf03a
@Chrico I did a quick test and it didn't worked.
Here's a simplified version of my composer.json
{
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"require": {
"php": ">=7.2.5",
"composer/installers": "^1.3",
"inpsyde/wp-translation-downloader": "dev-master",
"johnpbloch/wordpress": "5.9.*",
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "^3.4",
"wp-coding-standards/wpcs": "^2.3",
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/installers": true,
"johnpbloch/wordpress-core-installer": true,
"inpsyde/wp-translation-downloader": true
},
"vendor-dir": "vendor",
"preferred-install": "dist",
"optimize-autoloader": true,
"sort-packages": true
},
"extra": {
"installer-paths": {
"public/wp-content/mu-plugins/{$name}": [
"wearerequired/wp-cli-clear-opcache",
"type:wordpress-muplugin"
],
"public/wp-content/plugins/{$name}/": [
"type:wordpress-plugin"
],
"public/wp-content/themes/{$name}/": [
"type:wordpress-theme"
]
},
"wordpress-install-dir": "public/wp",
"wp-translation-downloader": {
"auto-run": false,
"api": {
"names": {
"gravity/gravityforms": "https://packages.translationspress.com/rocketgenius/gravityforms/packages.json"
}
},
"directory": "public/wp-content/languages",
"languages": [
"de_DE",
"en_GB",
"it_IT",
"fr_FR"
]
}
}
}
And a simplified version of my deployment workflow (only the build part with unrelated steps removed)
name: Deploy
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Environment
options:
- test
- staging
- production
default: 'test'
jobs:
build:
name: Build
runs-on: ubuntu-20.04
concurrency:
group: deploy-${{ github.event.inputs.environment }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Setup PHP
uses: shivammathur/setup-php@448bd61c6fe9db2113173467e4c22b87ddc2971a
with:
php-version: '7.4'
coverage: none
tools: wp-cli
- name: Validate composer.json and composer.lock
run: composer validate --no-check-publish --strict
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Configure Composer cache
uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-
- name: Run make install with dev dependencies
run: make install WP_ENVIRONMENT_TYPE=local
- name: Check coding standards
run: make check-phpcs
- name: Remove dev dependencies
run: touch composer.lock && make install WP_ENVIRONMENT_TYPE=production
- name: Download translations files
run: composer wp-translation-downloader:download
make install WP_ENVIRONMENT_TYPE=local
runs composer install --no-interaction --no-ansi --no-progress
and copy required some files that are not related to PHP if needed.
make install WP_ENVIRONMENT_TYPE=production
runs composer install --no-dev --classmap-authoritative --no-interaction --no-ansi --no-progress
and copy required some files that are not related to PHP if needed.
Hm... I just created with the code you posted here a temporary test repo: https://github.com/Chrico/_wp-translation-downloader-test/runs/6408040694?check_suite_focus=true
Only changes i did: I replaced the make
-scripts with the composer install ...
you mentioned, removed make check-phpcs
(since i don't have that) and i added -vvv
to the wp translaton downloader step to get more info.
--> It works. 🤔
I also triggered a second deploy for "production" and a "Re run" to see if something goes wrong with "composer cache". But everything looks good.
Edit: Since the initial request was regarding the sub-folder plugins
-> I added "wpackagist-plugin/wordpress-seo":"18.8"
to the composer.json to see if it is failing for Plugins installation (sub-folder): https://github.com/Chrico/_wp-translation-downloader-test/runs/6408214253?check_suite_focus=true
--> Works as well.
I think either something with your make
-scripts does not work or there is something else interfering with it. The Plugin::ensureDirectoryExists()
uses internally the Composer\Util\Filesystem
which creates the directories with a 777
permission: Composer/Util/Filesystem.php#L267. So an access permission problem shouldn't happen - expect something in between changes the owner of the folder or permissions.
Could you try to strip it to the bare minimum for the sake of testing? You don't need actually to finish the deployment, just remove everything after the translation downloading step as you posted above. 🙃
Maybe you can also split your deployment step into 2 steps: First is validation + phpcs and the seconds depends on (needs:
) the first one to finish successfully?
Thank you for your feedbacks.
I'll create a test repo to debug that, but I won't have the time to do that in the next few days.
@Chrico The bug appears when some plugins are installed as dev dependencies and then removed. You can see that in my test repository by looking at the latest 2 commits and workflow runs. https://github.com/benoitchantre/test-wp-translation-downloader
Good catch 💪 will dig into it. :)
Error probably occurs here: https://github.com/inpsyde/wp-translation-downloader/blob/master/src/Util/Remover.php#L61
See: https://github.com/inpsyde/wp-translation-downloader/commit/778ec7bcab6af755291dc9f7cab02ae998b6b4b4
@benoitchantre could you try to test this? :)
@Chrico It works, thank you for the fix.
Unrelated: is it normal to see the plugin banner when the auto-run
value is set to false
?
Inpsyde
WP Translation Downloader
From my memory, it wasn't displayed after a composer install
when the auto-run is disabled.
@benoitchantre i moved a bit code with latest release and introduced the Plugin::boostrap()
and removed the Io
class to re-use only the Composer one. I guess this is a side-effect since Plugin::bootstrap()
is called before $this->pluginConfig->autorun()
is called. I guess it's fine since the Configuration "auto-run" is set to "false" is printed afterwards. 😮
The fix was released with version 2.2 https://github.com/inpsyde/wp-translation-downloader/releases/tag/2.2 💪 Thanks for your input @benoitchantre
JFI:
Unrelated: is it normal to see the plugin banner when the auto-run value is set to false ?
This was revereted/fixed in version 2.2.1 @benoitchantre 🙈
@Chrico Thank you!
Description of the bug
I have updated this depency from version 2.04 to version 2.1.
I have now an issue in my Github workflow :
/wp-content/languages/plugins/" directory does not exist
The
auto-run
parameter is set tofalse
. Translations are downloaded with the following command:composer wp-translation-downloader:download
Reproduction instructions
auto-run
tofalse
composer install
andcomposer wp-translation-downloader:download
in a Github workflowExpected behavior
There should be not issue :-)
Environment info
Github workflow (CI)
Main build steps:
Relevant log output
Additional context
No response
Code of Conduct