diff --git a/CHANGELOG.md b/CHANGELOG.md index fe2f3e1..a52b4d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +# Version 4.1.2 + * Now you can suppress the checks for PHP and be able to run this tool in an old setup + # Version 4.1.1 * Class autoloader in composer.json diff --git a/README.md b/README.md index a9369a6..fc9529c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [](https://travis-ci.org/interconnectit/Search-Replace-DB) -# Search Replace DB - v4.1.1 +# Search Replace DB - v4.1.2 This script was made to aid the process of migrating PHP and MySQL based websites. Works with most common CMSes. @@ -146,6 +146,9 @@ Type `php srdb.cli.php` to run the program. Type `php srdb.cli.php --ssl-check [true|false] Check the SSL certificate, default to True. + --allow-old-php [true|false] + Suppress the check for PHP version, use it at your own risk! + --help Displays this help message ;) ``` diff --git a/index.php b/index.php index 2fce750..7d27563 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ /** * - * Safe Search and Replace on Database with Serialized Data v4.1.1 + * Safe Search and Replace on Database with Serialized Data v4.1.2 * Copyright © 2020 Interconnect IT Limited * * This script is to solve the problem of doing database search and replace when @@ -912,7 +912,7 @@ class="db-required run-script"/>
This developer/sysadmin tool carries out search/replace functions on MySQL DBs and can handle serialised PHP Arrays and Objects.
diff --git a/package.json b/package.json index 57a1919..90c2bc9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "search-replace-db", - "version": "4.1.1", + "version": "4.1.2", "description": "A PHP search replace tool for quickly modifying a string throughout a database. Useful for changing the base URL when migrating a WordPress site from development to production.", "main": "srdb.cli.php", "directories": { diff --git a/srdb.cli.php b/srdb.cli.php index bdcab22..c89e8aa 100755 --- a/srdb.cli.php +++ b/srdb.cli.php @@ -80,6 +80,8 @@ [ '', 'ssl-cipher:', 'Define the cipher to use for SSL.', ], [ '', 'ssl-check:', 'Check the SSL certificate, default to True.', '[true|false]' ], + [ '', 'allow-old-php', 'Suppress the check for PHP version, use it at your own risk!' ], + [ '', 'help', 'Displays this help message ;)', ], ); @@ -156,12 +158,6 @@ function strip_colons( $string ) { // missing field flag, show all missing instead of 1 at a time $missing_arg = false; -if ( version_compare( PHP_VERSION, '7.3' ) < 0 ) { - fwrite( STDERR, - "This script has been tested using PHP7.3 +, whereas your version is: " . PHP_VERSION . ". Although this script may work with older versions you do so at your own risk. Please update php and try again. \n" ); - exit( 1 ); -} - if ( ! extension_loaded( "mbstring" ) ) { fwrite( STDERR, "This script requires mbstring. Please install mbstring and try again.\n" ); exit ( 1 ); @@ -184,12 +180,17 @@ function strip_colons( $string ) { // new args array $args = array( - 'verbose' => true, - 'ssl_check' => true, - 'dry_run' => false, - 'debug' => false + 'verbose' => true, + 'ssl_check' => true, + 'dry_run' => false, + 'debug' => false, + 'allow_old_php' => false ); +if ( isset( $options['allow-old-php'] ) ) { + $args['allow_old_php'] = true; +} + // create $args array foreach ( $options as $key => $value ) { @@ -223,6 +224,14 @@ function strip_colons( $string ) { $args[ $key ] = $value; } +if ( $args['allow_old_php'] === false ) { + if ( version_compare( PHP_VERSION, '7.3' ) < 0 ) { + fwrite( STDERR, + "This script has been tested using PHP7.3 +, whereas your version is: " . PHP_VERSION . ". Although this script may work with older versions you do so at your own risk. Please update php and try again. \n" ); + exit( 1 ); + } +} + // modify the log output class icit_srdb_cli extends icit_srdb { public function log( $type = '' ) {