Skip to content

Commit

Permalink
[SITE-3292] add @maybe-add-symlinks to post-update-cmd (#175)
Browse files Browse the repository at this point in the history
* add @maybe-add-symlinks to post-update-cmd
add the symlinks if they don't already exist

* Add symlinks on composer update command as well as composer install.

This update applies the same check to create symlinks to files in the `web/` directory that is run on `composer install` commands to `composer update` as well. This ensures that symlinks are created with upstream updates are applied (`composer update`) as well as when new commits to a site repository are pushed (`composer install`).

For more information, see https://docs.pantheon.io/release-notes/2025/02/wordpress-composer-managed-1-32-5
  • Loading branch information
jazzsequence authored Feb 10, 2025
1 parent 72fce19 commit 7a298e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
### v1.32.4
### v1.32.5 (2025-02-10)
* Adds the `maybe-install-symlinks` Composer script to `post-update-cmd` hook. This ensures that symlinks are created (and the `web/index.php` file is re-created) after a `composer update`. ([#175](https://github.com/pantheon-systems/wordpress-composer-managed/pull/175))

### v1.32.4 (2025-02-10)
* Adds a check for `web/index.php` and re-creates the file if it does not exist. Resolves issues where `web/index.php` is missing and breaks a site. ([#173](https://github.com/pantheon-systems/wordpress-composer-managed/pull/173))

### v1.32.3 (2024-09-10)
Expand Down
7 changes: 7 additions & 0 deletions upstream-configuration/scripts/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ public static function applyComposerJsonUpdates(Event $event)
}
}

$maybe_add_symlinks = '@maybe-add-symlinks';
// Check if @maybe-add-symlinks is already in post-update-cmd. If not, add it.
if (!in_array($maybe_add_symlinks, $composerJson['scripts']['post-update-cmd'])) {
$io->write("<info>Adding $maybe_add_symlinks to post-update-cmd hook</info>");
$composerJson['scripts']['post-update-cmd'][] = $maybe_add_symlinks;
}

if (serialize($composerJson) == serialize($originalComposerJson)) {
return;
}
Expand Down

0 comments on commit 7a298e8

Please sign in to comment.