Print Friendly, PDF & Email

Getting Started with Import and Export

Import and Export can be used for a variety of purposes, but most notable are:

  • Sharing with co-workers or collaborating on a project.
  • Archiving complete solutions and configurations.
  • Import an existing website for redesign.
  • Transport between workstations.
  • Deploying to a live server.

As of this writing, this feature has been tested on all platforms with websites that averaged less then 500 megabytes in total size. This shouldn’t be an issue for most developers given that most WordPress.com sites hardly break the 100 megabyte content mark; significantly less if you are deploying a new site where content has yet to be established. However, Multisite and heavy content providers of video and multimedia should note possible hardware limitations that might inhibit import/export and their workarounds at the bottom of this post (see the Limitations section for tips on successful transfer of very large websites).

The Export Feature

Exporting will allow you to transfer a site to another DesktopServer user or you may use this feature to deploy your site to a live server on a hosting provider. Start by selecting the “Export or import a website” option and click next, followed by the “Export a WordPress website archive” option and click next. You will be presented with the following screen featuring a number of fields. Only the first field is required. The remaining fields are optional depending on your goal for the export destination.

An explanation of the fields and user interface controls follow:

  • Website – Required. This combo box lists all the websites that you have installed in DesktopServer. Simply select the website you wish to export.
  • Database Name, Username, Password, and Host – These fields are only relevant if you are manually deploying your site to a live web server at a hosting provider. The fields correspond to the wp-config.php settings and should contain the credentials for connecting to your live host’s MySQL database server. Otherwise, they are ignored when transporting your site to another DesktopServer. You may also omit these fields if you already have a basic install of WordPress on your live host and wish to use the beta “Quick Deploy” feature.
  • Extract from wp-config.php – Press the button to display the file open dialog window for selecting an existing wp-config.php file. The fields will automatically populate with the credentials from the selected wp-config.php file. The credentials will then be used in the exported wp-config.php file that is stored in ZIP archive.
  • Make site visible to search engines – This check box is turned on by default in anticipation that you may be exporting to a live web server. This check box mirrors WordPress’ Settings ? Privacy menu and is ignored (set to false) when re-importing into another DesktopServer.
  • Purge post and page revisions – This check box deletes all revisions that can accumulate while developing your WordPress website content prior to deployment. You can reduce the overhead and file size of your website archive by ensuring this setting is checked. Un-check the check box to preserve revisions.

Websites imported or created using DesktopServer have always had their privacy set to block search engines. This is to prevent false network traffic during development and stop ping services that would otherwise confuse search engines that attempt to reach your unreachable and fictitious .dev (dot DEV) website. The ‘Make site visible to search engines’ check box will override this setting when exporting to ensure visibility.

Note: Transferring the database manually outside of DesktopServer’s export feature such as via phpMyAdmin or by using another product (i.e. BackupBuddy or WP Twin) will copy the setting to block search engines. You may change the setting using WordPress’ admin Settings ? Privacy menu to meet your SEO endeavors in your deployed website.

After setting the minimum first field (Website) requirement, you may click next to continue.

An explanation of the fields and user interface controls that appear next follow:

  • Site Name – This is the site name of your deployed WordPress website. Be sure to include your registered and valid domain name that includes a real top-level domain (such as .com, .org, .info, etc.). The top-level domain will be ignored and replaced with .dev (dot DEV) if you intend to import the website back into another DesktopServer.
  • File Name – The file name of the zip archive that will contain your website. You may choose any name you wish, but It is important that you do not rename the file after export to maintain compatibility when deploying to a live server or importing back into another DesktopServer on another computer platform (Mac OS X or Windows).
  • Export Path – This is the path where your website export ZIP archive will be written to. Make a note of the location to easily find the file after export completes.
  • Browse – This button will allow you to specify a different location for the website export ZIP archive. Click the button to select a new folder location.
  • Customize scrubbing options – Use this check box to define custom scrubbing options or leave it unchecked to accept recommended settings.

You can prepare your development website for deployment on a live server by defining your real registered domain name in the Site Name field. This will prepare all your files, including your database export file with the correct real domain using the ‘scrubbing’ process. Click next to prepare your website ZIP archive.

About the Scrubbing Process

Scrubbing is the act of analyzing your website files and the MySQL database for references to your website’s domain name. During the process of creating your development website, you may have made references to your domain name (i.e. www.example.dev). These references might exist inside the edits you have made to the PHP files that make up your site’s template, or within the body of content that make up your posts and pages inside the database. Various plugins and configuration settings may also reference your development domain name. Scrubbing will replace these old references with new references to the real site name you intend to use for live deployment. A typical WordPress developer would limit such references to the files inside the wp-contents folder, and leave all other files (aka WordPress ‘core’ files) untouched. A WordPress pro wouldn’t even reference the domain name at all, but instead use WordPress template tags (such as <?php bloginfo(‘url’); ?> ) or isolate such references to only be inside database post content.

Unfortunately, it is not an easy task to update references inside the MySQL database as data is usually formatted (serialized) in a way that a traditional search and replace would break the database. Even dumping the data to a text file and re-importing the data after a search and replace would prove unsuccessful. This is because WordPress, plugins, and themes may store data in formats that would become corrupted when edited by hand. DesktopServer takes a more advanced approach by scanning files and all of your database tables (even ones that third-party plugins create) to correct for these issues. To accelerate the process, DesktopServer gives you additional options to omit tables and files that don’t need to be scrubbed. You may access scrubbing options by selecting the ‘Customize scrubbing options’ check box when importing or exporting to and from DesktopServer. The default will list the database tables and common files and folders to omit. In most cases, you can just use the default.

The ZIP archive will contain all of your website’s files which will include the following:

  • All WordPress core files including the wp-config.php with the database credentials you specified (if any) for your live hosting provider.
  • All of your wp-content folder and files, including plugins, themes, uploaded content, etc.
  • A database dump of all your database tables for WordPress, inside a file called ‘database.sql’ which includes any tables that third-party plugins may have created.

Deploying your website to a live server would require manual installation or using our new beta feature, “Quick Deploy”. Manual installation entails copying the contents of the ZIP package to your live web server and executing the contents of the database.sql on your live MySQL database. The database.sql file can be executed using phpMyAdmin’s Import feature into your live database or via the MySQL command line tool if you have shell access to your hosting provider account. It should be noted that the database.sql file will erase any existing WordPress database.

The Import Feature

Importing will allow you to create a new DesktopServer website from an existing website archive. The feature will import from other DesktopServer export archives and is also compatible with the free Duplicator plugin that is available in the WordPress.org plugin directory. This will allow you to transport your work between DesktopServers or from a live website to DesktopServer by using Duplicator to import a live website.

To get started using the import feature, select the “Export or import a website” option and click next, followed by the “Import an existing WordPress website archive” option and click next. You will be presented with a number of fields as defined below:

  • Import File – Provide the ZIP archive file produced from a previous DesktopServer export or from the Duplicator plugin. Click the empty field or the ‘…’ button to display the file open dialog box to select the ZIP archive.
  • Site Name – Specify a site name to refer to your DesktopServer website. DesktopServer will replace the top-level domain name with the fictitious .dev (dot DEV) domain to ensure you are accessing a localhost website.
  • Site Root – This is a read-only field that indicates the location to place your WordPress website files for your newly imported website.
  • Browse – Use the browse button to specify a different Site Root to store your website files. Click the button to display a folder selection dialog window.
  • Customize scrubbing options – Use this check box to define custom scrubbing options or leave it unchecked to accept recommended settings.

You can select the ZIP file you want to import as a new WordPress website by simply clicking the first field (Import File). Once you select a ZIP file, DesktopServer will attempt to validate the file format. You can customize the domain name by altering the Site Name field. For security purposes DesktopServer will change the top-level domain to .dev (dot DEV). Clicking the next button will start the import process and your new website URL will be presented to you on the last screen.

Limitations

Limitations vary based on your hardware specifications (amount of memory, processor speed to perform scrubbing, etc.), there are some innate limitations to the technology at this time. Heavy video and Multisite users will want to note that file sizes above 2 gigs and total number of files exceeding 65000 individual files will break the standard ZIP file format. Import and export features use the standard ZIP file format and it would be safe to say that import and export sizes exceeding this are not supported. Although we have yet to test the upper bounds of import and export, here are some key tips that can help make import/export with very large sites as smooth as possible.

  • Use the default setting to purge post and page revisions when exporting.
  • Eliminate any unused plugins or themes that you are not using.
  • Delete any unused content (pictures, video, etc.)

The bulk of most WordPress websites come from uploaded content such as pictures and video. If file size is a major concern, you may wish to temporarily move your wp-content/uploads folder or wp-content/blogs.dir folder (for Multisite websites) out of your website during the export process. You can always move it back or transport the contents independently to deploy your site on a live server. Media content usually does not require a scrubbing process for a successful transfer.

Conclusion

With DesktopServer’s new import and export features, you can easily transfer your website creations to other DesktopServer users. You can also import existing websites from a live host, or deploy your work to a live host. For more information about how to deploy live, check out my post titled Using Quick Deploy on a Live Server. If you wish to capture your current live website, check into my post titled Using Duplicator to Import a Live Website. Now with import/export, you can share your WordPress creations and solutions, complete with their configurations easily.

Last updated on November 13, 2016