Last active
January 12, 2016 11:27
-
-
Save PatelUtkarsh/1301b837d336ac74fe70 to your computer and use it in GitHub Desktop.
Migration to Wordpress step 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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