config.php
4 years ago
config.wordpress.demo.php
5 years ago
config.wordpress.free.php
5 years ago
config.wordpress.php
3 years ago
config.wordpress.php
190 lines
| 1 | <?php |
| 2 | |
| 3 | global $wp_version, $wpdb; // phpcs:ignore |
| 4 | if (!defined('SG_ENV_WORDPRESS')) { |
| 5 | define('SG_ENV_WORDPRESS', 'Wordpress'); |
| 6 | } |
| 7 | define('SG_ENV_MAGENTO', 'Magento'); |
| 8 | define('SG_ENV_VERSION', $wp_version); // phpcs:ignore |
| 9 | if (!defined('SG_ENV_ADAPTER')) { |
| 10 | define('SG_ENV_ADAPTER', SG_ENV_WORDPRESS); |
| 11 | } |
| 12 | if (!defined('SG_ENV_DB_PREFIX')) { |
| 13 | define('SG_ENV_DB_PREFIX', $wpdb->prefix); |
| 14 | } |
| 15 | require_once(dirname(__FILE__) . '/config.php'); |
| 16 | |
| 17 | define('SG_ENV_CORE_TABLE', SG_WORDPRESS_CORE_TABLE); |
| 18 | //Database |
| 19 | if (!defined('SG_DB_ADAPTER')) { |
| 20 | define('SG_DB_ADAPTER', SG_ENV_ADAPTER); |
| 21 | } |
| 22 | if (!defined('SG_DB_NAME')) { |
| 23 | define('SG_DB_NAME', $wpdb->dbname); |
| 24 | } |
| 25 | if (!defined('SG_BACKUP_DATABASE_EXCLUDE')) { |
| 26 | define('SG_BACKUP_DATABASE_EXCLUDE', SG_ACTION_TABLE_NAME . ',' . SG_CONFIG_TABLE_NAME . ',' . SG_SCHEDULE_TABLE_NAME); |
| 27 | } |
| 28 | |
| 29 | //Templates |
| 30 | define('SG_TEMPLATES_PATH', realpath(SG_APP_PATH . '../public/templates') . '/'); |
| 31 | |
| 32 | |
| 33 | define('SG_MAIL_TEMPLATES_PATH', realpath(SG_APP_PATH . '../public/templates/mails') . '/'); |
| 34 | define('SG_MAIL_BACKUP_TEMPLATE', 'mail_backup.php'); |
| 35 | define('SG_MAIL_RESTORE_TEMPLATE', 'mail_restore.php'); |
| 36 | define('SG_MAIL_UPLOAD_TEMPLATE', 'mail_upload.php'); |
| 37 | |
| 38 | //Notice |
| 39 | define('SG_NOTICE_TEMPLATES_PATH', realpath(SG_APP_PATH . '../public/templates/notices') . '/'); |
| 40 | |
| 41 | //Htaccess |
| 42 | define('SG_HTACCESS_TEMPLATES_PATH', realpath(SG_APP_PATH . '../public/templates/htaccess') . '/'); |
| 43 | |
| 44 | //BackupGuard SDK |
| 45 | define('SG_BACKUPGUARD_CLIENT_ID', 'wordpress'); |
| 46 | define('SG_BACKUPGUARD_CLIENT_SECRET', 'AAPQEgsyQrt6wqDBk7fpa24NP6W43evtayxXmUqS'); |
| 47 | |
| 48 | define('SG_BACKUPGUARD_UPLOAD_CLIENT_ID', 'backupguard'); |
| 49 | define('SG_BACKUPGUARD_UPLOAD_CLIENT_SECRET', 'e9503d56b06b95241abf68eaa0d13194aae9503e'); |
| 50 | |
| 51 | define('SG_BACKUPGUARD_UPLOAD_SCOPE', 'create_backups'); |
| 52 | |
| 53 | //Backup |
| 54 | $wpContent = basename(WP_CONTENT_DIR); |
| 55 | $wpPlugins = basename(WP_PLUGIN_DIR); |
| 56 | $wpThemes = basename(get_theme_root()); |
| 57 | |
| 58 | $uploadDir = wp_upload_dir(); // phpcs:ignore |
| 59 | $wpUploads = basename($uploadDir['basedir']); // phpcs:ignore |
| 60 | |
| 61 | $dbCharset = 'utf8'; |
| 62 | if (@constant("DB_CHARSET")) { |
| 63 | $dbCharset = DB_CHARSET; |
| 64 | } |
| 65 | |
| 66 | //Exclude others plugin dirs |
| 67 | function backupGuardFindExcludesDirs() |
| 68 | { |
| 69 | $callback = function ($value) { |
| 70 | return mb_substr($value, 19); |
| 71 | }; |
| 72 | |
| 73 | $mergedArray = array_merge( |
| 74 | glob(WP_CONTENT_DIR . '/*backup*', GLOB_ONLYDIR), |
| 75 | glob(WP_CONTENT_DIR . '/*tmp*', GLOB_ONLYDIR), |
| 76 | glob(WP_CONTENT_DIR . '/*log*', GLOB_ONLYDIR), |
| 77 | glob(WP_CONTENT_DIR . '/uploads/*backup*', GLOB_ONLYDIR), |
| 78 | glob(WP_CONTENT_DIR . '/uploads/*log*', GLOB_ONLYDIR), |
| 79 | glob(WP_CONTENT_DIR . '/uploads/*temp*', GLOB_ONLYDIR) |
| 80 | ); |
| 81 | |
| 82 | return array_values(array_map($callback, $mergedArray)); |
| 83 | } |
| 84 | |
| 85 | $findExcludesDirs = backupGuardFindExcludesDirs(); |
| 86 | |
| 87 | //Define same constants in magento config file |
| 88 | define('SG_UPLOAD_PATH', $uploadDir['basedir']); |
| 89 | define('SG_UPLOAD_URL', $uploadDir['baseurl']); |
| 90 | if (!defined('SG_SITE_URL')) { |
| 91 | define('SG_SITE_URL', get_site_url()); |
| 92 | } |
| 93 | define('SG_HOME_URL', get_home_url()); |
| 94 | define('SG_DB_CHARSET', $dbCharset); |
| 95 | if (!defined('SG_MYSQL_VERSION')) { |
| 96 | define('SG_MYSQL_VERSION', $wpdb->db_version()); |
| 97 | } |
| 98 | $type = "standard"; |
| 99 | |
| 100 | if (is_multisite()) { |
| 101 | $type = "multisite"; |
| 102 | } |
| 103 | |
| 104 | define('SG_SITE_TYPE', $type); |
| 105 | |
| 106 | if (!defined('SG_PING_FILE_PATH')) { |
| 107 | define('SG_PING_FILE_PATH', $uploadDir['basedir'] . '/backup-guard/ping.json'); |
| 108 | } |
| 109 | //Symlink download |
| 110 | define('SG_SYMLINK_PATH', $uploadDir['basedir'] . '/sg_symlinks/'); |
| 111 | define('SG_SYMLINK_URL', $uploadDir['baseurl'] . '/sg_symlinks/'); |
| 112 | |
| 113 | if (!defined('SG_APP_ROOT_DIRECTORY')) { |
| 114 | define('SG_APP_ROOT_DIRECTORY', realpath(dirname(WP_CONTENT_DIR) . "/")); //Wordpress Define |
| 115 | } |
| 116 | |
| 117 | $sgBackupFilePathsExclude = array( |
| 118 | $wpContent . '/' . $wpPlugins . '/backup/', |
| 119 | $wpContent . '/' . $wpPlugins . '/backup-guard-pro/', |
| 120 | $wpContent . '/' . $wpPlugins . '/backup-guard-silver/', |
| 121 | $wpContent . '/' . $wpPlugins . '/backup-guard-gold/', |
| 122 | $wpContent . '/' . $wpPlugins . '/backup-guard-platinum/', |
| 123 | $wpContent . '/' . $wpUploads . '/sg_symlinks/', |
| 124 | $wpContent . '/Dropbox_Backup/', |
| 125 | $wpContent . '/updraft/', |
| 126 | $wpContent . '/upsupsystic/', |
| 127 | $wpContent . '/wpbackitup_backups/', |
| 128 | $wpContent . '/wpbackitup_restore/', |
| 129 | $wpContent . '/backups/', |
| 130 | $wpContent . '/cache/', |
| 131 | $wpContent . '/et-cache/', |
| 132 | $wpContent . '/litespeed/', |
| 133 | $wpContent . '/w3tc-config/', |
| 134 | $wpContent . '/wflogs/', |
| 135 | $wpContent . '/wp-rocket-config/', |
| 136 | $wpContent . '/et-temp/', |
| 137 | $wpContent . '/' . $wpUploads . '/wp-clone/', |
| 138 | $wpContent . '/' . $wpUploads . '/wp-staging/', |
| 139 | $wpContent . '/' . $wpUploads . '/wp-migrate-db/', |
| 140 | $wpContent . '/' . $wpUploads . '/db-backup/', |
| 141 | $wpContent . '/' . $wpPlugins . '/wordpress-move/backup/', |
| 142 | $wpContent . '/as3b_backups/', |
| 143 | $wpContent . '/' . $wpUploads . '/backupbuddy_backups/', |
| 144 | $wpContent . '/backups-dup-pro/', |
| 145 | $wpContent . '/managewp/backups/', |
| 146 | $wpContent . '/' . $wpUploads . '/backupbuddy_temp/', |
| 147 | $wpContent . '/' . $wpUploads . '/pb_backupbuddy/', |
| 148 | $wpContent . '/' . $wpUploads . '/snapshots/', |
| 149 | $wpContent . '/debug.log', |
| 150 | $wpContent . '/backup-db/', |
| 151 | $wpContent . '/' . $wpUploads . '/prime-mover-export-files/', |
| 152 | $wpContent . '/' . $wpUploads . '/prime-mover-lock-files/', |
| 153 | $wpContent . '/' . $wpUploads . '/prime-mover-tmp-downloads/', |
| 154 | $wpContent . '/' . $wpUploads . '/wpo/', |
| 155 | $wpContent . '/webtoffee_migrations/', |
| 156 | $wpContent . '/WPvivid_Uploads/', |
| 157 | $wpContent . '/wpvivid_staging/' |
| 158 | ); |
| 159 | |
| 160 | define('SG_BACKUP_FILE_PATHS_EXCLUDE', implode(',', array_merge($findExcludesDirs, $sgBackupFilePathsExclude))); |
| 161 | if (!defined('SG_BACKUP_DIRECTORY')) { |
| 162 | define('SG_BACKUP_DIRECTORY', $uploadDir['basedir'] . '/backup-guard/'); //backups will be stored here |
| 163 | } |
| 164 | define('SG_BACKUP_DIRECTORY_URL', SG_UPLOAD_URL . '/backup-guard/'); |
| 165 | |
| 166 | //Storage |
| 167 | define('SG_STORAGE_UPLOAD_CRON', ''); |
| 168 | |
| 169 | define('SG_BACKUP_FILE_PATHS', $wpContent . ',' . $wpContent . '/' . $wpPlugins . ',' . $wpContent . '/' . $wpThemes . ',' . $wpContent . '/' . $wpUploads); |
| 170 | |
| 171 | if (!defined('SG_WP_OPTIONS_MIGRATABLE_VALUES')) { |
| 172 | define('SG_WP_OPTIONS_MIGRATABLE_VALUES', 'user_roles'); |
| 173 | } |
| 174 | if (!defined('SG_WP_USERMETA_MIGRATABLE_VALUES')) { |
| 175 | define('SG_WP_USERMETA_MIGRATABLE_VALUES', 'capabilities,user_level,dashboard_quick_press_last_post_id,user-settings,user-settings-time'); |
| 176 | } |
| 177 | if (!defined('SG_MISC_MIGRATABLE_TABLES')) { |
| 178 | define('SG_MISC_MIGRATABLE_TABLES', SG_ENV_DB_PREFIX . 'options,' . SG_ENV_DB_PREFIX . 'usermeta'); |
| 179 | } |
| 180 | if (!defined('SG_MULTISITE_TABLES_TO_MIGRATE')) { |
| 181 | define('SG_MULTISITE_TABLES_TO_MIGRATE', SG_ENV_DB_PREFIX . 'blogs,' . SG_ENV_DB_PREFIX . 'site'); |
| 182 | } |
| 183 | if (!defined('SG_SUBDOMAIN_INSTALL')) { |
| 184 | define('SG_SUBDOMAIN_INSTALL', defined('SUBDOMAIN_INSTALL') ? SUBDOMAIN_INSTALL : false); |
| 185 | } |
| 186 | |
| 187 | define('SG_BACKUP_PRODUCTS_URL', 'https://backup-guard.com/admin/products/view'); |
| 188 | |
| 189 | define('SG_BACKUP_GUARD_SECURITY_EXTENSION', 'backup-guard-security'); |
| 190 |