public function get_log_file() { if (!$this->logFile) { WPB2D_BackupController::create_dump_dir(); $path = WPB2D_Factory::get('config')->get_backup_dir() . DIRECTORY_SEPARATOR . self::LOGFILE; $files = glob($path . '.*'); if (isset($files[0])) { $this->logFile = $files[0]; } else { $this->logFile = $path . '.' . WPB2D_Factory::secret(self::LOGFILE); } } return $this->logFile; }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA. */ try { if ($errors = get_option('wpb2d-init-errors')) { delete_option('wpb2d-init-errors'); throw new Exception(__('WordPress Backup to Dropbox failed to initialize due to these database errors.', 'wpbtd') . '<br /><br />' . $errors); } $validation_errors = null; $dropbox = WPB2D_Factory::get('dropbox'); $config = WPB2D_Factory::get('config'); $backup = new WPB2D_BackupController(); $backup->create_dump_dir(); $disable_backup_now = $config->get_option('in_progress'); //We have a form submit so update the schedule and options if (array_key_exists('wpb2d_save_changes', $_POST)) { check_admin_referer('backup_to_dropbox_options_save'); if (preg_match('/[^A-Za-z0-9-_.\\/]/', $_POST['dropbox_location'])) { add_settings_error('wpb2d_options', 'invalid_subfolder', __('The sub directory must only contain alphanumeric characters.', 'wpbtd'), 'error'); $dropbox_location = $_POST['dropbox_location']; $store_in_subfolder = true; } else { $config->set_schedule($_POST['day'], $_POST['time'], $_POST['frequency'])->set_option('store_in_subfolder', $_POST['store_in_subfolder'] == "on")->set_option('dropbox_location', $_POST['dropbox_location']); add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); } } elseif (array_key_exists('unlink', $_POST)) { check_admin_referer('backup_to_dropbox_options_save');
/** * @return void */ function run_dropbox_backup() { $options = WPB2D_Factory::get('config'); if (!$options->get_option('is_running')) { $options->set_option('is_running', true); WPB2D_BackupController::construct()->execute(); } }
* @license This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA. */ $config = WPB2D_Factory::get('config'); $backup = new WPB2D_BackupController(); if (array_key_exists('stop_backup', $_POST)) { check_admin_referer('backup_to_dropbox_monitor_stop'); $backup->stop(); add_settings_error('wpb2d_monitor', 'backup_stopped', __('Backup stopped.', 'wpbtd'), 'updated'); } elseif (array_key_exists('start_backup', $_POST)) { check_admin_referer('backup_to_dropbox_monitor_stop'); $backup->backup_now(); $started = true; add_settings_error('wpb2d_monitor', 'backup_started', __('Backup started.', 'wpbtd'), 'updated'); } ?> <script type="text/javascript" language="javascript"> function reload() { jQuery('.files').hide(); jQuery.post(ajaxurl, { action : 'progress' }, function(data) {