Plugin Directory

Changeset 339017

Timestamp:
01/31/2011 02:28:28 AM (13 years ago)
Author:
filosofo
Message:

do not attempt to delete nonexistent files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-db-backup/tags/2.2.4/wp-db-backup.php

    r338704 r339017  
    182182                break;
    183183            default:
    184                 $this->deliver_backup($this->backup_file, $via);
     184                $this->deliver_backup($this->backup_file, $via);
    185185                echo $this->error_display( 'frame', false );
     186
     187
     188
     189
     190
     191
     192
     193
    186194            }
    187195            exit;
     
    245253            <script type="text/javascript">
    246254            //<![CDATA[
    247             var wpDBBackupWaiting;
    248             function markSuccess() {
    249                 if ( wpDBBackupWaiting ) {
    250                     try {
    251                         clearTimeout( wpDBBackupWaiting );
    252                     } catch ( err ) {}
    253                 }
    254             }
    255 
    256255            window.onbeforeunload = function() {
    257256                return "' . __('Navigating away from this page will cause your backup to fail.', 'wp-db-backup') . '";
     
    292291        case 'http':
    293292            echo '
    294                 setProgress("' . __('Backup Complete!','wp-db-backup') . '");
     293                setProgress("' . __('','wp-db-backup') . '");
    295294                window.onbeforeunload = null;
    296295                fram.src = "' . $download_uri . '";
    297                 setInterval( function() {
    298                     fram.src = "' . $download_uri . '&download-retry=1";
     296               
     297                setTimeout( function() {
     298                    var secondFrame = document.createElement("iframe");             
     299                    fram.parentNode.insertBefore(secondFrame, fram);
     300                    secondFrame.src = "' . $download_uri . '&download-retry=1";
    299301                }, 30000 );
    300302            ';
     
    10471049
    10481050            if ( file_exists( $gz_diskfile ) ) {
    1049                 unlink($diskfile);
     1051                if ( file_exists( $diskfile ) ) {
     1052                    unlink($diskfile);
     1053                }
    10501054                $diskfile = $gz_diskfile;
    10511055                $filename = "{$filename}.gz";
     
    10741078             *
    10751079             */
     1080
     1081
     1082
    10761083        }
    10771084
    10781085        if ('http' == $delivery) {
    1079             if ( ! file_exists($diskfile) && empty( $_GET['download-retry'] ) ) {
    1080                 $this->error(array('kind' => 'fatal', 'msg' => sprintf(__('File not found:%s','wp-db-backup'), "&nbsp;<strong>$filename</strong><br />") . '<br /><a href="' . $this->page_url . '">' . __('Return to Backup','wp-db-backup') . '</a>'));
     1086            if ( ! file_exists( $diskfile ) ) {
     1087                if ( empty( $_GET['download-retry'] ) ) {
     1088                    $this->error(array('kind' => 'fatal', 'msg' => sprintf(__('File not found:%s','wp-db-backup'), "&nbsp;<strong>$filename</strong><br />") . '<br /><a href="' . $this->page_url . '">' . __('Return to Backup','wp-db-backup') . '</a>'));
     1089                } else {
     1090                    return true;
     1091                }
    10811092            } elseif ( file_exists( $diskfile ) ) {
    10821093                header('Content-Description: File Transfer');
     
    10851096                header("Content-Disposition: attachment; filename=$filename");
    10861097                $success = readfile($diskfile);
    1087                 unlink($diskfile);
     1098                if ( $success ) {
     1099                    unlink($diskfile);
     1100                }
    10881101            }
    10891102        } elseif ('smtp' == $delivery) {
     
    11091122                $this->error(array('kind' => 'fatal', 'loc' => $location, 'msg' => $msg));
    11101123            } else {
    1111                 unlink($diskfile);
     1124                if ( file_exists( $diskfile ) ) {
     1125                    unlink($diskfile);
     1126                }
    11121127            }
    11131128        }
Note: See TracChangeset for help on using the changeset viewer.