/** * Panel showing form to restore previous Snapshot. * * @since 1.0.2 * @uses metaboxes setup in $this->admin_menu_proc() * @uses $_REQUEST['item'] * @uses $this->config_data['items'] * * @param none * * @return none */ function snapshot_admin_show_restore_panel($item) { // require( WPMUDEVSnapshot::instance()->get_setting( 'SNAPSHOT_PLUGIN_BASE_DIR' ) . '/lib/snapshot_admin_metaboxes.php' ); $this->_snapshot_metaboxes = new Snapshot_View_Metabox_Admin(); if (isset($_GET['snapshot-data-item']) && isset($item['data'][intval($_GET['snapshot-data-item'])])) { $data_item_key = intval($_GET['snapshot-data-item']); ?> <div id="snapshot-settings-metaboxes-general" class="wrap snapshot-wrap"> <h2><?php _ex("Restore Snapshot", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN); ?> </h2> <p class="snapshot-restore-description"><?php _ex("On this page you can restore a previous snapshot. Using the 'Restore Options' section below you can also opt to turn off all plugins as well as switch to a different theme as part of the restore.", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN); ?> </p> <div id='snapshot-ajax-warning' class='updated fade'> <p><?php _e('You are about to restore a previous version of your WordPress database. This will remove any new information added since the snapshot backup.', SNAPSHOT_I18N_DOMAIN); ?> </p> </div> <?php if (!Snapshot_Helper_Utility::check_server_timeout()) { $current_timeout = ini_get('max_execution_time'); ?> <div class='error snapshot-error'> <p><?php printf(__('Your web server timeout is set very low, %d seconds. Also, it appears this timeout cannot be adjusted via the Snapshot restore process. Attempting a snapshot restore could result in a partial restore of your tables.', SNAPSHOT_I18N_DOMAIN), $current_timeout); ?> </p> </div><?php } ?> <?php Snapshot_Helper_UI::form_ajax_panels(); ?> <?php if (isset($_GET['snapshot-data-item'])) { $data_item = $item['data'][$_GET['snapshot-data-item']]; } $backupFolder = WPMUDEVSnapshot::instance()->snapshot_get_item_destination_path($item, $data_item); if (empty($backupFolder)) { $backupFolder = WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull'); } if (isset($data_item['filename']) && strlen($data_item['filename'])) { $manifest_filename = Snapshot_Helper_Utility::extract_archive_manifest(trailingslashit($backupFolder) . $data_item['filename']); if ($manifest_filename) { //echo "manifest_filename=[". $manifest_filename ."]<br />"; $manifest_data = Snapshot_Helper_Utility::consume_archive_manifest($manifest_filename); if ($manifest_data) { //echo "manifest_data<pre>"; print_r($manifest_data); echo "</pre>"; $item['MANIFEST'] = $manifest_data; } } } ?> <div id="poststuff" class="metabox-holder"> <form id="snapshot-edit-restore" action="<?php echo WPMUDEVSnapshot::instance()->get_setting('SNAPSHOT_MENU_URL'); ?> snapshots_edit_panel" method="post"> <input type="hidden" name="snapshot-action" value="restore-request"/> <input type="hidden" name="item" value="<?php echo $item['timestamp']; ?> "/> <?php wp_nonce_field('snapshot-restore', 'snapshot-noonce-field'); ?> <?php $this->_snapshot_metaboxes->snapshot_metaboxes_show_item_header_information(__('Snapshot Information', SNAPSHOT_I18N_DOMAIN), $item, true); ?> <?php $this->_snapshot_metaboxes->snapshot_metabox_show_archive_files(__('Selected Archive to Restore', SNAPSHOT_I18N_DOMAIN), $item, true); ?> <?php //if (is_multisite()) { $this->_snapshot_metaboxes->snapshot_metabox_restore_blog_options(__('Restore Blog Options', SNAPSHOT_I18N_DOMAIN), $item); //} ?> <?php $this->_snapshot_metaboxes->snapshot_metabox_show_restore_tables_options(__('What Tables to Restore?', SNAPSHOT_I18N_DOMAIN), $item, $data_item_key); ?> <?php $this->_snapshot_metaboxes->snapshot_metabox_show_restore_files_options(__('What Files to Restore?', SNAPSHOT_I18N_DOMAIN), $item, $data_item_key); ?> <?php $this->_snapshot_metaboxes->snapshot_metabox_restore_options(__('Restore Theme Options', SNAPSHOT_I18N_DOMAIN), $item); ?> <input id="snapshot-form-restore-submit" class="button-primary" <?php if (!$data_item_key) { ?> disabled="disabled" <?php } ?> type="submit" value="<?php _e('Restore Snapshot', SNAPSHOT_I18N_DOMAIN); ?> "/> <a class="button-secondary" href="<?php echo WPMUDEVSnapshot::instance()->get_setting('SNAPSHOT_MENU_URL'); ?> snapshots_edit_panel"><?php _e('Cancel', SNAPSHOT_I18N_DOMAIN); ?> </a> </form> </div> </div> <?php } else { ?> <div id="snapshot-settings-metaboxes-general" class="wrap snapshot-wrap"> <h2><?php _ex("Restore Snapshot", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN); ?> </h2> <p class="snapshot-restore-description"><?php _ex("ERROR: Missing argument. Please return to the main Snapshot panel and select the archive to restore. ", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN); ?> <a href="?page=snapshots_edit_panel">Snapshot</a>.</p> </div> <?php } }
function snapshot_metaboxes_show_server_info() { global $wpdb, $wp_version; ?> <p><?php _e('The following table shows version information about your server. When contacting support it might be helpful to provide this information along with your specific issues.', SNAPSHOT_I18N_DOMAIN); ?> </p> <table class="form-table snapshot-settings-server-info"> <tr class="form-field"> <th scope="row"> <?php _e('WordPress Version', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php echo $wp_version; ?> </td> </tr> <tr class="form-field"> <th scope="row"> <?php _e('PHP Version', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php echo phpversion(); ?> </td> </tr> <tr class="form-field"> <th scope="row"> <?php _e('MySQL Version', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php echo $wpdb->db_version(); ?> </td> </tr> <tr class="form-field"> <th scope="row"> <?php _e('Is Multisite', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php if (is_multisite()) { $blogs_count = Snapshot_Helper_Utility::get_blogs(true); echo __('Yes, Number of Sites', SNAPSHOT_I18N_DOMAIN) . ": " . number_format($blogs_count); } else { _e('No', SNAPSHOT_I18N_DOMAIN); } ?> </td> </tr> <tr class="form-field"> <th scope="row"> <?php _e('WP_CRON', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php echo __('Snapshot uses WP_CRON to run automated backups. If you have disabled WP_CRON via your wp-config.php you will not be able to schedule snapshots.', SNAPSHOT_I18N_DOMAIN) . "<br />"; if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON == true) { echo '<span style="color:#FF0000">' . __('WP_CRON - Disabled. Check your wp-config.php for the DISABLE_WP_CRON define. When scheduling snapshots to run you will need to call the wp-cron.php file from an external source', SNAPSHOT_I18N_DOMAIN) . '</span>'; } else { echo __('WP_CRON Enabled.', SNAPSHOT_I18N_DOMAIN); } if (defined('WP_CRON_LOCK_TIMEOUT')) { echo "<br />" . __('WP_CRON Lock timeout: ', SNAPSHOT_I18N_DOMAIN) . WP_CRON_LOCK_TIMEOUT; } ?> </td> </tr> <?php /* ?> <tr class="form-field" > <th scope="row"> <?php _e('_SESSION', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php $session_save_path = session_save_path(); echo __('Snapshot uses _SESSIONS to store temporary information about database tables and files during the backup and restore processing. Sessions are a default part of PHP.', SNAPSHOT_I18N_DOMAIN) ."<br />"; ?> Session save path: <span class="description"><?php echo $session_save_path; ?><br /> <?php if (empty($session_save_path)) { echo '<span style="color:#FF0000">'. __('Session save path is empty. This may be ok. Try running snapshot manually.', SNAPSHOT_I18N_DOMAIN) .'</span><br />'; } else { if (!is_dir($session_save_path)) { echo '<span style="color:#FF0000">'. __('Session save path is not a valid directory.', SNAPSHOT_I18N_DOMAIN) .'</span><br />'; } else { echo '<span>'. __('Session save path is a valid directory.', SNAPSHOT_I18N_DOMAIN) .'</span><br />'; } if (!is_writable($session_save_path)) { echo '<span style="color:#FF0000">'. __('Session save path is not writeable.', SNAPSHOT_I18N_DOMAIN) .'</span><br />'; } else { echo '<span>'. __('Session save path is writeable.', SNAPSHOT_I18N_DOMAIN) .'</span><br />'; } } ?> </td> </tr> <?php */ ?> <tr class="form-field"> <th scope="row"> <?php _e('Folder Permissions', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php $folders_array = array(WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull'), WPMUDEVSnapshot::instance()->get_setting('backupBackupFolderFull'), WPMUDEVSnapshot::instance()->get_setting('backupRestoreFolderFull'), WPMUDEVSnapshot::instance()->get_setting('backupLockFolderFull'), WPMUDEVSnapshot::instance()->get_setting('backupLogFolderFull')); sort($folders_array); foreach ($folders_array as $folder) { if (!file_exists($folder)) { echo '<span class="snapshot-error">' . __("Missing Folder", SNAPSHOT_I18N_DOMAIN) . " – " . $folder . "</span><br />"; } else { if (!is_writable($folder)) { echo __("Not Writable ", SNAPSHOT_I18N_DOMAIN); } else { echo __("Writable ", SNAPSHOT_I18N_DOMAIN); } echo "(" . substr(sprintf('%o', fileperms($folder)), -4) . ") – " . str_replace(ABSPATH, '/', $folder) . "<br />"; } } ?> </td> </tr> <tr class="form-field"> <th scope="row"> <?php _e('OpenSSL', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php echo __('The OpenSSL Apache module is require to make secure connections with destinations like Dropbox and Amazon AWS.', SNAPSHOT_I18N_DOMAIN) . "<br />"; if (!extension_loaded('openssl')) { echo '<span style="color:#FF0000">' . __('OpenSSL not installed.', SNAPSHOT_I18N_DOMAIN) . '</span>'; } else { echo __("OpenSSL installed", SNAPSHOT_I18N_DOMAIN); } ?> </td> </tr> <tr class="form-field"> <th scope="row"> <?php _e('cURL', SNAPSHOT_I18N_DOMAIN); ?> </th> <td> <?php echo __('cURL is used when connecting to remote destinations like Dropbox and Amazon AWS.', SNAPSHOT_I18N_DOMAIN) . "<br />"; if (!extension_loaded('curl')) { echo '<span style="color:#FF0000">' . __('cURL not installed.', SNAPSHOT_I18N_DOMAIN) . '</span>'; } else { echo __("cURL installed", SNAPSHOT_I18N_DOMAIN) . "<br />"; $version = curl_version(); echo __("Version", SNAPSHOT_I18N_DOMAIN) . ": " . $version['version'] . "<br />"; echo __("SSL Version", SNAPSHOT_I18N_DOMAIN) . ": " . $version['ssl_version'] . "<br />"; echo __("Libz Version", SNAPSHOT_I18N_DOMAIN) . ": " . $version['libz_version'] . "<br />"; echo __("Protocols", SNAPSHOT_I18N_DOMAIN) . ": " . join(', ', $version['protocols']) . "<br />"; //echo "version<pre>"; print_r($version); echo "</pre>"; //$ssl_supported= ($version['features'] & CURL_VERSION_SSL); } ?> </td> </tr> <tr class="form-field"> <th scope="row"> <strong><?php _e('PHP runtime information', SNAPSHOT_I18N_DOMAIN); ?> </strong> </th> <td> </td> </tr> <?php $php_vars_array = array('safe_mode' => __("Running PHP in Safe Mode", SNAPSHOT_I18N_DOMAIN), 'max_execution_time' => __("Max Execution Time (seconds)", SNAPSHOT_I18N_DOMAIN), 'magic_quotes_gpc' => __("Magic Quotes", SNAPSHOT_I18N_DOMAIN), 'error_reporting' => __("Error Reporting", SNAPSHOT_I18N_DOMAIN), 'display_errors' => __("Display Errors", SNAPSHOT_I18N_DOMAIN), 'memory_limit' => __("Memory Limit", SNAPSHOT_I18N_DOMAIN), 'zlib.output_compression' => __("ZLib Compression", SNAPSHOT_I18N_DOMAIN), 'open_basedir' => __("Open Basedir", SNAPSHOT_I18N_DOMAIN), 'safe_mode' => __("Safe Mode", SNAPSHOT_I18N_DOMAIN)); asort($php_vars_array); ?> <?php foreach ($php_vars_array as $php_var => $php_label) { $php_val = ini_get($php_var); if (!$php_val) { $php_val = "Off"; } ?> <tr class="form-field"> <td><?php echo $php_label; ?> </td> <td><?php if ($php_var == "max_execution_time") { echo $php_val; if (Snapshot_Helper_Utility::check_server_timeout()) { _e(" The value displayed can be adjusted by Snapshot PHP scripts.", SNAPSHOT_I18N_DOMAIN); } else { _e(" The value displayed cannot be adjusted by Snapshot PHP scripts.", SNAPSHOT_I18N_DOMAIN); } } else { if ($php_var == "memory_limit") { //echo " - PHP 'memory_limit'"; if (defined('WP_MEMORY_LIMIT')) { echo WP_MEMORY_LIMIT . ' - WP_MEMORY_LIMIT defined by WordPress <a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">wp-config.php</a>.'; } if (defined('WP_MAX_MEMORY_LIMIT')) { echo "<br />" . WP_MAX_MEMORY_LIMIT . ' - WP_MAX_MEMORY_LIMIT defined automatically by WordPress'; } else { echo "<br />" . WP_MAX_MEMORY_LIMIT . ' - not defined'; } } else { if ($php_var == "error_reporting") { echo $php_val; $errorStr = array(); error_reporting(E_ERROR | E_WARNING | E_CORE_ERROR); $current_error = error_reporting(); if (defined('E_ERROR') && $current_error & E_ERROR) { $errorStr[] = "E_ERROR"; } if (defined('E_WARNING') && $current_error & E_WARNING) { $errorStr[] = "E_WARNING"; } if (defined('E_PARSE') && $current_error & E_PARSE) { $errorStr[] = "E_PARSE"; } if (defined('E_NOTICE') && $current_error & E_NOTICE) { $errorStr[] = "E_NOTICE"; } //if ((defined('E_CORE_ERROR')) && ($current_error & E_CORE_ERROR)) $errorStr[] = "E_CORE_ERROR"; //if ((defined('E_CORE_WARNING')) && ($current_error & E_CORE_WARNING)) $errorStr[] = "E_CORE_WARNING"; //if ((defined('E_COMPILE_ERROR')) && ($current_error & E_COMPILE_ERROR)) $errorStr[] = "E_COMPILE_ERROR"; //if ((defined('E_COMPILE_WARNING')) && ($current_error & E_COMPILE_WARNING)) $errorStr[] = "E_COMPILE_WARNING"; //if ((defined('E_USER_ERROR')) && ($current_error & E_USER_ERROR)) $errorStr[] = "E_USER_ERROR"; //if ((defined('E_USER_WARNING')) && ($current_error & E_USER_WARNING)) $errorStr[] = "E_USER_WARNING"; //if ((defined('E_USER_NOTICE')) && ($current_error & E_USER_NOTICE)) $errorStr[] = "E_USER_NOTICE"; //if ((defined('E_STRICT')) && ($current_error & E_STRICT)) $errorStr[] = "E_STRICT"; //if ((defined('E_RECOVERABLE_ERROR')) && ($current_error & E_RECOVERABLE_ERROR)) $errorStr[] = "E_RECOVERABLE_ERROR"; //if ((defined('E_DEPRECATED')) && ($current_error & E_DEPRECATED)) $errorStr[] = "E_DEPRECATED"; //if ((defined('E_USER_DEPRECATED')) && ($current_error & E_USER_DEPRECATED)) $errorStr[] = "E_USER_DEPRECATED"; if (count($errorStr)) { echo " - " . join(', ', $errorStr); } } else { echo $php_val; } } } ?> </td> </tr> <?php } ?> </tr> </table> <?php }