本文整理汇总了PHP中AIOWPSecurity_Utility_File::backup_file_contents_to_db方法的典型用法代码示例。如果您正苦于以下问题:PHP AIOWPSecurity_Utility_File::backup_file_contents_to_db方法的具体用法?PHP AIOWPSecurity_Utility_File::backup_file_contents_to_db怎么用?PHP AIOWPSecurity_Utility_File::backup_file_contents_to_db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AIOWPSecurity_Utility_File
的用法示例。
在下文中一共展示了AIOWPSecurity_Utility_File::backup_file_contents_to_db方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_deactivation_tasks
static function run_deactivation_tasks()
{
global $wpdb;
if (function_exists('is_multisite') && is_multisite()) {
// check if it is a network activation - if so, run the activation function for each blog id
if (isset($_GET['networkwide']) && $_GET['networkwide'] == 1) {
$old_blog = $wpdb->blogid;
// Get all blog ids
$blogids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
foreach ($blogids as $blog_id) {
switch_to_blog($blog_id);
}
switch_to_blog($old_blog);
return;
}
}
//Let's backup .htaccess contents when AIOWPS was active
$ht_file = ABSPATH . '.htaccess';
$key_desc_ht_backup = 'aiowps_htaccess_backup';
//This will be the key to decribe the entry we are inserting into the global_meta table
AIOWPSecurity_Utility_File::backup_file_contents_to_db($ht_file, $key_desc_ht_backup);
//Store the original htaccess contents in our global_meta table (ie, before AIOWPS was active)
//Let's backup wp_config.php contents
$wp_config_file = ABSPATH . 'wp-config.php';
$key_desc_wp_config_backup = 'aiowps_wp_config_php_backup';
//This will be the key to decribe the entry we are inserting into the global_meta table
AIOWPSecurity_Utility_File::backup_file_contents_to_db($wp_config_file, $key_desc_wp_config_backup);
//Store the original htaccess contents in our global_meta table (ie, before AIOWPS was active)
//Restore original contents of .htaccess file upon deactivation
$htaccess_file_contents = AIOWPSecurity_Deactivation::get_original_file_contents('original_htaccess_backup');
if ($htaccess_file_contents) {
if (file_put_contents($ht_file, $htaccess_file_contents) === false) {
//File write failed
$aio_wp_security->debug_logger->log_debug("AIOWPSecurity_Deactivation::run_deactivation_tasks() - Failed to write to .htaccess file", 4);
}
}
//Restore original contents of wp-config.php file upon deactivation
$wp_config_file_contents = AIOWPSecurity_Deactivation::get_original_file_contents('original_wp_config_php_backup');
if ($wp_config_file_contents) {
if (file_put_contents($wp_config_file, $wp_config_file_contents) === false) {
//File write failed
$aio_wp_security->debug_logger->log_debug("AIOWPSecurity_Deactivation::run_deactivation_tasks() - Failed to write to wp-config.php file", 4);
}
}
}