forked from wp-sync-db/wp-sync-db
-
Notifications
You must be signed in to change notification settings - Fork 9
/
wp-sync-db.php
executable file
·46 lines (37 loc) · 1.3 KB
/
wp-sync-db.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
Plugin Name: WP Sync DB
Description: Export, push, and pull to migrate your WordPress databases.
Author: Sean Lang
Version: 1.6
Author URI: http://slang.cx
GitHub Plugin URI: ggamel/wp-sync-db
Network: True
*/
$GLOBALS['wpsdb_meta']['wp-sync-db']['version'] = '1.6';
$GLOBALS['wpsdb_meta']['wp-sync-db']['folder'] = basename( plugin_dir_path( __FILE__ ) );
// Define the directory seperator if it isn't already
if( !defined( 'DS' ) ) {
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
define('DS', '\\');
}
else {
define('DS', '/');
}
}
function wp_sync_db_loaded() {
// if neither WordPress admin nor running from wp-cli, exit quickly to prevent performance impact
if ( !is_admin() && ! ( defined( 'WP_CLI' ) && WP_CLI ) ) return;
require_once 'class/wpsdb-base.php';
require_once 'class/wpsdb-addon.php';
require_once 'class/wpsdb.php';
global $wpsdb;
$wpsdb = new WPSDB( __FILE__ );
}
add_action( 'plugins_loaded', 'wp_sync_db_loaded' );
function wp_sync_db_init() {
// if neither WordPress admin nor running from wp-cli, exit quickly to prevent performance impact
if ( !is_admin() && ! ( defined( 'WP_CLI' ) && WP_CLI ) ) return;
load_plugin_textdomain( 'wp-sync-db', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
add_action( 'init', 'wp_sync_db_init' );