{"id":13519200,"url":"https://github.com/interconnectit/Search-Replace-DB","last_synced_at":"2025-03-31T12:31:26.522Z","repository":{"id":1986197,"uuid":"2918243","full_name":"interconnectit/Search-Replace-DB","owner":"interconnectit","description":"This script was made to aid the process of migrating PHP and MySQL based websites. Works with most common CMSes.","archived":false,"fork":false,"pushed_at":"2025-03-04T19:55:33.000Z","size":1345,"stargazers_count":4025,"open_issues_count":27,"forks_count":856,"subscribers_count":156,"default_branch":"master","last_synced_at":"2025-03-25T23:01:33.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://interconnectit.com/products/search-and-replace-for-wordpress-databases/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interconnectit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2011-12-05T17:09:20.000Z","updated_at":"2025-03-20T22:15:57.000Z","dependencies_parsed_at":"2024-06-18T12:29:45.224Z","dependency_job_id":"393c2956-a50d-4e63-806f-3dbf4e2fca29","html_url":"https://github.com/interconnectit/Search-Replace-DB","commit_stats":{"total_commits":276,"total_committers":47,"mean_commits":5.872340425531915,"dds":0.8405797101449275,"last_synced_commit":"24583f38e49d8e053043704f84ffc0f8a4307686"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interconnectit%2FSearch-Replace-DB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interconnectit%2FSearch-Replace-DB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interconnectit%2FSearch-Replace-DB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interconnectit%2FSearch-Replace-DB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interconnectit","download_url":"https://codeload.github.com/interconnectit/Search-Replace-DB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246469195,"owners_count":20782687,"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":"2024-08-01T05:01:55.564Z","updated_at":"2025-03-31T12:31:26.516Z","avatar_url":"https://github.com/interconnectit.png","language":"PHP","readme":"[![Build Status](https://travis-ci.org/interconnectit/Search-Replace-DB.svg?branch=4.0)](https://travis-ci.org/interconnectit/Search-Replace-DB)\n\n# Search Replace DB - v4.1.4\n\nThis script was made to aid the process of migrating PHP and MySQL\nbased websites. Works with most common CMSes.\n\nIf you find a problem let us know in the issues area and if you can\nimprove the code then please fork the repository and send us a pull\nrequest :)\n\n## What's New in 4.1.4\n\nAdapted to work with a broader range of PHP versions - warnings in PHP 8.x versions should be gone now.\n\n## What's New in 4.1\n * Support for continuous integration through Travis CI\n * Ability to do multiple search-replaces\n * Ability to exclude tables\n * Remove specific loaders for WP\n * No longer automatically populate DB fields, this was causing security issues for users leaving the script on their site\n * Script now checks whether the correct version of PHP is used\n * Script checks if necessary modules are installed\n * Script checks if the connection is secure and gives a warning otherwise\n * Bug fixes\n * UI Tweaks\n * Password is not mandatory in CLI\n * Ability to connect using SSL, command line only feature\n\n## Warnings \u0026 Limitations\n\nWe can't test every possible case, though we do our best. Backups and\nverifications are important.\n\nYou use this script at your own risk and we have no responsibility for\nany problems it may cause.\n\nThere are many edge cases and WordPress plugins that likes to mess\nyour database, we don't have a silver bullet.\n\nThe license for this software is GPL v3, please bear this in mind if\ncontributing or branching.\n\n*Do backups*, also *do backups* and finally *do backups*!\n\n## Usage\n\n1. *Do backups.*\n2. Migrate all your website files.\n3. Upload the script folder to your web root or higher.\n4. Browse to the script folder URL in your web browser.\n5. Fill in the fields as needed.\n6. Choose the `Do a safe test run` button to do a dry run without searching/replacing.\n\n## Installation\nTo install the script, please place the files inside your sites public folder and head to yoursiteURL/Search-Replace-DB\n\n### CLI script\n\nTo invoke the script, navigate in your shell to the directory to where\nyou installed Search Replace DB.\n\nType `php srdb.cli.php` to run the program. Type `php srdb.cli.php\n--help` for usage information:\n\n```\n  -h, --host\n    Required. The hostname of the database server.\n\n  -n, --name\n    Required. Database name.\n\n  -u, --user\n    Required. Database user.\n\n  -p, --pass\n    Database user's password.\n\n  -P, --port\n    Optional. Port on database server to connect to. The default is\n    3306. (MySQL default port).\n\n  -s, --search\n    String to search for or `preg_replace()` style regular\n    expression.\n\n  -r, --replace\n    None empty string to replace search with or `preg_replace()`\n    style replacement.\n\n  -t, --tables\n    If set only runs the script on the specified table, comma\n    separate for multiple values.\n\n  -w, --exclude-tables\n    If set excluded the specified tables, comma separate for multuple\n    values.\n\n  -i, --include-cols\n    If set only runs the script on the specified columns, comma\n    separate for multiple values.\n\n  -x, --exclude-cols\n    If set excludes the specified columns, comma separate for\n    multiple values.\n\n  -g, --regex [no value]\n    Treats value for -s or --search as a regular expression and -r or\n    --replace as a regular expression replacement.\n\n  -l, --pagesize\n    How rows to fetch at a time from a table.\n\n  -z, --dry-run [no value]\n    Prevents any updates happening so you can preview the number of\n    changes to be made\n\n  -e, --alter-engine\n    Changes the database table to the specified database engine eg.\n    InnoDB or MyISAM. If specified search/replace arguments are\n    ignored. They will not be run simultaneously.\n\n  -a, --alter-collation\n    Changes the database table to the specified collation eg.\n    utf8_unicode_ci. If specified search/replace arguments are\n    ignored. They will not be run simultaneously.\n\n  -v, --verbose [true|false]\n    Defaults to true, can be set to false to run script silently.\n\n  --debug [true|false]\n    Defaults to false, prints more verbose errors.\n\n  --ssl-key\n    Define the path to the SSL KEY file.\n\n  --ssl-cert\n    Define the path to the SSL certificate file.\n\n  --ssl-ca\n    Define the path to the certificate authority file.\n\n  --ssl-ca-dir\n    Define the path to a directory that contains trusted SSL CA\n    certificates in PEM format.\n\n  --ssl-cipher\n    Define the cipher to use for SSL.\n\n  --ssl-check [true|false]\n    Check the SSL certificate, default to True.\n\n  --allow-old-php [true|false]\n    Suppress the check for PHP version, use it at your own risk!\n\n  --help\n    Displays this help message ;)\n```\n\n### Example cli commmands:\n\n```bash\nphp srdb.cli.php -h dbhost -n dbname -u root -p \"\" -s \"http://www.yourdomain.com\" -r \"http://newdomain.com\"\n\nphp srdb.cli.php -h dbhost -n dbname -u root -p \"password\" -s \"http://www.yourdomain.com\" -r \"http://newdomain.com\"\n\nphp srdb.cli.php -h dbhost -n dbname -u root -p \"password\" -s \"search\" -r \"replace\"\n```\n\n## Troubleshooting\n\n### Nothing works after the search/replace operation!\n\nIt's time to use your backups!\n\n### I get a popup saying there was an AJAX error\n\nThis happens occasionally and could be for a couple of reasons:\n\n * When the script starts, it attempts to start your WordPress or\n   Drupal installation to auto-detect your username and password\n   settings. If this fails, you will see a message informing you that\n   auto-detection failed. You will have to enter your details\n   manually.\n\n * Script was unable to set the timeout so PHP closed the connection\n   before the table could be processed, this can happen on some server\n   configurations.\n\n## Contributing\n\nYou can view the source code and submit a pull request using GitHub,\nthe project's page is located at:\n\nhttps://github.com/interconnectit/Search-Replace-DB/\n\nWe appreciate a small unittest among the code, please explain what\nyou are  is trying to solve.\n\n# License\n\nThis file is part of Search-Replace-DB.\n\nSearch-Replace-DB is free software: you can redistribute it and/or\nmodify it under the terms of the GNU General Public License as\npublished by the Free Software Foundation, either version 3 of the\nLicense, or any later version.\n\nSearch-Replace-DB is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Search-Replace-DB.\nIf not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":["PHP","WordPress"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterconnectit%2FSearch-Replace-DB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterconnectit%2FSearch-Replace-DB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterconnectit%2FSearch-Replace-DB/lists"}