This repository provides the features of the WordPress plugin External files in media library. The repository is used as a basis for deploying the plugin to the WordPress repository. It is not intended to run as a plugin as it is, even if that is possible for development.
As user of the plugin you find documentation for protocols and handling in the doc-directory.
After checkout go through the following steps:
Run the following commands in this order:
composer installnpm inpm run build- after that the plugin can be activated in WordPress.
- copy build/build.properties.dist to build/build.properties.
- modify the build/build.properties file - note the comments in the file.
- after that the plugin can be activated in WordPress.
- Run this command:
task prepare - after that the plugin can be activated in WordPress.
composer installnpm inpm run buildcomposer test-installcomposer testvendor/bin/phpstan analysevendor/bin/phpcbf .vendor/bin/phpcs .- Set version nummer in readme.txt and external-files-in-media-library.php.
- Create the release ZIP with all necessary folders and files.
- increase the version number in build/build.properties.
- execute the following command in build/:
ant build - after that you will find a zip file in the release directory, which could be used in WordPress to install it.
- execute the following command in the main directory:
task release -- 5.0.0- adjust the version number. - after that you will find a zip file in the release directory, which could be used in WordPress to install it.
- Create a new tag with the new version number.
- The release zip will be created by a GitHub action.
I recommend translating this plugin in the WordPress Translating tool.
For manual translation I recommend to use PoEdit to translate texts for this plugin.
Run in the main directory:
wp i18n make-pot . languages/external-files-in-media-library.pot --exclude=svn/
- Open .po-file of the language in PoEdit.
- Go to "Translate" > "Update from POT-file".
- After this the new entries are added to the language-file.
- Open .po-file of the language in PoEdit.
- Go to "File" > "Save".
- Upload the generated .mo-file and the .po-file to the plugin-folder languages/
composer install
vendor/bin/phpcs .
vendor/bin/phpcbf .
vendor/bin/wp-documentor parse app --format=markdown --output=docs/hooks.md --prefix=eml_ --exclude=Section.php --exclude=Tab.php --exclude=Import.php --exclude=Export.php --exclude=Field_Base.php --exclude=Settings.php --exclude=Page.php --exclude=Rest.php --exclude=Transients.php
Hint: this check runs against the VIP-GO-platform, not our target for this plugin. Many warnings can be ignored.
vendor/bin/phpcs --extensions=php --ignore=*/attributes/*,*/blocks/*,*/example/*,*/css/*,*/vendor/*,*/node_modules/*,*/svn/*,*/tests/* --standard=WordPress-VIP-Go .
vendor/bin/phpcs -p app --standard=PHPCompatibilityWP
vendor/bin/phpstan analyse
wp plugin check --error-severity=7 --warning-severity=6 --include-low-severity-errors --categories=plugin_repo --format=json --slug=external-files-in-media-library .
composer test-install
composer test
composer test-coverage
Needs the PHP extension pcov, e.g. on Debian: apt install php-pcov
composer test-multisite
Runs the tests for multisites in a multisite installation. They are skipped in composer test.
Some tests use real FTP, FTPS, SFTP and HTTP servers on 127.0.0.1. The HTTP server also simulates the WordPress REST API. Without them, these tests are skipped.
- Install the Python modules once, e.g. on Debian:
apt install python3-pyftpdlib python3-openssl python3-paramiko(the HTTP server needs only Python itself) - For the SFTP tests, the PHP extension ssh2 is necessary, e.g. on Debian:
apt install php-ssh2 bin/test-servers.sh startcomposer testbin/test-servers.sh stop
The servers run as the actual user on the ports 2121, 2122, 2990, 2991, 2222, 8181 and 30000-30099, never as root.
See bin/test-servers.sh to change them. ant build starts and stops the servers itself.
Restart the servers after changes on their scripts in tests/Servers, otherwise the tests fail with a hint.
Use composer test -- -v to see why tests were skipped.
See: https://wordpress.github.io/wordpress-playground/guides/e2e-testing-with-playwright/
npm install
npx playwright install chromium
npx playwright test