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;
 }
Ejemplo n.º 2
0
 *          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');
        $dropbox->unlink_account()->init();