diff --git a/assets/images/backwpupbanner-free.png b/assets/images/backwpupbanner-free.png deleted file mode 100644 index 3d759cc9..00000000 Binary files a/assets/images/backwpupbanner-free.png and /dev/null differ diff --git a/assets/images/backwpupbanner-pro.png b/assets/images/backwpupbanner-pro.png deleted file mode 100644 index 90f7426a..00000000 Binary files a/assets/images/backwpupbanner-pro.png and /dev/null differ diff --git a/assets/images/backwpupbanner.png b/assets/images/backwpupbanner.png new file mode 100644 index 00000000..b80ca2a4 Binary files /dev/null and b/assets/images/backwpupbanner.png differ diff --git a/assets/images/banner-de.jpg b/assets/images/banner-de.jpg new file mode 100644 index 00000000..b1678848 Binary files /dev/null and b/assets/images/banner-de.jpg differ diff --git a/assets/images/banner-en.jpg b/assets/images/banner-en.jpg new file mode 100644 index 00000000..22dd4fb2 Binary files /dev/null and b/assets/images/banner-en.jpg differ diff --git a/assets/images/banner-survey-de.png b/assets/images/banner-survey-de.png new file mode 100644 index 00000000..6c9876e7 Binary files /dev/null and b/assets/images/banner-survey-de.png differ diff --git a/assets/images/banner-survey-en.png b/assets/images/banner-survey-en.png new file mode 100644 index 00000000..3f7d1b3b Binary files /dev/null and b/assets/images/banner-survey-en.png differ diff --git a/assets/images/erroreven.png b/assets/images/erroreven.png index 009d4893..daf865b3 100644 Binary files a/assets/images/erroreven.png and b/assets/images/erroreven.png differ diff --git a/assets/images/hgbtgreen.png b/assets/images/hgbtgreen.png index 7424533c..43b22eb6 100644 Binary files a/assets/images/hgbtgreen.png and b/assets/images/hgbtgreen.png differ diff --git a/assets/images/hgbtred.png b/assets/images/hgbtred.png index eedaef76..160826b8 100644 Binary files a/assets/images/hgbtred.png and b/assets/images/hgbtred.png differ diff --git a/assets/images/hgtopgreen.png b/assets/images/hgtopgreen.png index 7a19090c..de555a6e 100644 Binary files a/assets/images/hgtopgreen.png and b/assets/images/hgtopgreen.png differ diff --git a/assets/images/imagecloud.png b/assets/images/imagecloud.png index 0d6cb9d2..9ccd363f 100644 Binary files a/assets/images/imagecloud.png and b/assets/images/imagecloud.png differ diff --git a/assets/images/imagedata.png b/assets/images/imagedata.png index 2aff3485..d05c12a7 100644 Binary files a/assets/images/imagedata.png and b/assets/images/imagedata.png differ diff --git a/assets/images/imagerepair.png b/assets/images/imagerepair.png deleted file mode 100644 index 834af97f..00000000 Binary files a/assets/images/imagerepair.png and /dev/null differ diff --git a/assets/images/imagesave.png b/assets/images/imagesave.png index 27a57da1..7a6626a9 100644 Binary files a/assets/images/imagesave.png and b/assets/images/imagesave.png differ diff --git a/assets/images/imagesec.png b/assets/images/imagesec.png index de5ba40e..9ef6cd6f 100644 Binary files a/assets/images/imagesec.png and b/assets/images/imagesec.png differ diff --git a/assets/images/imagexml.png b/assets/images/imagexml.png index dbdb9bf4..113fcd60 100644 Binary files a/assets/images/imagexml.png and b/assets/images/imagexml.png differ diff --git a/assets/images/odd.png b/assets/images/odd.png index b21c225f..b277a89a 100644 Binary files a/assets/images/odd.png and b/assets/images/odd.png differ diff --git a/assets/images/tickeven.png b/assets/images/tickeven.png index 49137b7d..9e139a3e 100644 Binary files a/assets/images/tickeven.png and b/assets/images/tickeven.png differ diff --git a/backwpup.php b/backwpup.php index f96fac69..ad37bb83 100644 --- a/backwpup.php +++ b/backwpup.php @@ -5,7 +5,7 @@ * Description: WordPress Backup Plugin * Author: Inpsyde GmbH * Author URI: http://inpsyde.com - * Version: 3.3.1 + * Version: 3.3.2 * Text Domain: backwpup * Domain Path: /languages/ * Network: true @@ -33,7 +33,7 @@ if ( ! class_exists( 'BackWPup' ) ) { - // Don't activate on anything less than PHP 5.2.7 or WordPress 3.1 + // Don't activate on anything less than PHP 5.2.7 or WordPress 3.8 if ( version_compare( PHP_VERSION, '5.2.7', '<' ) || version_compare( get_bloginfo( 'version' ), '3.8', '<' ) || ! function_exists( 'spl_autoload_register' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; deactivate_plugins( __FILE__ ); @@ -70,13 +70,9 @@ private function __construct() { //auto loader spl_autoload_register( array( $this, 'autoloader' ) ); //start upgrade if needed - if ( get_site_option( 'backwpup_version' ) != self::get_plugin_data( 'Version' ) ) { + if ( get_site_option( 'backwpup_version' ) !== self::get_plugin_data( 'Version' ) || ! wp_next_scheduled( 'backwpup_check_cleanup' ) ) { BackWPup_Install::activate(); } - //load pro features - if ( class_exists( 'BackWPup_Pro' ) ) { - BackWPup_Pro::get_instance(); - } //WP-Cron if ( defined( 'DOING_CRON' ) && DOING_CRON ) { if ( ! empty( $_GET[ 'backwpup_run' ] ) && class_exists( 'BackWPup_Job' ) ) { @@ -95,7 +91,7 @@ private function __construct() { //deactivation hook register_deactivation_hook( __FILE__, array( 'BackWPup_Install', 'deactivate' ) ); //Admin bar - if ( get_site_option( 'backwpup_cfg_showadminbar', FALSE ) ) { + if ( get_site_option( 'backwpup_cfg_showadminbar' ) ) { add_action( 'init', array( 'BackWPup_Adminbar', 'get_instance' ) ); } //only in backend diff --git a/inc/class-admin.php b/inc/class-admin.php index b0f37462..0e2572a5 100644 --- a/inc/class-admin.php +++ b/inc/class-admin.php @@ -49,6 +49,26 @@ public function __construct() { add_action( 'profile_update', array( $this, 'save_profile_update' ) ); new BackWPup_EasyCron(); + + if ( ! class_exists( 'backwpup_pro' ) ) { + $lang = substr( get_locale(), 0 ,2 ); + if ( $lang !== 'de' ) { + $lang = 'en'; + } + $message_box = new BackWPup_Message_Box( 'campaign_2016_06' ); + $message_box->set_campaign_to_date( '2016-06-20' ); + $message_box->set_box_html( + '' + ); + $message_box->init_hooks(); + } + + $message_box = new BackWPup_Message_Box( 'restore_beta_survey' ); + $message_box->set_campaign_to_date( '2016-06-30' ); + $message_box->set_box_html( + '' . __( 'BackWPup Restore function is coming! Participate in our survey and with a little bit of luck you win a BackWPup Pro licence!', 'backwpup' ) . '' + ); + $message_box->init_hooks(); } /** @@ -63,7 +83,109 @@ public static function get_instance() { return self::$instance; } - private function __clone() {} + /** + * Admin init function + */ + public static function admin_css() { + + //register js and css for BackWPup + if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { + wp_enqueue_style( 'backwpup', BackWPup::get_plugin_data( 'URL' ) . '/assets/css/backwpup.css', array(), time(), 'screen' ); + } else { + wp_enqueue_style( 'backwpup', BackWPup::get_plugin_data( 'URL' ) . '/assets/css/backwpup.min.css', array(), BackWPup::get_plugin_data( 'Version' ), 'screen' ); + } + } + + /** + * Load for all BackWPup pages + */ + public static function init_general() { + + add_thickbox(); + + //register js and css for BackWPup + if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { + wp_register_script( 'backwpupgeneral', BackWPup::get_plugin_data( 'URL' ) . '/assets/js/general.js', array( 'jquery' ), time(), false ); + } else { + wp_register_script( 'backwpupgeneral', BackWPup::get_plugin_data( 'URL' ) . '/assets/js/general.min.js', array( 'jquery' ), BackWPup::get_plugin_data( 'Version' ), false ); + } + + //add Help + BackWPup_Help::help(); + } + + /** + * Add Message (across site loadings) + * + * @param $message string Message test + * @param $error bool ist it a error message + */ + public static function message( $message, $error = FALSE ) { + + if ( empty( $message ) ) { + return; + } + + $saved_message = self::get_messages(); + + if ( $error ) + $saved_message[ 'error' ][] = $message; + else + $saved_message[ 'updated' ][] = $message; + + update_site_option( 'backwpup_messages', $saved_message ); + } + + /** + * Get all Message that not displayed + * + * @return array + */ + public static function get_messages() { + + return get_site_option( 'backwpup_messages', array() ); + } + + /** + * Display Messages + * + * @param bool $echo + * @return string + */ + public static function display_messages( $echo = TRUE ) { + + $message_updated= ''; + $message_error = ''; + $saved_message = self::get_messages(); + $message_id = ' id="message"'; + + if( empty( $saved_message ) ) + return ''; + + if ( ! empty( $saved_message[ 'updated' ] ) ) { + foreach( $saved_message[ 'updated' ] as $msg ) + $message_updated .= '

' . $msg . '

'; + } + if ( ! empty( $saved_message[ 'error' ] ) ) { + foreach( $saved_message[ 'error' ] as $msg ) + $message_error .= '

' . $msg . '

'; + } + + update_site_option( 'backwpup_messages', array() ); + + if ( ! empty( $message_updated ) ) { + $message_updated = '' . $message_updated . ''; + $message_id = ''; + } + if ( ! empty( $message_error ) ) { + $message_error = '' . $message_error . ''; + } + + if ( $echo ) + echo $message_updated . $message_error; + + return $message_updated . $message_error; + } /** * Admin init function @@ -92,25 +214,6 @@ public function admin_init() { } } - //display about page after Update - if ( ! defined( 'DOING_AJAX' ) && ! get_site_option( 'backwpup_about_page', FALSE ) && ! isset( $_GET['activate-multi'] ) ) { - update_site_option( 'backwpup_about_page', TRUE ); - wp_redirect( network_admin_url( 'admin.php' ) . '?page=backwpupabout' ); - exit(); - } - } - - /** - * Admin init function - */ - public static function admin_css() { - - //register js and css for BackWPup - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { - wp_enqueue_style( 'backwpup', BackWPup::get_plugin_data( 'URL' ) . '/assets/css/backwpup.css', array(), time(), 'screen' ); - } else { - wp_enqueue_style( 'backwpup', BackWPup::get_plugin_data( 'URL' ) . '/assets/css/backwpup.min.css', array(), BackWPup::get_plugin_data( 'Version' ), 'screen' ); - } } /** @@ -146,7 +249,6 @@ public function admin_menu() { } - /** * @param $page_hooks * @return mixed @@ -234,26 +336,6 @@ public function admin_page_about( $page_hooks ) { return $page_hooks; } - - /** - * Load for all BackWPup pages - */ - public static function init_general() { - - add_thickbox(); - - //register js and css for BackWPup - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { - wp_register_script( 'backwpupgeneral', BackWPup::get_plugin_data( 'URL' ) . '/assets/js/general.js', array( 'jquery' ), time(), false ); - } else { - wp_register_script( 'backwpupgeneral', BackWPup::get_plugin_data( 'URL' ) . '/assets/js/general.min.js', array( 'jquery' ), BackWPup::get_plugin_data( 'Version' ), false ); - } - - //add Help - BackWPup_Help::help(); - } - - /** * Called on save form. Only POST allowed. */ @@ -298,79 +380,6 @@ public function save_post_form() { exit; } - /** - * Add Message (across site loadings) - * - * @param $message string Message test - * @param $error bool ist it a error message - */ - public static function message( $message, $error = FALSE ) { - - if ( empty( $message ) ) { - return; - } - - $saved_message = self::get_messages(); - - if ( $error ) - $saved_message[ 'error' ][] = $message; - else - $saved_message[ 'updated' ][] = $message; - - update_site_option( 'backwpup_messages', $saved_message ); - } - - /** - * Get all Message that not displayed - * - * @return array - */ - public static function get_messages() { - - return get_site_option( 'backwpup_messages', array() ); - } - - /** - * Display Messages - * - * @param bool $echo - * @return string - */ - public static function display_messages( $echo = TRUE ) { - - $message_updated= ''; - $message_error = ''; - $saved_message = self::get_messages(); - $message_id = ' id="message"'; - - if( empty( $saved_message ) ) - return ''; - - if ( ! empty( $saved_message[ 'updated' ] ) ) { - foreach( $saved_message[ 'updated' ] as $msg ) - $message_updated .= '

' . $msg . '

'; - } - if ( ! empty( $saved_message[ 'error' ] ) ) { - foreach( $saved_message[ 'error' ] as $msg ) - $message_error .= '

' . $msg . '

'; - } - - update_site_option( 'backwpup_messages', array() ); - - if ( ! empty( $message_updated ) ) { - $message_updated = '' . $message_updated . ''; - $message_id = ''; - } - if ( ! empty( $message_error ) ) { - $message_error = '' . $message_error . ''; - } - - if ( $echo ) - echo $message_updated . $message_error; - - return $message_updated . $message_error; - } - /** * Overrides WordPress text in Footer * @@ -412,7 +421,6 @@ public function update_footer( $update_footer_text ) { return $update_footer_text; } - /** * Add filed for selecting user role in user section * @@ -524,4 +532,6 @@ public function save_profile_update( $user_id ) { return; } + private function __clone() {} + } diff --git a/inc/class-adminbar.php b/inc/class-adminbar.php index 641f6751..d2e9e341 100644 --- a/inc/class-adminbar.php +++ b/inc/class-adminbar.php @@ -38,10 +38,6 @@ public static function get_instance() { return self::$instance; } - - private function __clone() {} - - /** * @global $wp_admin_bar WP_Admin_Bar */ @@ -49,7 +45,7 @@ public function adminbar() { global $wp_admin_bar; /* @var WP_Admin_Bar $wp_admin_bar */ - $menu_title = '' . BackWPup::get_plugin_data( 'name' ) . ''; + $menu_title = ''; $menu_herf = network_admin_url( 'admin.php?page=backwpup' ); if ( file_exists( BackWPup::get_plugin_data( 'running_file' ) ) && current_user_can( 'backwpup_jobs_start' ) ) { $menu_title = '' . esc_html( BackWPup::get_plugin_data( 'name' ) ) . ' ' . esc_html__( 'running', 'backwpup' ) . ''; @@ -135,4 +131,6 @@ public function adminbar() { } } } + + private function __clone() {} } diff --git a/inc/class-destination-s3.php b/inc/class-destination-s3.php index 16fd1178..e2c7b84e 100644 --- a/inc/class-destination-s3.php +++ b/inc/class-destination-s3.php @@ -49,7 +49,7 @@ protected function get_s3_base_url( $s3region, $s3base_url = '' ) { case 'google-storage-asia': return 'https://storage.googleapis.com'; case 'dreamhost': - return 'https://objects.dreamhost.com'; + return 'https://objects-us-west-1.dream.io'; case 'greenqloud': return 'http://s.greenqloud.com'; default: diff --git a/inc/class-install.php b/inc/class-install.php index 9e84d30d..14df599d 100644 --- a/inc/class-install.php +++ b/inc/class-install.php @@ -9,17 +9,15 @@ class BackWPup_Install { */ public static function activate() { - //convert inactive version to active - if ( $incative_version = get_site_option( 'backwpup_version' ) ) { - update_site_option( 'backwpup_version', str_replace( '-inactive', '', $incative_version ) ); - } + $version_db = get_site_option( 'backwpup_version' ); //changes for version before 3.0.0 - if ( ! get_site_option( 'backwpup_version' ) && get_option( 'backwpup' ) && get_option( 'backwpup_jobs' ) ) + if ( ! $version_db && get_option( 'backwpup' ) && get_option( 'backwpup_jobs' ) ) { self::upgrade_from_version_two(); + } //changes for version before 3.0.14 - if ( version_compare( '3.0.13', get_site_option( 'backwpup_version' ), '>' ) && version_compare( '3.0', get_site_option( 'backwpup_version' ), '<' ) ) { + if ( version_compare( '3.0.13', $version_db, '>' ) && version_compare( '3.0', $version_db, '<' ) ) { $upload_dir = wp_upload_dir( null, false, true ); $logfolder = get_site_option( 'backwpup_cfg_logfolder' ); if ( empty( $logfolder ) ) { @@ -62,9 +60,10 @@ public static function activate() { } } - //add check Cleanup schedule - wp_clear_scheduled_hook( 'backwpup_check_cleanup' ); - wp_schedule_event( time(), 'twicedaily', 'backwpup_check_cleanup' ); + //add Cleanup schedule + if ( ! wp_next_scheduled( 'backwpup_check_cleanup' ) ) { + wp_schedule_event( time(), 'twicedaily', 'backwpup_check_cleanup' ); + } //add capabilities to administrator role $role = get_role( 'administrator' ); @@ -129,57 +128,13 @@ public static function activate() { //update version update_site_option( 'backwpup_version', BackWPup::get_plugin_data( 'Version' ) ); - } - - /** - * - * Cleanup on Plugin deactivation - * - * @return void - */ - public static function deactivate() { - - wp_clear_scheduled_hook( 'backwpup_cron' ); - $activejobs = BackWPup_Option::get_job_ids( 'activetype', 'wpcron' ); - if ( ! empty( $activejobs ) ) { - foreach ( $activejobs as $id ) { - wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => $id ) ); - } - } - wp_clear_scheduled_hook( 'backwpup_check_cleanup' ); - - $activejobs = BackWPup_Option::get_job_ids( 'activetype', 'easycron' ); - if ( ! empty( $activejobs ) ) { - foreach ( $activejobs as $id ) { - BackWPup_EasyCron::delete( $id ); - } - } - - //remove roles - remove_role( 'backwpup_admin' ); - remove_role( 'backwpup_helper' ); - remove_role( 'backwpup_check' ); - //remove capabilities to administrator role - $role = get_role( 'administrator' ); - if ( is_object( $role ) && method_exists( $role, 'remove_cap' ) ) { - $role->remove_cap( 'backwpup' ); - $role->remove_cap( 'backwpup_jobs' ); - $role->remove_cap( 'backwpup_jobs_edit' ); - $role->remove_cap( 'backwpup_jobs_start' ); - $role->remove_cap( 'backwpup_backups' ); - $role->remove_cap( 'backwpup_backups_download' ); - $role->remove_cap( 'backwpup_backups_delete' ); - $role->remove_cap( 'backwpup_logs' ); - $role->remove_cap( 'backwpup_logs_delete' ); - $role->remove_cap( 'backwpup_settings' ); + if ( ! $version_db ) { + wp_redirect( network_admin_url( 'admin.php' ) . '?page=backwpupabout' ); + die(); } - - //to reschedule on activation and so on - update_site_option( 'backwpup_version', get_site_option( 'backwpup_version' ) .'-inactive' ); } - private static function upgrade_from_version_two() { //load options @@ -345,4 +300,50 @@ private static function upgrade_from_version_two() { } } + + /** + * + * Cleanup on Plugin deactivation + * + * @return void + */ + public static function deactivate() { + + wp_clear_scheduled_hook( 'backwpup_cron' ); + $activejobs = BackWPup_Option::get_job_ids( 'activetype', 'wpcron' ); + if ( ! empty( $activejobs ) ) { + foreach ( $activejobs as $id ) { + wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => $id ) ); + } + } + wp_clear_scheduled_hook( 'backwpup_check_cleanup' ); + + $activejobs = BackWPup_Option::get_job_ids( 'activetype', 'easycron' ); + if ( ! empty( $activejobs ) ) { + foreach ( $activejobs as $id ) { + BackWPup_EasyCron::delete( $id ); + } + } + + //remove roles + remove_role( 'backwpup_admin' ); + remove_role( 'backwpup_helper' ); + remove_role( 'backwpup_check' ); + + //remove capabilities to administrator role + $role = get_role( 'administrator' ); + if ( is_object( $role ) && method_exists( $role, 'remove_cap' ) ) { + $role->remove_cap( 'backwpup' ); + $role->remove_cap( 'backwpup_jobs' ); + $role->remove_cap( 'backwpup_jobs_edit' ); + $role->remove_cap( 'backwpup_jobs_start' ); + $role->remove_cap( 'backwpup_backups' ); + $role->remove_cap( 'backwpup_backups_download' ); + $role->remove_cap( 'backwpup_backups_delete' ); + $role->remove_cap( 'backwpup_logs' ); + $role->remove_cap( 'backwpup_logs_delete' ); + $role->remove_cap( 'backwpup_settings' ); + } + + } } diff --git a/inc/class-job.php b/inc/class-job.php index ce396350..86bc00a9 100644 --- a/inc/class-job.php +++ b/inc/class-job.php @@ -309,9 +309,7 @@ private function create( $start_type, $job_id = 0 ) { $head .= '' . PHP_EOL; $head .= '' . PHP_EOL; $info .= sprintf( _x( '[INFO] %1$s %2$s; A project of Inpsyde GmbH', 'Plugin name; Plugin Version; plugin url', 'backwpup' ), BackWPup::get_plugin_data( 'name' ), BackWPup::get_plugin_data( 'Version' ), __( 'http://backwpup.com', 'backwpup' ) ) . '
' . PHP_EOL; - if ( $this->is_debug() ) { - $info .= sprintf( _x( '[INFO] WordPress %1$s on %2$s', 'WordPress Version; Blog url', 'backwpup' ), BackWPup::get_plugin_data( 'wp_version' ), esc_attr( site_url( '/' ) ) ) . '
' . PHP_EOL; - } + $info .= sprintf( _x( '[INFO] WordPress %1$s on %2$s', 'WordPress Version; Blog url', 'backwpup' ), BackWPup::get_plugin_data( 'wp_version' ), esc_attr( site_url( '/' ) ) ) . '
' . PHP_EOL; $level = __( 'Normal', 'backwpup' ); $translated = ''; if ( $this->is_debug() ) { @@ -587,6 +585,9 @@ public static function start_http( $starttype, $jobid = 0 ) { $log_level = get_site_option( 'backwpup_cfg_loglevel', 'normal_translated' ); if ( strstr( $log_level, 'translated' ) ) { BackWPup::load_text_domain(); + } else { + add_filter( 'override_load_textdomain', '__return_true' ); + $GLOBALS['l10n'] = array(); } if ( $starttype !== 'restart' ) { @@ -657,6 +658,9 @@ public static function start_cli( $jobid ) { $log_level = get_site_option( 'backwpup_cfg_loglevel', 'normal_translated' ); if ( strstr( $log_level, 'translated' ) ) { BackWPup::load_text_domain(); + } else { + add_filter( 'override_load_textdomain', '__return_true' ); + $GLOBALS['l10n'] = array(); } $jobid = absint( $jobid ); @@ -758,8 +762,6 @@ public function run() { @ini_set( 'report_memleaks', '1' ); @ini_set( 'zlib.output_compression', '0' ); @ini_set( 'implicit_flush', '0' ); - //increase MySQL timeout - @ini_set( 'mysql.connect_timeout', '360' ); //set temp folder $can_set_temp_env = true; $protected_env_vars = explode( ',', ini_get( 'safe_mode_protected_env_vars' ) ); //removed in php 5.4.0 @@ -785,11 +787,6 @@ public function run() { } } set_exception_handler( array( $this, 'exception_handler' ) ); - //not loading Textdomains and unload loaded - if ( ! strstr( $this->log_level, 'translated' ) ) { - add_filter( 'override_load_textdomain', create_function( '', 'return TRUE;' ) ); - $GLOBALS['l10n'] = array(); - } // execute function on job shutdown register_shutdown_function( array( $this, 'shutdown' ) ); add_action( 'shutdown', array( $this, 'shutdown' ) ); @@ -825,7 +822,7 @@ public function run() { //'SIGWINCH', //Ign //'SIGIO', //Term 'SIGPWR', //Term - 'SIGSYS', //Core + 'SIGSYS' //Core ); $signals = apply_filters( 'backwpup_job_signals_to_handel', $signals ); declare( ticks = 1 ); @@ -913,7 +910,7 @@ public function do_restart( $must = false ) { } //no restart if in end step - if ( $this->step_working == 'END' || ( count( $this->steps_done ) + 1 ) >= count( $this->steps_todo ) ) { + if ( $this->step_working === 'END' || ( count( $this->steps_done ) + 1 ) >= count( $this->steps_todo ) ) { return; } @@ -970,7 +967,7 @@ public function do_restart( $must = false ) { */ public function do_restart_time( $do_restart_now = false ) { - //do restart after signel is send + //do restart after signal is send if ( $this->signal !== 0 ) { $this->steps_data[ $this->step_working ]['SAVE_STEP_TRY'] = $this->steps_data[ $this->step_working ]['STEP_TRY']; $this->steps_data[ $this->step_working ]['STEP_TRY'] -= 1; @@ -1111,84 +1108,78 @@ public function signal_handler( $signal_send ) { $signals = array( 'SIGHUP' => array( 'description' => _x( 'Hangup detected on controlling terminal or death of controlling process', 'SIGHUP: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGINT' => array( 'description' => _x( 'Interrupt from keyboard', 'SIGINT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGQUIT' => array( 'description' => _x( 'Quit from keyboard', 'SIGQUIT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGILL' => array( 'description' => _x( 'Illegal Instruction', 'SIGILL: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGABRT' => array( 'description' => _x( 'Abort signal from abort(3)', 'SIGABRT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => false + 'error' => E_USER_NOTICE ), 'SIGBUS' => array( 'description' => _x( 'Bus error (bad memory access)', 'SIGBUS: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGFPE' => array( 'description' => _x( 'Floating point exception', 'SIGFPE: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGSEGV' => array( 'description' => _x( 'Invalid memory reference', 'SIGSEGV: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGTERM' => array( 'description' => _x( 'Termination signal', 'SIGTERM: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => false + 'error' => E_USER_WARNING ), 'SIGSTKFLT' => array( 'description' => _x( 'Stack fault on coprocessor', 'SIGSTKFLT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGUSR1' => array( 'description' => _x( 'User-defined signal 1', 'SIGUSR1: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => false + 'error' => E_USER_NOTICE ), 'SIGUSR2' => array( 'description' => _x( 'User-defined signal 2', 'SIGUSR2: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => false + 'error' => E_USER_NOTICE ), 'SIGURG' => array( 'description' => _x( 'Urgent condition on socket', 'SIGURG: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => false + 'error' => E_USER_NOTICE ), 'SIGXCPU' => array( 'description' => _x( 'CPU time limit exceeded', 'SIGXCPU: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGXFSZ' => array( 'description' => _x( 'File size limit exceeded', 'SIGXFSZ: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), 'SIGPWR' => array( 'description' => _x( 'Power failure', 'SIGPWR: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => false + 'error' => E_USER_ERROR ), 'SIGSYS' => array( 'description' => _x( 'Bad argument to routine', 'SIGSYS: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' ), - 'error' => true + 'error' => E_USER_ERROR ), ); foreach ( $signals as $signal => $config ) { if ( defined( $signal ) && $signal_send === constant( $signal ) ) { - if ( $config['error'] || php_sapi_name() == 'cli' ) { - $this->log( sprintf( __( 'Signal "%1$s" (%2$s) is sent to script!', 'backwpup' ), $signal, $config['description'] ), E_USER_ERROR ); - $this->signal = $signal_send; - $this->do_restart( true ); - } else { - $this->log( sprintf( __( 'Signal "%1$s" (%2$s) is sent to script!', 'backwpup' ), $signal, $config['description'] ) ); - $this->signal = $signal_send; - } + $this->log( sprintf( __( 'Signal "%1$s" (%2$s) is sent to script!', 'backwpup' ), $signal, $config['description'] ), $config['error'] ); + $this->signal = $signal_send; break; } } @@ -1377,11 +1368,11 @@ public function log( $message, $type = E_USER_NOTICE, $file = '', $line = 0 ) { //set last Message if ( $error ) { - $output_message = '' . esc_html( $message ) . ''; + $output_message = '' . esc_html( $message ) . ''; $this->lasterrormsg = $output_message; } elseif ( $warning ) { - $output_message = '' . esc_html( $message ) . ''; + $output_message = '' . esc_html( $message ) . ''; $this->lasterrormsg = $output_message; } else { @@ -1459,12 +1450,6 @@ public function update_working_data( $must = false ) { //set execution time again for 5 min @set_time_limit( 300 ); - //check MySQL connection to WordPress Database and reconnect if needed - $res = $wpdb->query( 'SELECT ' . time() ); - if ( $res === false ) { - $wpdb->db_connect(); - } - //calc sub step percent if ( $this->substeps_todo > 0 && $this->substeps_done > 0 ) { $this->substep_percent = round( $this->substeps_done / $this->substeps_todo * 100 ); @@ -1481,6 +1466,10 @@ public function update_working_data( $must = false ) { $this->timestamp_last_update = microtime( true ); //last update of working file $this->write_running_file(); } + + if ( $this->signal !== 0 ) { + $this->do_restart(); + } } private function write_running_file() { diff --git a/inc/class-message-box.php b/inc/class-message-box.php new file mode 100644 index 00000000..e469494d --- /dev/null +++ b/inc/class-message-box.php @@ -0,0 +1,136 @@ +set_box_html( + * 'test' + * ); + * $message_box->init_hooks(); + */ +class BackWPup_Message_Box { + + /** + * ID of this message box + * @var string + */ + private $box_id = ''; + + /** + * HTML of this message box + * @var string + */ + private $box_html = ''; + + /** + * @var string Date to a campaign should be displayed + */ + private $campaign_to_date = '0000-00-00'; + + /** + * BackWPup_Message_Box constructor. + * + * @param string $box_id Name for box to have more than one or future one + */ + public function __construct( $box_id ) { + + if ( ! $box_id || ! is_string( $box_id ) ) { + return null; + } + + $this->box_id = sanitize_title_with_dashes( $box_id ); + } + + /** + * Init hooks to displaying message box + */ + public function init_hooks() { + + if ( ! current_user_can( 'backwpup' ) ) { + return; + } + + $boxes_display = get_user_meta( get_current_user_id(), 'backwpup_message_boxes_not_display', true ); + if ( ! $boxes_display ) { + $boxes_display = array(); + } + + if ( ! empty( $boxes_display[ $this->box_id ] ) ) { + return; + } + + if ( isset( $_GET['page'] ) && $_GET['page'] === 'backwpupabout' ) { + return; + } + + + if ( $this->campaign_to_date !== '0000-00-00' ) { + $this_day = date( 'Y-m-d' ); + if ( $this_day > $this->campaign_to_date ) { + return; + } + } + + add_action( 'admin_notices', array( $this, 'output_box_html' ) ); + add_action( 'admin_init', array( $this, 'save_not_display' ) ); + } + + /** + * Output the message box + */ + public function output_box_html() { + + $url = add_query_arg( array( 'backwpup_msg_' . $this->box_id => 1 ), '//' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ); + + ?> +
+ box_html; ?> + +
+ box_html = $html; + } + + /** + * Save user meta for boxes that should not be displayed + */ + public function save_not_display() { + + if ( ! empty( $_GET[ 'backwpup_msg_' . $this->box_id ] ) ) { + $boxes_display = get_user_meta( get_current_user_id(), 'backwpup_message_boxes_not_display', true ); + if ( ! $boxes_display ) { + $boxes_display = array(); + } + $boxes_display[ $this->box_id ] = true; + update_user_meta( get_current_user_id(), 'backwpup_message_boxes_not_display', $boxes_display ); + remove_action( 'admin_notices', array( $this, 'output_box_html' ) ); + } + } + + /** + * Date to a campaign should be displayed + * + * @since 3.3.2 + * + * @param string $campaign_to_date + */ + public function set_campaign_to_date( $campaign_to_date = '0000-00-00' ) { + + $this->campaign_to_date = $campaign_to_date; + } +} diff --git a/inc/class-option.php b/inc/class-option.php index f0345a11..e7774493 100644 --- a/inc/class-option.php +++ b/inc/class-option.php @@ -17,9 +17,9 @@ public static function default_site_options() { //job default add_site_option( 'backwpup_jobs', array() ); //general - add_site_option( 'backwpup_cfg_showadminbar', 1 ); - add_site_option( 'backwpup_cfg_showfoldersize', 0 ); - add_site_option( 'backwpup_cfg_protectfolders', 1 ); + add_site_option( 'backwpup_cfg_showadminbar', false ); + add_site_option( 'backwpup_cfg_showfoldersize', false ); + add_site_option( 'backwpup_cfg_protectfolders', true ); //job add_site_option( 'backwpup_cfg_jobmaxexecutiontime', 30 ); add_site_option( 'backwpup_cfg_jobstepretry', 3 ); @@ -41,6 +41,31 @@ public static function default_site_options() { } + /** + * + * Update a BackWPup option + * + * @param int $jobid the job id + * @param string $option Option key + * @param mixed $value the value to store + * + * @return bool if option save or not + */ + public static function update( $jobid, $option, $value ) { + + $jobid = (int) $jobid; + $option = sanitize_key( trim( $option ) ); + + if ( empty( $jobid ) || empty( $option ) ) { + return false; + } + + //Update option + $jobs_options = self::jobs_options( false ); + $jobs_options[ $jobid ][ $option ] = $value; + + return self::update_jobs_options( $jobs_options ); + } /** * @@ -85,6 +110,35 @@ private static function update_jobs_options( $options ) { return update_site_option( 'backwpup_jobs', $options ); } + /** + * + * Get a BackWPup Option + * + * @param int $jobid Option the job id + * @param string $option Option key + * @param mixed $default returned if no value, if null the the default BackWPup option will get + * @param bool $use_cache USe the cache + * + * @return bool|mixed false if nothing can get else the option value + */ + public static function get( $jobid, $option, $default = null, $use_cache = true ) { + + $jobid = (int) $jobid; + $option = sanitize_key( trim( $option ) ); + + if ( empty( $jobid ) || empty( $option ) ) { + return false; + } + + $jobs_options = self::jobs_options( $use_cache ); + if ( ! isset( $jobs_options[ $jobid ][ $option ] ) && isset( $default ) ) { + return $default; + } elseif ( ! isset( $jobs_options[ $jobid ][ $option ] ) ) { + return self::defaults_job( $option ); + } else { + return $jobs_options[ $jobid ][ $option ]; + } + } /** * @@ -139,63 +193,6 @@ public static function defaults_job( $key = '' ) { } } - /** - * - * Update a BackWPup option - * - * @param int $jobid the job id - * @param string $option Option key - * @param mixed $value the value to store - * - * @return bool if option save or not - */ - public static function update( $jobid, $option, $value ) { - - $jobid = (int) $jobid; - $option = sanitize_key( trim( $option ) ); - - if ( empty( $jobid ) || empty( $option ) ) { - return false; - } - - //Update option - $jobs_options = self::jobs_options( false ); - $jobs_options[ $jobid ][ $option ] = $value; - - return self::update_jobs_options( $jobs_options ); - } - - - /** - * - * Get a BackWPup Option - * - * @param int $jobid Option the job id - * @param string $option Option key - * @param mixed $default returned if no value, if null the the default BackWPup option will get - * @param bool $use_cache USe the cache - * - * @return bool|mixed false if nothing can get else the option value - */ - public static function get( $jobid, $option, $default = null, $use_cache = true ) { - - $jobid = (int) $jobid; - $option = sanitize_key( trim( $option ) ); - - if ( empty( $jobid ) || empty( $option ) ) { - return false; - } - - $jobs_options = self::jobs_options( $use_cache ); - if ( ! isset( $jobs_options[ $jobid ][ $option ] ) && isset( $default ) ) { - return $default; - } elseif ( ! isset( $jobs_options[ $jobid ][ $option ] ) ) { - return self::defaults_job( $option ); - } else { - return $jobs_options[ $jobid ][ $option ]; - } - } - /** * * BackWPup Job Options diff --git a/inc/class-page-about.php b/inc/class-page-about.php index 3e21d300..29f78692 100644 --- a/inc/class-page-about.php +++ b/inc/class-page-about.php @@ -352,6 +352,11 @@ public static function admin_print_scripts() { */ public static function page() { + $lang = substr( get_locale(), 0 ,2 ); + if ( $lang !== 'de' ) { + $lang = 'en'; + } + ?>
@@ -360,24 +365,32 @@ public static function page() {
- +

/wp-content/. Push them to an external storage service if you don’t want to save the backups on the same server. With a single backup archive you are able to restore an installation. Use a tool like phpMyAdmin or a plugin like Adminer to restore your database backup files.', 'backwpup' ); ?>

set up a backup job? You can use the wizards or plan your backup in expert mode.', 'backwpup' ), network_admin_url( 'admin.php').'?page=backwpupeditjob' , network_admin_url( 'admin.php').'?page=backwpupwizard' ) ); ?>

+ date( 'Y-m-d' ) ) { ?> + +
- +

/wp-content/. Push them to an external storage service if you don’t want to save the backups on the same server. With a single backup archive you are able to restore an installation. Use a tool like phpMyAdmin or a plugin like Adminer to restore your database backup files.', 'backwpup' ); ?>

+ date( 'Y-m-d' ) ) { ?> + +
+
+
- (Amazon, Google Storage, Hosteurope and more)', 'backwpup' ); ?> + @@ -620,7 +633,7 @@ public static function page() { - Automatic update from MarketPress', 'backwpup' ); ?> + Automatic updates', 'backwpup' ); ?> diff --git a/inc/class-page-backwpup.php b/inc/class-page-backwpup.php index 5a920ae3..b8d896eb 100644 --- a/inc/class-page-backwpup.php +++ b/inc/class-page-backwpup.php @@ -124,7 +124,7 @@ public static function page() {
' . sprintf( __('RSS Error: %s', 'backwpup' ), $rss->get_error_message() ) . '

'; @@ -268,6 +268,71 @@ public static function page() { + + + + + + + + + job[ 'jobid' ] ) && ! in_array($job_object->job[ 'jobid' ], $mainsactive, true ) ) + $mainsactive[ ] = $job_object->job[ 'jobid' ]; + foreach ( $mainsactive as $jobid ) { + $name = BackWPup_Option::get( $jobid, 'name' ); + if ( ! empty( $job_object ) && $job_object->job[ 'jobid' ] == $jobid ) { + $runtime = current_time( 'timestamp' ) - $job_object->job[ 'lastrun' ]; + if ( ! $alternate ) { + echo ''; + $alternate = TRUE; + } else { + echo ''; + $alternate = FALSE; + } + echo ''; + echo '"; + } + else { + if ( ! $alternate ) { + echo ''; + $alternate = TRUE; + } else { + echo ''; + $alternate = FALSE; + } + if ( $nextrun = wp_next_scheduled( 'backwpup_cron', array( 'id' => $jobid ) ) + ( get_option( 'gmt_offset' ) * 3600 ) ) + echo ''; + else + echo ''; + + echo ''; + } + } + if ( empty( $mainsactive ) and ! empty( $job_object ) ) { + echo ''; + } + ?> +
' . sprintf( '' . esc_html__( 'working since %d seconds', 'backwpup' ) . '', $runtime ) . '' . esc_html ( $job_object->job[ 'name' ] ) . '
'; + echo "" . esc_html__( 'Abort', 'backwpup' ) . ""; + echo "
' . sprintf( __( '%1$s at %2$s', 'backwpup' ), date_i18n( get_option( 'date_format' ), $nextrun, TRUE ), date_i18n( get_option( 'time_format' ), $nextrun, TRUE ) ) . '' . esc_html__( 'Not scheduled!', 'backwpup' ) . '' . esc_html($name) . '
' . esc_html__( 'none', 'backwpup' ) . '
+ - - - - - - - - - job[ 'jobid' ] ) && ! in_array($job_object->job[ 'jobid' ], $mainsactive, true ) ) - $mainsactive[ ] = $job_object->job[ 'jobid' ]; - foreach ( $mainsactive as $jobid ) { - $name = BackWPup_Option::get( $jobid, 'name' ); - if ( ! empty( $job_object ) && $job_object->job[ 'jobid' ] == $jobid ) { - $runtime = current_time( 'timestamp' ) - $job_object->job[ 'lastrun' ]; - if ( ! $alternate ) { - echo ''; - $alternate = TRUE; - } else { - echo ''; - $alternate = FALSE; - } - echo ''; - echo '"; - } - else { - if ( ! $alternate ) { - echo ''; - $alternate = TRUE; - } else { - echo ''; - $alternate = FALSE; - } - if ( $nextrun = wp_next_scheduled( 'backwpup_cron', array( 'id' => $jobid ) ) + ( get_option( 'gmt_offset' ) * 3600 ) ) - echo ''; - else - echo ''; - - echo ''; - } - } - if ( empty( $mainsactive ) and ! empty( $job_object ) ) { - echo ''; - } - ?> -
' . sprintf( '' . esc_html__( 'working since %d seconds', 'backwpup' ) . '', $runtime ) . '' . esc_html ( $job_object->job[ 'name' ] ) . '
'; - echo "" . esc_html__( 'Abort', 'backwpup' ) . ""; - echo "
' . sprintf( __( '%1$s at %2$s', 'backwpup' ), date_i18n( get_option( 'date_format' ), $nextrun, TRUE ), date_i18n( get_option( 'time_format' ), $nextrun, TRUE ) ) . '' . esc_html__( 'Not scheduled!', 'backwpup' ) . '' . esc_html($name) . '
' . esc_html__( 'none', 'backwpup' ) . '
- $_POST[ 'jobstepretry' ] ) { $_POST[ 'jobstepretry' ] = 3; @@ -138,8 +138,8 @@ public static function page() {
-
diff --git a/readme.txt b/readme.txt index 1a4e8aca..e946bafd 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: inpsyde, danielhuesken, Bueltge, nullbyte Tags: Amazon, Amazon S3, back up, backup, chinese, cloud, cloud files, database, db backup, dropbox, dump, file, french, ftp, ftps, german, migrate, multisite, russian, schedule, sftp, storage, S3, time, upload, xml Requires at least: 3.8 Tested up to: 4.5.1 -Stable tag: 3.3.1 +Stable tag: 3.3.2 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -13,6 +13,7 @@ Schedule complete automatic backups of your WordPress installation. Decide which The **backup plugin** **[BackWPup](http://backwpup.com/)** can be used to save your complete installation including /wp-content/ and push them to an external Backup Service, like **Dropbox**, **S3**, **FTP** and many more, see list below. With a single backup .zip file you are able to easily restore an installation. Please understand: this free version will not be supported as good as the [BackWPup Pro version](http://backwpup.com). With our premium version you get first class support and more features. + * Database Backup *(needs mysqli)* * WordPress XML Export * Generate a file with installed plugins @@ -150,23 +151,22 @@ Yes. You need to have writing access to the wp-config.php file (usually residing 5. Dashboard == Upgrade Notice == -= After an upgrade from version 2 = - -Please check all settings after the update: - -* Dropbox authentication must be done again -* SugarSync authentication must be done again -* S3 Settings -* Google Storage is now in S3 -* Check all your passwords == Installation == -1. Download the BackWPup plugin. -2. Decompress the ZIP file and upload the contents of the archive into `/wp-content/plugins/`. -3. Activate the plugin through the 'Plugins' menu in WordPress +[You can find a detailed tutorial in the BackWPup documentation.](http://docs.backwpup.com/article/118-install-backwpup) == Changelog == += Version 3.3.2 = +* Notice: For MSAzure requires PHP 5.5 in next BackWPup Version +* Changed: Colors of Warning and Error messages +* Changed: Display Blog url in log again +* Changed: Dreamhost url in S3 destination +* Changed: Adminbar menu disabled by default +* Removed: Adminbar plugin name for smaller size +* Improved: Signal handling more again +* Fixed: English log with WP 4.6 + = Version 3.3.1 = * Fixed: Security exploit in getting working data * Fixed: Bug in log mail sending @@ -176,7 +176,7 @@ Please check all settings after the update: * Changed: URLs to MarketPress and Documentation * Changed: Save file list cache for one year * Changed: Use WordPress ca-bundle.crt -* Removed: Server callback check on job start no it is only in Settings > Tab: Information +* Removed: Server callback check on job start now it is only in Settings > Tab: Information = Version 3.3 = * Improved: Texts removed or rewritten