示例#1
0
        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) . " &ndash; " . $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) . ") &ndash; " . 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>&nbsp;</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 
        }