wordpress-core icon indicating copy to clipboard operation
wordpress-core copied to clipboard

Updating delete all WP files

Open GioPetry opened this issue 10 months ago • 5 comments

Hi I use your wp-core package in composer with other packagist plugins to update WP via composer. Today If I do an usual composer update it states: "Upgrading johnpbloch/wordpress-core (6.4.3 => 6.5.0)" After that my wp site is like reinstalled all themes files and plugins are erased Please assist

GioPetry avatar Apr 03 '24 16:04 GioPetry

You might want to use a higher level abstraction, like https://github.com/wecodemore/wpstarter/

lkraav avatar Apr 08 '24 20:04 lkraav

@GioPetry checkout this package https://github.com/drupal-composer/preserve-paths. You can prevent deletions by adding something like

"preserve-paths": [
    "web/wp-content/themes/custom-theme",
    "web/wp-content/plugins/custom-plugin"
],

mralexho avatar Apr 10 '24 16:04 mralexho

@GioPetry checkout this package https://github.com/drupal-composer/preserve-paths. You can prevent deletions by adding something like

"preserve-paths": [
    "web/wp-content/themes/custom-theme",
    "web/wp-content/plugins/custom-plugin"
],

@mralexho this can be a good quick solution BUT does it work for files too? at least the wp-config need to be saved...

GioPetry avatar Apr 24 '24 17:04 GioPetry

@GioPetry yes it works for individual files. Did you see their example? Add the following to your composer file

"preserve-paths": [
    "web/wp-config.php",
    "web/wp-content/themes/custom-theme",
    "web/wp-content/plugins/custom-plugin"
],

mralexho avatar Apr 24 '24 20:04 mralexho

@GioPetry yes it works for individual files. Did you see their example? Add the following to your composer file

"preserve-paths": [
    "web/wp-config.php",
    "web/wp-content/themes/custom-theme",
    "web/wp-content/plugins/custom-plugin"
],

Thanks but it seems to conflict with the installer see below the message I get. Also I use wpackagist to install and update plugin and themes. Files of installed package were overwritten with preserved path /home/staging/htdocs/mysite/wp-content/themes! Files of installed package were overwritten with preserved path /home/staging/htdocs/mysite/wp-content/plugins!

At the moment the easiest way to work around is is to remove this wp core and installer and use composer just for plugins and themes

GioPetry avatar Apr 26 '24 15:04 GioPetry