<?php

if (WP_UNINSTALL_PLUGIN === "snapshot/snapshot.php") {
    if (!isset($wpmudev_snapshot)) {
        include dirname(__FILE__) . "/snapshot.php";
        $wpmudev_snapshot = new WPMUDEVSnapshot();
    }
    $wpmudev_snapshot->uninstall_snapshot();
}
        public static function show_destination_item_count($destination_key)
        {
            if (isset(WPMUDEVSnapshot::instance()->config_data['items'])) {
                $destination_count = 0;
                foreach (WPMUDEVSnapshot::instance()->config_data['items'] as $snapshot_item) {
                    if (isset($snapshot_item['destination']) && $snapshot_item['destination'] == $destination_key) {
                        $destination_count += 1;
                    }
                }
                if ($destination_count) {
                    ?>
<a href="<?php 
                    echo WPMUDEVSnapshot::instance()->get_setting('SNAPSHOT_MENU_URL');
                    ?>
snapshots_edit_panel&amp;destination=<?php 
                    echo $destination_key;
                    ?>
"><?php 
                    echo $destination_count;
                    ?>
</a><?php 
                } else {
                    echo "0";
                }
            } else {
                echo "0";
            }
        }
Esempio n. 3
0
        /**
         *
         */
        public static function render_destination_edit_panel()
        {
            ?>
			<div id="snapshot-metaboxes-destination_add" class="wrap snapshot-wrap">
					<?php 
            $item = 0;
            if (isset($_REQUEST['snapshot-action'])) {
                if (sanitize_text_field($_REQUEST['snapshot-action']) == "edit") {
                    ?>
					<h2><?php 
                    _ex("Edit Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN);
                    ?>
</h2>
					<p><?php 
                    _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN);
                    ?>
</p>
					<?php 
                    if (isset($_REQUEST['item'])) {
                        $item_key = sanitize_text_field($_REQUEST['item']);
                        if (isset(WPMUDEVSnapshot::instance()->config_data['destinations'][$item_key])) {
                            $item = WPMUDEVSnapshot::instance()->config_data['destinations'][$item_key];
                        }
                    }
                } else {
                    if (sanitize_text_field($_REQUEST['snapshot-action']) == "add") {
                        ?>
					<h2><?php 
                        _ex("Add Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN);
                        ?>
</h2>
					<p><?php 
                        _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN);
                        ?>
</p>
					<?php 
                        unset($item);
                        $item = array();
                        if (isset($_REQUEST['type'])) {
                            $item['type'] = sanitize_text_field($_REQUEST['type']);
                        }
                    } else {
                        if (sanitize_text_field($_REQUEST['snapshot-action']) == "update") {
                            ?>
					<h2><?php 
                            _ex("Edit Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN);
                            ?>
</h2>
					<p><?php 
                            _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN);
                            ?>
</p>
					<?php 
                            if (isset($_POST['snapshot-destination'])) {
                                $item = $_POST['snapshot-destination'];
                            }
                        }
                    }
                }
            }
            if ($item) {
                Snapshot_Helper_UI::form_ajax_panels();
                ?>
						<form action="<?php 
                echo WPMUDEVSnapshot::instance()->get_setting('SNAPSHOT_MENU_URL');
                ?>
snapshots_destinations_panel&amp;snapshot-action=<?php 
                echo urlencode(sanitize_text_field($_GET['snapshot-action']));
                ?>
&amp;type=<?php 
                echo urlencode($item['type']);
                ?>
" method="post">
							<?php 
                if (sanitize_text_field($_GET['snapshot-action']) == "edit" || sanitize_text_field($_GET['snapshot-action']) == "update") {
                    ?>
					<input type="hidden" name="snapshot-action" value="update"/>
					<input type="hidden" name="item" value="<?php 
                    echo sanitize_text_field($_GET['item']);
                    ?>
"/>
					<?php 
                    wp_nonce_field('snapshot-update-destination', 'snapshot-noonce-field');
                    ?>
				<?php 
                } else {
                    if (sanitize_text_field($_GET['snapshot-action']) == "add") {
                        ?>
					<input type="hidden" name="snapshot-action" value="add"/>
					<?php 
                        wp_nonce_field('snapshot-add-destination', 'snapshot-noonce-field');
                        ?>
				<?php 
                    }
                }
                $item_object = Snapshot_Model_Destination::get_object_from_type($item['type']);
                if ($item_object && is_object($item_object)) {
                    $item_object->display_details_form($item);
                }
                ?>
								<input class="button-primary" type="submit" value="<?php 
                _e('Save Destination', SNAPSHOT_I18N_DOMAIN);
                ?>
" />
								<a class="button-secondary" href="<?php 
                echo WPMUDEVSnapshot::instance()->get_setting('SNAPSHOT_MENU_URL');
                ?>
snapshots_destinations_panel"><?php 
                _e('Cancel', SNAPSHOT_I18N_DOMAIN);
                ?>
</a>

							</div>
						</form>
						<?php 
            }
            ?>
			</div>
			<?php 
        }
Esempio n. 4
0
 /**
  *
  */
 public static function show_panel_messages()
 {
     $session_save_path = session_save_path();
     //echo "session_save_path=[". $session_save_path ."]<br />";
     if (!file_exists($session_save_path)) {
         WPMUDEVSnapshot::instance()->snapshot_admin_notices_proc("error", sprintf(__("<p>The session save path (%s) is not set to a valid directory. Check your PHP (php.ini) settings or contact your hosting provider.</p>", SNAPSHOT_I18N_DOMAIN), $session_save_path));
     } else {
         if (!is_writable($session_save_path)) {
             WPMUDEVSnapshot::instance()->snapshot_admin_notices_proc("error", sprintf(__("<p>The session_save_path (%s) is not writeable. Check your PHP (php.ini) settings or contact your hosting provider.</p>", SNAPSHOT_I18N_DOMAIN), $session_save_path));
         }
     }
 }
Esempio n. 5
0
 /**
  * Returns singleton instance of the plugin.
  *
  * @since 1.0.0
  *
  * @static
  * @access public
  *
  * @return WPMUDEVSnapshot
  */
 public static function instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Esempio n. 6
0
        function snapshot_admin_show_import_panel()
        {
            //			require( WPMUDEVSnapshot::instance()->get_setting( 'SNAPSHOT_PLUGIN_BASE_DIR' ) . '/lib/snapshot_admin_metaboxes.php' );
            $_snapshot_metaboxes = new Snapshot_View_Metabox_Admin();
            ?>
			<div id="snapshot-settings-metaboxes-general" class="wrap snapshot-wrap">
				<h2><?php 
            _ex("Snapshots Scan / Import", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN);
            ?>
</h2>

				<div id="poststuff" class="metabox-holder">
					<div id="post-body" class="">
						<div id="post-body-content" class="snapshot-metabox-holder-main">
							<p><?php 
            _e('The Snapshot import form below is used to import snapshot archives from outside of this environment into view of the snapshot plugin. If you are attempting to restore an archive from a remote server for example you first need to import the archive here. This will then show the archive in the All Snapshots listing. From that page you can then perform the needed restore.', SNAPSHOT_I18N_DOMAIN);
            ?>
</p>

							<form
								action="<?php 
            echo WPMUDEVSnapshot::instance()->get_setting('SNAPSHOT_MENU_URL');
            ?>
snapshots_import_panel"
								method="post">
								<input type="hidden" value="archives-import" name="snapshot-action">
								<?php 
            wp_nonce_field('snapshot-import', 'snapshot-noonce-field');
            ?>

								<?php 
            $_snapshot_metaboxes->snapshot_metaboxes_show_import(__('Import Options', SNAPSHOT_I18N_DOMAIN));
            ?>

								<input id="snapshot-add-button" class="button-primary" type="submit"
								       value="<?php 
            _e('Scan / Import Snapshots', SNAPSHOT_I18N_DOMAIN);
            ?>
"/>
							</form>
						</div>
					</div>
					<?php 
            //echo "_POST<pre>"; print_r($_POST); echo "</pre>";
            //echo "_GET<pre>"; print_r($_GET); echo "</pre>";
            if (isset($_REQUEST['snapshot-action']) && esc_attr($_REQUEST['snapshot-action']) == "archives-import") {
                if (wp_verify_nonce($_POST['snapshot-noonce-field'], 'snapshot-import')) {
                    if (isset($_POST['snapshot-import-archive-remote-url']) && !empty($_POST['snapshot-import-archive-remote-url'])) {
                        //echo "remote url[". $_POST['snapshot-import-archive-remote-url'] ."]<br />";
                        if (substr($_POST['snapshot-import-archive-remote-url'], 0, 4) == 'http') {
                            if (function_exists('curl_version')) {
                                $remoteFile = esc_url_raw($_POST['snapshot-import-archive-remote-url']);
                                @set_time_limit(900);
                                // 15 minutes Technically, server to server should be quick for large files.
                                ?>
<p><?php 
                                _e("PHP max_execution_time", SNAPSHOT_I18N_DOMAIN);
                                ?>
										: <?php 
                                echo ini_get('max_execution_time');
                                ?>
s</p><?php 
                                ?>
<p><?php 
                                _e("Attempting to download remote file", SNAPSHOT_I18N_DOMAIN);
                                ?>
										: <?php 
                                echo $remoteFile;
                                ?>
</p><?php 
                                flush();
                                $restoreFile = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull')) . basename($remoteFile);
                                //echo "remoteFile=[". $remoteFile ."]<br />";
                                //echo "restoreFile=[". $restoreFile ."]<br />";
                                Snapshot_Helper_Utility::remote_url_to_local_file($remoteFile, $restoreFile);
                                if (file_exists($restoreFile)) {
                                    $restoreFolder = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupRestoreFolderFull')) . "_imports";
                                    echo "<ol>";
                                    echo "<li><strong>" . __('Processing archive', SNAPSHOT_I18N_DOMAIN) . ": ", basename($restoreFile) . "</strong> (" . Snapshot_Helper_Utility::size_format(filesize($restoreFile)) . ")<ul><li>";
                                    flush();
                                    $error_status = Snapshot_Helper_Utility::archives_import_proc($restoreFile, $restoreFolder);
                                    //echo "error_status<pre>"; print_r($error_status); echo "</pre>";
                                    if (isset($error_status['errorStatus']) && $error_status['errorStatus'] === true) {
                                        if (isset($error_status['errorText']) && strlen($error_status['errorText'])) {
                                            echo '<span class="snapshot-error">Error: ' . $error_status['errorText'] . '</span></br />';
                                        }
                                    } else {
                                        if (isset($error_status['errorStatus']) && $error_status['errorStatus'] === false) {
                                            if (isset($error_status['responseText']) && strlen($error_status['responseText'])) {
                                                echo '<span class="snapshot-success">Success: ' . $error_status['responseText'] . '</span></br />';
                                            } else {
                                            }
                                        }
                                    }
                                    echo "</li></ul></li>";
                                    echo "</ol>";
                                } else {
                                    echo '<p>' . __('Error: Your server does not have lib_curl installed. So the import process cannot retrieve remote file.', SNAPSHOT_I18N_DOMAIN) . '</p>';
                                }
                            } else {
                                echo "<p>" . __('local import file not found. This could mean either the entered URL was not valid or the file was not publicly accessible.', SNAPSHOT_I18N_DOMAIN) . "</p>";
                            }
                        } else {
                            // Then a local directory
                            // Are we dealing with a absolote path...
                            if (substr($_POST['snapshot-import-archive-remote-url'], 0, 1) == "/") {
                                $dir = trailingslashit(esc_attr($_POST['snapshot-import-archive-remote-url']));
                            } else {
                                $dir = trailingslashit(trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull')) . esc_attr($_POST['snapshot-import-archive-remote-url']));
                            }
                            //echo "dir[". $dir ."]<br />";
                            if (is_dir($dir)) {
                                echo "<p>" . __('Importing archives from', SNAPSHOT_I18N_DOMAIN) . ": " . $dir . "</p>";
                                if ($dh = opendir($dir)) {
                                    $restoreFolder = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupRestoreFolderFull')) . "_imports";
                                    echo "<ol>";
                                    while (($file = readdir($dh)) !== false) {
                                        if ($file == '.' || $file == '..' || $file == 'index.php' || $file[0] == '.') {
                                            continue;
                                        }
                                        if (pathinfo($file, PATHINFO_EXTENSION) != "zip") {
                                            continue;
                                        }
                                        $restoreFile = $dir . $file;
                                        if (is_dir($restoreFile)) {
                                            continue;
                                        }
                                        echo "<li><strong>" . __('Processing archive', SNAPSHOT_I18N_DOMAIN) . ": ", basename($restoreFile) . "</strong> (" . Snapshot_Helper_Utility::size_format(filesize($restoreFile)) . ")<ul><li>";
                                        flush();
                                        $error_status = Snapshot_Helper_Utility::archives_import_proc($restoreFile, $restoreFolder);
                                        //echo "error_status<pre>"; print_r($error_status); echo "</pre>";
                                        if (isset($error_status['errorStatus']) && $error_status['errorStatus'] === true) {
                                            if (isset($error_status['errorText']) && strlen($error_status['errorText'])) {
                                                echo '<span class="snapshot-error">Error: ' . $error_status['errorText'] . '</span></br />';
                                            }
                                        } else {
                                            if (isset($error_status['errorStatus']) && $error_status['errorStatus'] === false) {
                                                if (isset($error_status['responseText']) && strlen($error_status['responseText'])) {
                                                    echo '<span class="snapshot-success">Success: ' . $error_status['responseText'] . '</span></br />';
                                                } else {
                                                }
                                            }
                                        }
                                        echo "</li></ul></li>";
                                    }
                                    echo "</ol>";
                                    closedir($dh);
                                }
                            } else {
                                echo "<p>" . sprintf(__('local import file not found %s. This could mean either the entered path was not valid or accessible.', SNAPSHOT_I18N_DOMAIN), $dir) . "</p>";
                            }
                        }
                    } else {
                        $dir = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull'));
                        echo "<p>" . __('Importing archives from', SNAPSHOT_I18N_DOMAIN) . ": " . $dir . "</p>";
                        if ($dh = opendir($dir)) {
                            $restoreFolder = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupRestoreFolderFull')) . "_imports";
                            echo "<ol>";
                            while (($file = readdir($dh)) !== false) {
                                if ($file == '.' || $file == '..' || $file == 'index.php' || $file[0] == '.') {
                                    continue;
                                }
                                if (pathinfo($file, PATHINFO_EXTENSION) != "zip") {
                                    continue;
                                }
                                $restoreFile = $dir . $file;
                                if (is_dir($restoreFile)) {
                                    continue;
                                }
                                echo "<li><strong>" . __('Processing archive', SNAPSHOT_I18N_DOMAIN) . ": ", basename($restoreFile) . "</strong> (" . Snapshot_Helper_Utility::size_format(filesize($restoreFile)) . ")<ul><li>";
                                flush();
                                $error_status = Snapshot_Helper_Utility::archives_import_proc($restoreFile, $restoreFolder);
                                //echo "error_status<pre>"; print_r($error_status); echo "</pre>";
                                if (isset($error_status['errorStatus']) && $error_status['errorStatus'] === true) {
                                    if (isset($error_status['errorText']) && strlen($error_status['errorText'])) {
                                        echo '<span class="snapshot-error">Error: ' . $error_status['errorText'] . '</span></br />';
                                    }
                                } else {
                                    if (isset($error_status['errorStatus']) && $error_status['errorStatus'] === false) {
                                        if (isset($error_status['responseText']) && strlen($error_status['responseText'])) {
                                            echo '<span class="snapshot-success">Success: ' . $error_status['responseText'] . '</span></br />';
                                        } else {
                                        }
                                    }
                                }
                                echo "</li></ul></li>";
                            }
                            echo "</ol>";
                            closedir($dh);
                        }
                    }
                }
                echo "<p>" . __('Snapshot import complete', SNAPSHOT_I18N_DOMAIN) . "</p>";
            }
            ?>
				</div>
			</div>
		<?php 
        }
Esempio n. 7
0
        function column_archives($item)
        {
            $_HAS_FILE_RESTORE = false;
            if (!isset($data_item['destination-sync'])) {
                $data_item['destination-sync'] = "archive";
            }
            if (!isset($data_item['files-count'])) {
                $data_item['files-count'] = 0;
            }
            $output = "";
            if (isset($item['data']) && count($item['data'])) {
                $data_item = Snapshot_Helper_Utility::latest_data_item($item['data']);
                if (!isset($data_item['timestamp'])) {
                    return;
                }
                //echo "data_item<pre>"; print_r($data_item); echo "</pre>";
                if (isset($data_item)) {
                    if (empty($data_item['destination']) || $data_item['destination'] == "local") {
                        if (isset($data_item['filename'])) {
                            $current_backupFolder = WPMUDEVSnapshot::instance()->snapshot_get_item_destination_path($item, $data_item);
                            if (empty($current_backupFolder)) {
                                $current_backupFolder = WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull');
                            }
                            $backupFile = trailingslashit(trim($current_backupFolder)) . $data_item['filename'];
                            //echo "backupFile=[". $backupFile ."]<br />";
                            // If we don't find file is the alternate directory then try the default
                            if (!file_exists($backupFile)) {
                                if (isset($data_item['destination-directory']) || !empty($data_item['destination-directory'])) {
                                    $current_backupFolder = WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull');
                                    $backupFile = trailingslashit(trim($current_backupFolder)) . $data_item['filename'];
                                }
                            }
                            if (file_exists($backupFile)) {
                                $_HAS_FILE_RESTORE = true;
                                $output .= '<a href="?page=snapshots_edit_panel&amp;snapshot-item=' . $item['timestamp'] . '&snapshot-data-item=' . $data_item['timestamp'] . '&snapshot-action=download-archive">' . $data_item['filename'] . '</a>';
                            } else {
                                $output .= $data_item['filename'];
                            }
                            if (isset($data_item['file_size'])) {
                                $file_kb = Snapshot_Helper_Utility::size_format($data_item['file_size']);
                                $output .= " (" . $file_kb . ")";
                            }
                            if (strlen($output)) {
                                $output .= "<br />";
                            }
                        }
                    } else {
                        if (isset($data_item['filename'])) {
                            if (isset($data_item['destination-directory']) || !empty($data_item['destination-directory'])) {
                                $current_backupFolder = WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull');
                                $backupFile = trailingslashit(trim($current_backupFolder)) . $data_item['filename'];
                                if (file_exists($backupFile)) {
                                    $_HAS_FILE_RESTORE = true;
                                    echo '<a href="?page=snapshots_edit_panel&amp;snapshot-item=' . $item['timestamp'] . '&snapshot-data-item=' . $data_item['timestamp'] . '&snapshot-action=download-archive">' . $data_item['filename'] . '</a>';
                                } else {
                                    echo $data_item['filename'];
                                }
                                if (isset($data_item['file_size'])) {
                                    $file_kb = Snapshot_Helper_Utility::size_format($data_item['file_size']);
                                    $output .= " (" . $file_kb . ")";
                                }
                                if (strlen($output)) {
                                    $output .= "<br />";
                                }
                            }
                        }
                        if ($data_item['destination-sync'] == "mirror") {
                            $output .= Snapshot_Helper_Utility::data_item_file_processed_count($data_item) . " " . __('files synced to destination', SNAPSHOT_I18N_DOMAIN) . "<br />";
                        }
                    }
                    $output .= __('Archives', SNAPSHOT_I18N_DOMAIN) . ': ' . '<a href="?page=snapshots_edit_panel&amp;snapshot-action=item-archives&amp;item=' . $item['timestamp'] . '">' . __('view', SNAPSHOT_I18N_DOMAIN) . '</a> (' . count($item['data']) . ')';
                    $backupLogFileFull = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupLogFolderFull')) . $item['timestamp'] . "_" . $data_item['timestamp'] . ".log";
                    if (file_exists($backupLogFileFull)) {
                        if (strlen($output)) {
                            $output .= " ";
                        }
                        $output .= __('Latest Log:', SNAPSHOT_I18N_DOMAIN) . ' ' . '<a class="snapshot-thickbox"
							href="' . admin_url() . 'admin-ajax.php?action=snapshot_view_log_ajax&amp;snapshot-item=' . $item['timestamp'] . '&amp;snapshot-data-item=' . $data_item['timestamp'] . '">' . __('view', SNAPSHOT_I18N_DOMAIN) . '</a>
							<a href="?page=snapshots_edit_panel&amp;snapshot-action=download-log&amp;snapshot-item=' . $item['timestamp'] . '&amp;snapshot-data-item=' . $data_item['timestamp'] . '&amp;live=0">' . __('download', SNAPSHOT_I18N_DOMAIN) . '</a>';
                    }
                    //if (strlen($output)) $output .= "<br />";
                } else {
                    if (isset($item['timestamp'])) {
                        //$output .= "Last: ". Snapshot_Helper_Utility::show_date_time($item['timestamp']);
                        //if (WPMUDEVSnapshot::instance()->config_data['config']['absoluteFolder'] != true) {
                        $backupLogFileFull = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupLogFolderFull')) . $item['timestamp'] . "_backup.log";
                        if (file_exists($backupLogFileFull)) {
                            if (strlen($output)) {
                                $output .= " ";
                            }
                            $output .= '<a href="?page=snapshots_edit_panel&amp;snapshot-item=' . $item['timestamp'] . '&snapshot-data-item=' . $data_item['timestamp'] . '&snapshot-action=download-log">' . __('view log', SNAPSHOT_I18N_DOMAIN) . '</a>';
                        }
                        //}
                    }
                    if (strlen($output)) {
                        $output .= "<br />";
                    }
                    $output .= __('No Snapshot file found', SNAPSHOT_I18N_DOMAIN);
                }
                if (strlen($output)) {
                    echo $output;
                } else {
                    echo "&nbsp;";
                }
            }
            $this->column_status($item);
        }
Esempio n. 8
0
        function snapshot_metaboxes_show_import($title = '')
        {
            ?>
			<div class="postbox">
				<h3 class="hndle"><span><?php 
            echo $title;
            ?>
</span></h3>

				<div class="inside">
					<ul>

						<li><strong><?php 
            _e('Remote Archives', SNAPSHOT_I18N_DOMAIN);
            ?>
</strong>:
							<?php 
            if (function_exists('curl_version')) {
                ?>
								<p><?php 
                _e('The import process can import an archive from a remote system server via FTP, Amazon S3 or Dropbox. The remote archive <strong>must</strong> by publicly accessible as this import process does not yet support authentication. See notes below on specific services.', SNAPSHOT_I18N_DOMAIN);
                ?>
</p>

								<p class="description"><?php 
                _e('<strong>Remote FTP:</strong> When downloading from a remote FTP server you must ensure the file is moved to a location where it will be accessible via a simple http:// or https:// URL.', SNAPSHOT_I18N_DOMAIN);
                ?>
</p>

								<p class="description"><?php 
                _e('<strong>Dropbox:</strong> If you are attempting to download a Dropbox Snapshot archive written to the App/WPMU DEV Snapshot you first need to copy the file to a public folder within your Dropbox account before grabbing the public link.', SNAPSHOT_I18N_DOMAIN);
                ?>
</p>
								<p class="description"><?php 
                _e('<strong>Amazon S3:</strong> When downloading a file from S3 you need to ensure the file is public. ', SNAPSHOT_I18N_DOMAIN);
                ?>
</p>
							<?php 
            } else {
                ?>
<p>
								<strong><?php 
                echo sprintf(__('Import cannot be used to retreive remote files because your PHP install does not have cURL installed. This means you will need to manually upload the file to your server into the snapshot archives directory <em>%s</em>', SNAPSHOT_I18N_DOMAIN), WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull'));
                ?>
</strong>
								</p>
							<?php 
            }
            ?>
						</li>
						<li>
							<strong><?php 
            _e('Local Archives', SNAPSHOT_I18N_DOMAIN);
            ?>
</strong>:
							<p><?php 
            echo sprintf(__('For archives already on your server but not showing in the All Snapshots listing you can simply submit this form without entering a value below. This will scan the snapshot archivs directory (<em>%s</em>) for any missing archives and add them to the listing.', SNAPSHOT_I18N_DOMAIN), WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull'));
            ?>
</p>

							<p><?php 
            _e('If the missing archive is on the server but saved to a different path. Maybe you setup the archive to save to an alternate directory. Then you can enter the full server path to the <strong>directory</strong> where the archive resides.', SNAPSHOT_I18N_DOMAIN);
            ?>
</p>
						</li>
					</ul>

					<table class="form-table snapshot-settings-zip-library">
						<tr>
							<td>
								<label
									for="snapshot-import-archive-remote-url"><?php 
            _e('URL or local path to Snapshot Archive', SNAPSHOT_I18N_DOMAIN);
            ?>
</label>
								<br/><?php 
            if (isset($_POST['snapshot-import-archive-remote-url']) && !empty($_POST['snapshot-import-archive-remote-url'])) {
                $remote_file = esc_attr($_POST['snapshot-import-archive-remote-url']);
            } else {
                $remote_file = '';
            }
            ?>

								<input type="text" style="width: 90%;" id="snapshot-import-archive-remote-url"
								       name="snapshot-import-archive-remote-url" value="<?php 
            echo $remote_file;
            ?>
"/>
							</td>
						</tr>
					</table>

				</div>
			</div>
		<?php 
        }
Esempio n. 9
0
        function column_logs($data_item)
        {
            $backupLogFileFull = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupLogFolderFull')) . $this->item['timestamp'] . "_" . $data_item['timestamp'] . ".log";
            if (file_exists($backupLogFileFull)) {
                echo '<a class="snapshot-thickbox"
					href="' . admin_url() . 'admin-ajax.php?action=snapshot_view_log_ajax&amp;snapshot-item=' . $this->item['timestamp'] . '&amp;snapshot-data-item=' . $data_item['timestamp'] . '">' . __('view', SNAPSHOT_I18N_DOMAIN) . '</a>';
                echo " ";
                echo '<a href="?page=snapshots_edit_panel&amp;snapshot-action=download-log&amp;snapshot-item=' . $this->item['timestamp'] . '&amp;snapshot-data-item=' . $data_item['timestamp'] . '">' . __('download', SNAPSHOT_I18N_DOMAIN) . '</a>';
            } else {
                echo "&nbsp;";
            }
        }
Esempio n. 10
0
 /**
  * @param string $item_key
  *
  * @return array|mixed|string|void
  */
 public static function item_get_lock_info($item_key = '')
 {
     if (!$item_key) {
         return;
     }
     $lock_info = array();
     $lock_info['locked'] = false;
     $lock_info['file'] = trailingslashit(WPMUDEVSnapshot::instance()->get_setting('backupLockFolderFull')) . $item_key . ".lock";
     if (file_exists($lock_info['file'])) {
         $lock_fp = fopen($lock_info['file'], 'r');
         if ($lock_fp) {
             // Try to obtain exclusive lock to prevent multiple processes.
             if (!flock($lock_fp, LOCK_EX | LOCK_NB)) {
                 $lock_info['locked'] = true;
                 flock($lock_fp, LOCK_UN);
             }
             $lock_info = fgets($lock_fp, 4096);
             if ($lock_info) {
                 $lock_info = maybe_unserialize($lock_info);
             }
             fclose($lock_fp);
         }
     }
     return $lock_info;
 }