コード例 #1
0
ファイル: backup_script.php プロジェクト: bash-t/admidio
        gzwrite($zp, $activateForeignKeys, strlen($activateForeignKeys));
    } else {
        fwrite($fp, $activateForeignKeys, strlen($activateForeignKeys));
    }
    if (OUTPUT_COMPRESSION_TYPE == 'bzip2') {
        bzclose($bp);
    } elseif (OUTPUT_COMPRESSION_TYPE == 'gzip') {
        gzclose($zp);
    } else {
        fclose($fp);
    }
    if (file_exists($newfullfilename)) {
        unlink($newfullfilename);
        // Windows won't allow overwriting via rename
    }
    rename($backupabsolutepath . $tempbackupfilename, $newfullfilename);
} else {
    echo '<b>Warning:</b> failed to open ' . $backupabsolutepath . $tempbackupfilename . ' for writing!<br><br>';
    if (is_dir($backupabsolutepath)) {
        echo '<i>CHMOD 777</i> on the directory (' . htmlentities($backupabsolutepath) . ') should fix that.';
    } else {
        echo 'The specified directory does not exist: "' . htmlentities($backupabsolutepath) . '"';
    }
}
// End original backupDB
echo '<div class="alert alert-success form-alert"><span class="glyphicon glyphicon-ok"></span><strong>' . $gL10n->get('BAC_BACKUP_COMPLETED', FormattedTimeRemaining(getmicrotime() - $starttime, 2)) . '.</strong><br /><br />

' . $gL10n->get('BAC_BACKUP_FILE') . ' <a href="' . $g_root_path . '/adm_program/modules/backup/backup_file_function.php?job=get_file&amp;filename=' . basename($newfullfilename) . '">' . basename($newfullfilename) . '</a>
(' . FileSizeNiceDisplay(filesize($newfullfilename), 2) . ')</div>';
OutputInformation('cancel_link', '');
OutputInformation('topprogress', '');
コード例 #2
0
ファイル: backupDB.php プロジェクト: bravia2015/c2t-pos
        } else {
            echo 'The specified directory does not exist: "' . htmlentities($backupabsolutepath) . '"';
        }
    }
} else {
    // !$_REQUEST['StartBackup']
    if (file_exists($backupabsolutepath . $fullbackupfilename)) {
        echo 'It is now ' . gmdate('F j, Y g:ia T', time() + date('Z')) . '<br>';
        echo 'Last full backup of MySQL databases: ';
        $lastbackuptime = filemtime($backupabsolutepath . $fullbackupfilename);
        echo gmdate('F j, Y g:ia T', $lastbackuptime + date('Z'));
        echo ' (<b>' . FormattedTimeRemaining(time() - $lastbackuptime) . '</b> ago)<br>';
        if (time() - $lastbackuptime < 86400) {
            echo 'Generally, backing up more than once a day is not neccesary.<br>';
        }
        echo '<br><a href="' . str_replace(@$_SERVER['DOCUMENT_ROOT'], '', $backupabsolutepath) . $fullbackupfilename . '">Download previous full backup (' . FileSizeNiceDisplay(filesize($backupabsolutepath . $fullbackupfilename), 2) . ')</a> (right-click, Save As...)<br><br>';
    } else {
        echo 'Last backup of MySQL databases: <i>unknown</i>' . ($backuptimestamp ? ' (incompatible with timestamping)' : '') . '<br>';
    }
    $BackupTypesList = array('complete' => 'Full backup, complete inserts (recommended)', 'standard' => 'Full backup, standard inserts (smaller)', 'partial' => 'Selected tables only (with complete inserts)', 'structure' => 'Table structure(s) only');
    echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
    if (isset($_POST['DB_HOST'])) {
        echo '<input type="hidden" name="DB_HOST" value="' . htmlspecialchars(@$_POST['DB_HOST'], ENT_QUOTES) . '">';
        echo '<input type="hidden" name="DB_USER" value="' . htmlspecialchars(@$_POST['DB_USER'], ENT_QUOTES) . '">';
        echo '<input type="hidden" name="DB_PASS" value="' . htmlspecialchars(@$_POST['DB_PASS'], ENT_QUOTES) . '">';
    }
    echo '<select name="StartBackup">';
    foreach ($BackupTypesList as $key => $value) {
        echo '<option value="' . $key . '">' . htmlentities($value) . '</option>';
    }
    echo '</select><br>';