Removing the 512MB size limit on All-in-One WP Migration Plugin

Update October 25th, 2018: As of version 6.78 the plugin now no longer supports file imports via the code found on the Wordpress plugin repository. The plugin author forces a “free” plugin download from outside of the Wordpress plugin repo in order to import from a file. This is very dangerous do not download code from outside the plugin repo like they’re recommending. The author’s code for this additional plugin will not be audited by the Wordpress plugin audit team, nor will it be licensed the same as that of the code on the plugin repository. This code could do damn near anything in the future, and if you use it, and update it, you’re trusting them 100% with your site’s security.

I’d advise finding another solution for your backups, as opposed to using version 6.78 and beyond. I’ve forked version 6.77 for my own personal use, I’ll be making many updates that I’m not going to provide community support for what so ever. If you were to download the plugin from me that would be from outside the Wordpress repo too, and you shouldn’t trust me with the security of your site…you don’t know me. Everyone’s on their own now, go find a solution that isn’t shady.

Original Article Below

A WordPress development workflow can be difficult to optimize, especially when working in a team environment. You wont have trouble finding a few well written articles online concerning version control setups and project structures. Setting up a new project is smooth when you’re using a Git repository of some flavor for your theme content, and Database Sync or a similar plugin to sync your local and live databases.

What about the case in which you inherit an existing WordPress site?

It’s not uncommon to need to pull all of a site’s plugins, settings, and media content to a local development environment at least initially. This is typically part of our “on boarding” process at work.

Simply syncing themes and databases as you typically would in your development workflow is not enough in this instance. With a plugin known as All-in-One WP Migration, you’re able to export an entire WordPress instance to a single file with an extension .wpress. You’re then able to turn right back around and import that file to another WordPress installation to create a clone.

Here is what the steps look like to export a production site to a file.

WordPress All-in-One WP plugin Migration Step 1 All-in-One WP Step 2 wpmigration3

At this point, depending upon the size of the backed up file, a blank installation of WordPress may be all that’s necessary to clone the production site.

wpmigration4

If the size of your .wpress file exceeds 512MB, you will be prompted to purchase the Unlimited Extension of All-in-One WP Migration.  If you’re inheriting a site that’s been in production for a while, it’s likely that the backup file is over this small size limit (see a fix for this below).

wpmigration7

wpmigration6

Hacking the plugin seemed like a reasonable thing to try before making the $59 dollar purchase of the Unlimited Extension (which comes with lifetime updates, and unlimited support).

Go ahead and open up /wp-content/plugins/all-in-one-wp-migration/constants.php

Search for “Max File Size” with a simple control + f, and you’ll be directed to the bit of code below.

Updated July 20th 2018

As of version 6.72, the line that defines the file upload limit is line 289 of constants.php. The 2 << 28 is the php bitwise shift left operation, resulting in 536870912 , which is 512MB. You can see the changes made to constants.php between version 6.71 and 6.72 here. These changes aren’t mentioned in the changelog at all, they seem to be an attempt at adding a little “security through obscurity” in order to prevent people from quickly spotting and applying this hack.

// =================
// = Max File Size =
// =================
define( 'AI1WM_MAX_FILE_SIZE', 2 << 28 ); 

Older versions of the plugin (6.71 and below) simply defined the file upload size limit, in bytes, without using the shift operation. Either way though, increasing this limit is extremely easy.

// =================
// = Max File Size =
// =================
define( 'AI1WM_MAX_FILE_SIZE', 536870912 );

In order to increase the upload size limit to 4GB, on all versions of the plugin, simply input the number of bytes as the AI1WM_MAX_FILE_SIZE constant. See below

// =================
// = Max File Size =
// =================
define( 'AI1WM_MAX_FILE_SIZE', 4294967296 ); // THIS LINE MAKES NEW LIMIT 4GB

For the sake of demonstration, let’s set the limit even higher.

// =================
// = Max File Size =
// =================
define( 'AI1WM_MAX_FILE_SIZE', 4294967296 * 10 ); // THIS LINE MAKES NEW LIMIT 40GB

Save the file and navigate back to the “import” function for the All-In-One Migration Plugin. The file upload limit now reads 4GB.

wpmigration8

The plugin will no longer reject your large file uploads.

wpmigration9

wpmigration10

wpmigration11

Note that this plugin does have regular updates, and each update will reset your file upload limit. Because I use this plugin to import existing sites to my local development environment, and not as part of my regular workflow, it’s not much of a problem.

 

/**
* Copyright (C) 2014 ServMask Inc.
*
* This program is free software: you can redistribute it <strong>and/or modify</strong>
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
*/

Comments