interconnectit / Search-Replace-DB

This script was made to aid the process of migrating PHP and MySQL based websites. Works with most common CMSes.
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
GNU General Public License v3.0
4k stars 855 forks source link

PageSize ERROR #243

Closed emmanuelremy closed 4 years ago

emmanuelremy commented 6 years ago

Hello,

Line 896: $page_size = $this->get( 'page_size' );

should be: $page_size = $this->get( 'pagesize' );

Indeed the variable assigned in the constructor is "pagesize" and not "page_size": $args = array_merge( array( ... 'dry_run' => true, 'regex' => false, 'pagesize' => 50000, 'alter_engine' => false, ... ), $args );

Side effect: actually "$page_size" is ALWAYS 50000 since the instance variable "page_size" is set to 50000 by default ( public $page_size = 50000; ). When there is a large number of lines with a large amount of data per line, a memory problem can happen.

Be careful: another solution is only to update $args = array_merge( array( ... 'pagesize' => 50000, ... ), $args ); by $args = array_merge( array( ... 'page_size' => 50000, ... ), $args );

is possible but need to update srdb.cli.php:

'l:' => 'pagesize:',

by

'l:' => 'page-size:',

gianluigi-icit commented 4 years ago

thanks for spotting the bug, we are preparing a new release