{"id":25898430,"url":"https://github.com/upsun/wp-ms-dbu","last_synced_at":"2025-10-06T20:05:50.755Z","repository":{"id":269482526,"uuid":"907540764","full_name":"upsun/wp-ms-dbu","owner":"upsun","description":"A WPCLI package for updating multisite databases in preview environments","archived":false,"fork":false,"pushed_at":"2024-12-23T21:48:49.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-23T22:22:55.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/upsun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-23T20:30:28.000Z","updated_at":"2024-12-23T21:48:52.000Z","dependencies_parsed_at":"2024-12-23T22:22:59.972Z","dependency_job_id":"86f5dcd7-66b3-48be-bae0-d3a75d2e4dbb","html_url":"https://github.com/upsun/wp-ms-dbu","commit_stats":null,"previous_names":["upsun/wp-ms-dbu"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upsun%2Fwp-ms-dbu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upsun%2Fwp-ms-dbu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upsun%2Fwp-ms-dbu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upsun%2Fwp-ms-dbu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upsun","download_url":"https://codeload.github.com/upsun/wp-ms-dbu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241587822,"owners_count":19986628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-03T00:18:44.666Z","updated_at":"2025-10-06T20:05:45.722Z","avatar_url":"https://github.com/upsun.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"upsun/wp-ms-dbu\n====================\nms-dbu: **M**ulti**S**ite **D**ata**B**ase **U**pdater\n\nUpdates a multisite's (both subdirectory and sub/multi-domain) database when deployed in a new \n[preview environment](https://docs.platform.sh/glossary.html#preview-environment). \n\nBuilt for use on [Platform.sh](https://platform.sh/) and [Upsun.com](https://upsun.com/) but should be usable in other systems as well (see [Using](#using))\n\n\nQuick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)\n\n## Using\n~~~\nSYNOPSIS\n\n  wp ms-dbu \u003ccommand\u003e\n\nSUBCOMMANDS\n\n  update       Updates WordPress multisites in non-production environments on Platform.sh.\n  version      Displays current ms-dbu version\n\n~~~\n\n### Commands\n#### update\n~~~\nms-dbu update [--routes=\u003croutes\u003e] [--app-name=\u003capp-name\u003e]\n~~~\n\n~~~\n    Updating the database...\n    \u003csnip\u003e\n    Success: Made 110 replacements.\n    \u003csnip\u003e\n    Individual site tables updated for \u003csite\u003e. Now updating network tables...\n    \u003csnip\u003e\n    Network tables updated for \u003csite\u003e.\n    Total processing time was 0.315s\n~~~\n\n##### Options\n~~~\n[--routes=\u003croutes\u003e]\n   JSON object that describes the routes for the environment. Only needed if PLATFORM_ROUTES is not set.\n\n[--app-name=\u003capp-name\u003e]\n   The app name as set in your app configuration. Only needed if PLATFORM_APPLICATION_NAME is not set\n\n[--dry-run]\n   Run the entire search/replace operation and show report, but don’t save changes to the database.\n\n[--verbose]\n   Prints rows to the console as they’re updated.\n~~~\n\n##### routes\nIf you are running this command in a Platform.sh/Upsun.com preview environment, you do not need to include the `--routes` \nparameter; `routes` will automatically be retrieved via the `PLATFORM_ROUTES` environment variable. If you are running \nthe `update` command elsewhere, you will need to provide a JSON object representing your route information in the \nenvironment as the `--routes` parameter. See [routes-example.json](./routes-example.json) for example JSON structure \nfor route information. The `upstream` property will need to include the name of the app as passed in via the `--app-name`\nparameter (see [below](#app-name)).\n\nAlternatively, you can base64 encode the JSON object and store it as an environment variable `PLATFORM_ROUTES` and the\ncommand will automatically ingest the route information.\n\n##### app-name\nIf you are running this command in a Platform.sh/Upsun.com preview environment, you do not need to include the \n`--app-name` parameter; `app-name` will automatically be retrieved via the `PLATFORM_APPLICATION_NAME` environment \nvariable. If you are running the `update` command elsewhere, you will need to provide an app name that matches the \n`upstream` property in your routes json . See [routes](#routes).\n\nAlternatively, you can store the app name as an environment variable `PLATFORM_APPLICATION_NAME` and the command will \nautomatically retrieve the information.\n\n\n#### version\n~~~\nweb@app.0:~$ wp ms-dbu version\nVersion: 0.6.4\n~~~\n\n### Using on Platform.sh/Upsun.com\nIn your application config file (\n[Platform.sh](https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html) / \n[Upsun.com](https://docs.upsun.com/create-apps/app-reference/single-runtime-image.html) ) update your `build` and \n`deploy` hooks to include the following:\n\n#### Build hook\n```yaml\n  build: |\n    wp package install upsun/wp-ms-dbu\n```\n\n#### Deploy hook\n```yaml\n  deploy: |\n    set -e\n    wp cache flush\n    PRODURL=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r '[.[] | select(.primary == true)] | first | .production_url')\n    if [ 'production' != \"${PLATFORM_ENVIRONMENT_TYPE}\" ] \u0026\u0026  wp site list --format=count --url=\"${PRODURL}\" \u003e/dev/null 2\u003e\u00261; then\n      echo \"Updating the database...\";\n      wp ms-dbu update --url=\"${PRODURL}\"\n    else\n      echo \"Database appears to already be updated. Skipping.\";\n    fi\n    \n```\n## Installing\n\nInstalling this package requires WP-CLI v2.5 or greater. Update to the latest stable release with `wp cli update`.\n\nOnce you've done so, you can install the latest stable version of this package with:\n\n```bash\nwp package install upsun/wp-ms-dbu\n```\n\nTo install the latest development version of this package, use the following command instead:\n\n```bash\nwp package install upsun/wp-ms-dbu:dev-update\n```\n\n## Contributing\n\nWe appreciate you taking the initiative to contribute to this project.\n\nContributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by \nwriting tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising \nthis documentation.\n\n### Reporting a bug\n\nThink you’ve found a bug? We’d love for you to help us get it fixed.\n\nBefore you create a new issue, you should \n[search existing issues](https://github.com/upsun/wp-ms-dbu/issues?q=label%3Abug%20) to see if there’s an existing \nresolution to it, or if it’s already been fixed in a newer version.\n\nOnce you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please \n[create a new issue](https://github.com/upsun/wp-ms-dbu/issues/new). Include as much detail as you can, and clear \nsteps to reproduce if possible. \n\n### Creating a pull request\n\nWant to contribute a new feature? Please first [open a new issue](https://github.com/upsun/wp-ms-dbu/issues/new) to \ndiscuss whether the feature is a good fit for the project.\n\n## Support\n\nGitHub issues aren't for general support questions, but there are other venues you can try: \n* [Community website](https://community.platform.sh/)\n* [DevCenter](https://devcenter.upsun.com/)\n* [Discord](https://discord.gg/platformsh)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupsun%2Fwp-ms-dbu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupsun%2Fwp-ms-dbu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupsun%2Fwp-ms-dbu/lists"}