You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.1 KiB
81 lines
2.1 KiB
<?php
|
|
|
|
if ( ! file_exists( 'wp-content/mysql.sql' ) ) {
|
|
echo 'wp-content/mysql.sql file not found';
|
|
|
|
return;
|
|
}
|
|
|
|
// Create backup of the current database.
|
|
echo shell_exec( 'wp db export ./wp-content/mysql-backup.sql' );
|
|
|
|
$staging_domain = shell_exec( 'wp option get siteurl' );
|
|
echo shell_exec( 'wp db import ./wp-content/mysql.sql' );
|
|
|
|
$domain = shell_exec( 'wp option get siteurl' );
|
|
$search_replace = trim( $domain ) . ' ' . trim( $staging_domain );
|
|
|
|
// Replace the domain in the database.
|
|
echo "-------------------------------- \n";
|
|
echo "Performing search and replace: \n";
|
|
echo "wp search-replace $search_replace --all-tables \n";
|
|
echo "-------------------------------- \n";
|
|
|
|
try {
|
|
echo shell_exec( "wp search-replace $search_replace --all-tables" );
|
|
} catch ( Exception $e ) {
|
|
echo "Error: " . $e->getMessage() . " \n";
|
|
exit( 1 );
|
|
}
|
|
|
|
rmdir( './wp-content/plugins/post-smtp' );
|
|
rmdir( './wp-content/plugins/wordfence' );
|
|
rmdir( './wp-content/plugins/wp-imgix*' );
|
|
|
|
$plugins = [
|
|
'wp-2fa',
|
|
'post-smtp',
|
|
'wordfence',
|
|
'wp-mail-smtp',
|
|
'wp-rocket',
|
|
'webp-express',
|
|
'wps-hide-login',
|
|
'two-factor',
|
|
'google-pagespeed-insights',
|
|
'google-captcha',
|
|
'akamai',
|
|
'akismet',
|
|
'disable-comments-rb',
|
|
'mainwp-child',
|
|
'mainwp-child-reports',
|
|
'wp-security-audit-log',
|
|
'activity-log-wp-seo',
|
|
'email-log',
|
|
'cloudflare',
|
|
'wp-test-email',
|
|
'two-factor-email-force',
|
|
'security-headers-axeweb',
|
|
'user-role-editor',
|
|
'user-switching',
|
|
'uipress',
|
|
'autoupdater',
|
|
'all-in-one-wp-migration',
|
|
'wp-file-manager',
|
|
'updraftplus',
|
|
'wp-smushit',
|
|
'akismet',
|
|
'leadin',
|
|
'clickcease-click-fraud-protection',
|
|
'gtm-server-side',
|
|
'contact-form-cfdb-7',
|
|
'contact-form-7-honeypot',
|
|
'neverbounce-hubspot',
|
|
'hotjar',
|
|
'insert-headers-and-footers',
|
|
'better-wp-security',
|
|
];
|
|
|
|
foreach ( $plugins as $plugin ) {
|
|
echo shell_exec( "wp plugin deactivate $plugin" );
|
|
}
|
|
|
|
|