Skip to content

Instantly share code, notes, and snippets.

@PatelUtkarsh
Last active January 12, 2016 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatelUtkarsh/1301b837d336ac74fe70 to your computer and use it in GitHub Desktop.
Save PatelUtkarsh/1301b837d336ac74fe70 to your computer and use it in GitHub Desktop.
Migration to Wordpress step 0
<?php
/**
* call this function before executing your wp-cli(maybe in constructor of wp-cli command file) or php script.
*/
function makeitfast() {
//no cache
wp_suspend_cache_addition( true );
// suspend cache invalidation
wp_suspend_cache_invalidation( true );
//don't save queries
if ( ! defined( 'SAVEQUERIES' ) ) {
define( 'SAVEQUERIES', false );
} else {
var_dump('disable debug plugins from WordPress and restart script');
exit;
}
if ( ! defined( 'WP_IMPORTING' ) ) {
define( 'WP_IMPORTING', true );
}
}
/**
* Call this function to clean up some WordPress (you decide when to call).
*/
function cleanup() {
if ( ! class_exists( 'WP_Importer' ) ) {
include_once( ABSPATH . 'wp-admin/includes/class-wp-importer.php' );
}
global $awesome_importer;
if ( empty( $awesome_importer ) ) {
$awesome_importer = new WP_Importer();
}
$awesome_importer->stop_the_insanity();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment