Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/antoonline/jenkins-tool-wordpress-replace-site-url

This Jenkins pipeline updates WordPress URLs in a database. It takes parameters for old and new URLs, MySQL credentials, and the WordPress table prefix. It checks for and installs the MySQL client if needed, then runs SQL queries to replace the old URL with the new one in relevant fields.
https://github.com/antoonline/jenkins-tool-wordpress-replace-site-url

jenkins jenkinsfile replace url wordpress

Last synced: 28 days ago
JSON representation

This Jenkins pipeline updates WordPress URLs in a database. It takes parameters for old and new URLs, MySQL credentials, and the WordPress table prefix. It checks for and installs the MySQL client if needed, then runs SQL queries to replace the old URL with the new one in relevant fields.

Awesome Lists containing this project

README

        

# Pipeline for WordPress URL Replacement

This pipeline script replaces the URLs of a WordPress site from an old URL to a new URL. It uses MySQL to perform the replacement and requires the following parameters:

- `OLD_URL`: The old site URL to be replaced
- `NEW_URL`: The new site URL to replace the old URL
- `MYSQL_USER`: The MySQL user to authenticate with
- `MYSQL_PASSWORD`: The password for the MySQL user
- `MYSQL_DATABASE`: The name of the MySQL database to perform the replacement on
- `MYSQL_HOST`: The hostname of the MySQL server
- `TABLE_PREFIX`: The WordPress table prefix (default: `wp_`)

## Pipeline Stages

### Check MySQL client

This stage checks if the MySQL client is installed on the machine and installs it if it's not available. It currently supports only Linux operating systems.

### Replace URL

This stage replaces the old URL with the new URL in the WordPress database using MySQL queries. It replaces the URLs in the following tables:

- `wp_options`
- `wp_posts`
- `wp_postmeta`

It uses the parameters provided in the pipeline to connect to the MySQL server and authenticate the user.

## Want to connect?

Feel free to contact me on [Twitter](https://twitter.com/OnlineAnto), [DEV Community](https://dev.to/antoonline/) or [LinkedIn](https://www.linkedin.com/in/anto-online) if you have any questions or suggestions.

Or just visit my [website](https://anto.online) to see what I do.