forked from hrsetyono/wp-sync-db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitesync.php
executable file
·71 lines (53 loc) · 2.12 KB
/
sitesync.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*
Plugin Name: Site Synchronizer
Description: Synchronize database and uploads folder between sites
Author: Colovic Vladan
Version: 1.7.5
Author URI: https://www.cvladan.com
Plugin URI: http://github.com/cvladan/sitesync
Network: True
*/
require __DIR__ . '/library/autoload.php';
$GLOBALS['wpsdb_meta']['wp-sync-db']['version'] = '1.7';
$GLOBALS['wpsdb_meta']['wp-sync-db']['folder'] = basename( plugin_dir_path( __FILE__ ) );
define( 'WPSDB_ROOT', plugin_dir_url(__FILE__) );
define( 'PLUGIN_SLUG', 'sitesync');
define( 'QUERY_VAR_NAME_PROFILE', 'profile');
define( 'SS_OPTION_SETTINGS', 'sitesync_settings');
define( 'SS_OPTION_ERRORLOG', 'sitesync_errorlog');
// 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', '/');
}
}
# GitHub update checks
#
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
$myUpdateChecker = PucFactory::buildUpdateChecker( 'https://github.com/cvladan/sitesync/', __FILE__, 'sitesync', 72 );
# Set the branch that contains the stable release.
# $myUpdateChecker->setBranch('stable-branch-name');
# Optional: If you're using a private repository, specify the access token like this:
# $myUpdateChecker->setAuthentication('your-token-here');
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' );
require_once 'module-cli/_load.php';
require_once 'module-media-files/_load.php';