where wp-content/plugins/my-plugin/ is a symlink to project-dir/.
Previously I was using dist-archive on the src directory and now I'm trying to use it on the entire project directory, with appropriate an .distignore in the project root. PhpStorm project screenshot
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 121634848 bytes) in /path/to/project-dir/vendor/wp-cli/wp-cli/php/WP_CLI/Process.php on line 75
When I delete the symlink, I am able to use dist-archive without issue.
Describe what you would expect as the correct outcome
I expect the wp-content folder to have no bearing on the operation because it is listed in the .distignore file.
Let us know what environment you are running this on
MacOS M1, Monterey (12.3.1), PHP 8.0 via Homebrew, Zsh shell.
OS: Darwin 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm64
Shell: /bin/zsh
PHP binary: /opt/homebrew/bin/php
PHP version: 8.0.19
php.ini used: /opt/homebrew/etc/php/8.0/php.ini
MySQL binary: /opt/homebrew/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.7.3-MariaDB, for osx10.17 (arm64) using EditLine wrapper
SQL modes: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir: /Users/brianhenry/Sites/bh-wc-disable-free-gifts-per-product/vendor/wp-cli/wp-cli
WP-CLI vendor dir: /Users/brianhenry/Sites/bh-wc-disable-free-gifts-per-product/vendor
WP_CLI phar path:
WP-CLI packages dir: /Users/brianhenry/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config: /Users/brianhenry/Sites/bh-wc-disable-free-gifts-per-product/wp-cli.yml
WP-CLI version: 2.6.0
Provide a possible solution
Using the zip flag:
-y store symbolic links as the link instead of the referenced file
But I presume it would prevent the dist-ignore command from working with plugins that use symlinks internally to the plugin (i.e. not just dev tools and environment) during development.
Alternatively, I could copy all files to system temp before archiving them.
Bug Report
Describe the current, buggy behavior
I have a project structure with a recursive symlink:
where
wp-content/plugins/my-plugin/
is a symlink toproject-dir/
.Previously I was using
dist-archive
on thesrc
directory and now I'm trying to use it on the entire project directory, with appropriate an.distignore
in the project root. PhpStorm project screenshotMy
.distignore
file containswp-content
in it.Still, running
wp dist-archive . out.zip
causes aPHP Fatal error
:When I delete the symlink, I am able to use
dist-archive
without issue.Describe what you would expect as the correct outcome
I expect the
wp-content
folder to have no bearing on the operation because it is listed in the.distignore
file.Let us know what environment you are running this on
MacOS M1, Monterey (12.3.1), PHP 8.0 via Homebrew, Zsh shell.
Provide a possible solution
Using the
zip
flag:Change:
$cmd = "zip -r '{$archive_file}' {$archive_base} {$excludes}";
to:
$cmd = "zip -y -r '{$archive_file}' {$archive_base} {$excludes}";
This works.
But I presume it would prevent the
dist-ignore
command from working with plugins that use symlinks internally to the plugin (i.e. not just dev tools and environment) during development.Alternatively, I could copy all files to system temp before archiving them.