dkplus/mysql-migration-layer

Layer for migration from mysql to mysqli.

0.1 2013-11-26 08:29 UTC

README

Build Status Scrutinizer Quality Score Coverage Status Total Downloads Latest Stable Version Latest Unstable Version

Layer for migration from mysql to mysqli.

Installation

composer

For composer documentation, please refer to getcomposer.org.

php composer.phar require dkplus/mysql-migration-layer

Post-install

After installing replace all mysql_*() calls with \MySQL\Proxy::*().

You can do this step automatically. Therefore you must also install nikic/php-parser:

php composer.phar require nikic/php-parser

Then you can run the converter by calling:

php vendor/bin/convert-mysql.php [-w] <file>

Run the script with the path of the PHP file you wish to convert as argument. This will print the converted source code to STDOUT.

You can add the -w switch if you want to override the original file with the converted code.

In case of any error, an error message is written to STDERR and the script exits with a return code of 1.

Use find to convert a whole directory recursively:

find <directory> -name "*.php" -exec php "vendor/bin/convert-mysql.php" -w "{}" \;