/** * Cleanup the backup file and tmp directory * after every test * */ public function tearDown() { // Remove all backup paths that exist foreach ($this->path->get_existing_paths() as $path) { hmbkp_rmdirtree($path); } }
/** * Cleanup the backup file and tmp directory * after every test * * @access public */ public function tearDown() { hmbkp_rmdirtree(hmbkp_path()); delete_option('hmbkp_path'); delete_option('hmbkp_default_path'); unset($this->backup); }
/** * Cleanup the backup file and tmp directory * after every test * */ public function tearDown() { hmbkp_rmdirtree(hmbkp_path()); chmod($this->backup->get_root() . '/test-data.txt', 0664); unset($this->backup); HM\BackUpWordPress\Path::get_instance()->reset_path(); }
/** * Cleanup the backup file and tmp directory * after every test * */ public function tearDown() { hmbkp_rmdirtree(hmbkp_path()); unset($this->backup); if (file_exists($this->symlink)) { unlink($this->symlink); } HM\BackUpWordPress\Path::get_instance()->reset_path(); }
/** * Cleanup the backup file and tmp directory * after every test * * @access public */ public function tearDown() { hmbkp_rmdirtree($this->backup->get_path()); hmbkp_rmdirtree(hmbkp_path()); delete_option('hmbkp_path'); delete_option('hmbkp_default_path'); chmod($this->backup->get_root() . '/test-data.txt', 0664); unset($this->backup); }
/** * Cleanup the backup file and tmp directory * after every test * */ public function tearDown() { if (!function_exists('symlink')) { return; } hmbkp_rmdirtree(hmbkp_path()); unset($this->backup); @unlink($this->symlink); HM\BackUpWordPress\Path::get_instance()->reset_path(); }
/** * Cleanup the backup file and tmp directory * after every test * * @access public */ public function tearDown() { hmbkp_rmdirtree($this->backup->get_path()); hmbkp_rmdirtree(hmbkp_path()); delete_option('hmbkp_path'); delete_option('hmbkp_default_path'); unset($this->backup); if (file_exists($this->hidden)) { unlink($this->hidden); } }
/** * Cleanup the backup file and tmp directory * after every test * * @access public */ public function tearDown() { if (file_exists($this->custom_path)) { chmod($this->custom_path, 0755); } hmbkp_rmdirtree($this->custom_path); hmbkp_rmdirtree(hmbkp_path()); hmbkp_rmdirtree(hmbkp_path_default()); delete_option('hmbkp_path'); delete_option('hmbkp_default_path'); unset($this->backup); }
/** * Cleanup the backup file and tmp directory * after every test * * @access public */ public function tearDown() { if (!function_exists('symlink')) { return; } hmbkp_rmdirtree($this->backup->get_path()); hmbkp_rmdirtree(hmbkp_path()); delete_option('hmbkp_path'); delete_option('hmbkp_default_path'); unset($this->backup); @unlink($this->symlink); }
public function tearDown() { // Restore the is_apache global in-case it was messed with in the test global $is_apache; if (isset($this->is_apache)) { $is_apache = $this->is_apache; } // Remove all backup paths that exist foreach ($this->path->get_existing_paths() as $path) { hmbkp_rmdirtree($path); } // Remove our custom path hmbkp_rmdirtree($this->custom_path); }
/** * Move backup files from an existing directory and the new * location * * @param string $path The path to move the backups from * @return void */ public function move_old_backups($from) { if (!is_readable($from)) { return; } if (!wp_is_writable($this->get_path())) { return; } // Move any existing backups if ($handle = opendir($from)) { // Loop through the backup directory while (false !== ($file = readdir($handle))) { // Find all zips if ('zip' === pathinfo($file, PATHINFO_EXTENSION)) { // Try to move them if (!@rename(trailingslashit($from) . $file, trailingslashit($this->get_path()) . $file)) { // If we can't move them then try to copy them copy(trailingslashit($from) . $file, trailingslashit($this->get_path()) . $file); } } } closedir($handle); } // Delete the old directory if it's inside WP_CONTENT_DIR if (false !== strpos($from, WP_CONTENT_DIR) && $from !== $this->get_path()) { hmbkp_rmdirtree($from); } }
/** * Cleanup the backup file and tmp directory * after every test * */ public function tearDown() { hmbkp_rmdirtree(hmbkp_path()); unset($this->backup); HM\BackUpWordPress\Path::get_instance()->reset_path(); }
/** * Remove any non backup.zip files from the backups dir. * * @return void */ function hmbkp_cleanup() { if (defined('HMBKP_PATH') && HMBKP_PATH) { return; } $hmbkp_path = hmbkp_path(); if (!is_dir($hmbkp_path)) { return; } if ($handle = opendir($hmbkp_path)) { while (false !== ($file = readdir($handle))) { if (!in_array($file, array('.', '..', 'index.html')) && pathinfo($file, PATHINFO_EXTENSION) !== 'zip') { hmbkp_rmdirtree(trailingslashit($hmbkp_path) . $file); } } closedir($handle); } }
<?php if (!defined('HMBKP_PLUGIN_PATH')) { define('HMBKP_PLUGIN_PATH', plugin_dir_path(__FILE__)); } // Load the schedules require_once HMBKP_PLUGIN_PATH . 'hm-backup/hm-backup.php'; require_once HMBKP_PLUGIN_PATH . 'classes/class-services.php'; require_once HMBKP_PLUGIN_PATH . 'classes/class-schedule.php'; require_once HMBKP_PLUGIN_PATH . 'classes/class-schedules.php'; require_once HMBKP_PLUGIN_PATH . 'functions/core.php'; $schedules = HMBKP_Schedules::get_instance(); // Cancel all the schedules and delete all the backups foreach ($schedules->get_schedules() as $schedule) { $schedule->cancel(true); } // Remove the backups directory hmbkp_rmdirtree(hmbkp_path()); // Remove all the options foreach (array('hmbkp_enable_support', 'hmbkp_plugin_version', 'hmbkp_path', 'hmbkp_default_path', 'hmbkp_upsell') as $option) { delete_option($option); }
/** * Cleanup the backup file and tmp directory * after every test */ public function tearDown() { hmbkp_rmdirtree(hmbkp_path()); @unlink($this->backup->get_root() . '/new.file'); HM\BackUpWordPress\Path::get_instance()->reset_path(); }