示例#1
0
文件: CFUPSBase.php 项目: ezeql/fups
 protected function wait_courteously()
 {
     if ($this->web_initiated) {
         $cancellation_filename = make_cancellation_filename($this->token);
         if (file_exists($cancellation_filename)) {
             $this->write_status('Found a cancellation file. CANCELLED');
             if ($this->dbg) {
                 $this->write_err('Found a cancellation file; exiting.', __FILE__, __METHOD__, __LINE__);
             }
             exit;
         }
     }
     if ($this->dbg) {
         $this->write_err("Waiting courteously for {$this->settings['delay']} seconds.");
     }
     sleep($this->settings['delay']);
 }
示例#2
0
文件: cancel.php 项目: ezeql/fups
 */
/* File       : cancel.php.
 * Description: Updates the status file of the relevant FUPS process to
 *              indicate that the user wants the process cancelled. Lets
 *              the user know the result, and directs the user back to
 *              the status page to wait for acknowledgement of cancellation.
 *              Part of the web app functionality of FUPS.
 */
require_once __DIR__ . '/common.php';
$err = '';
if (!isset($_GET['token'])) {
    $err = 'Fatal error: I did not detect a URL query parameter "token".';
} else {
    $token = $_GET['token'];
    if (validate_token($token, $err)) {
        $cancellation_filename = make_cancellation_filename($token, $err);
        if (!@file_put_contents($cancellation_filename, '') === false) {
            $err = 'A fatal error occurred: failed to write to the cancellation file.';
        }
    }
}
$page = substr(__FILE__, strlen(FUPS_INC_ROOT));
fups_output_page_start($page, 'FUPS cancellation page: cancel an in-progress task', 'Cancel an in-progress FUPS task.');
global $fups_url_run;
if (!$err) {
    ?>
			<ul class="fups_listmin">
				<li><a href="<?php 
    echo $fups_url_run;
    ?>
?token=<?php 
示例#3
0
            foreach ($output_info as $opv) {
                try_delete_file($opv['filepath'], '"' . $opv['filepath'] . '"', false, $err, $num_files_deleted, false);
                $output_dir = dirname($opv['filepath']);
            }
            @rmdir($output_dir);
        }
    }
    if (validate_token($token, $err)) {
        try_delete_file(make_settings_filename($token), 'settings', true, $err, $num_files_deleted);
        try_delete_file(make_status_filename($token), 'status', false, $err, $num_files_deleted);
        try_delete_file(make_errs_filename($token), 'error', false, $err, $num_files_deleted);
        try_delete_file(make_errs_admin_filename($token), 'errors (admin)', false, $err, $num_files_deleted, false);
        try_delete_file(make_output_info_filename($token), 'output info', false, $err, $num_files_deleted, false);
        try_delete_file(make_serialize_filename($token), 'serialisation', true, $err, $num_files_deleted);
        try_delete_file(make_cookie_filename($token), 'cookie', true, $err, $num_files_deleted, false);
        try_delete_file(make_cancellation_filename($token), 'cancellation', true, $err, $num_files_deleted, false);
    }
}
function try_delete_file($filename, $name, $sensitive, &$err, &$num_files_deleted, $add_err_if_file_not_present = true)
{
    global $fups_url_homepage;
    if (!is_file($filename)) {
        if ($add_err_if_file_not_present) {
            $err .= $err ? ' Another' : 'An';
            $err .= ' error occurred: the ' . $name . ' file does not exist on disk; possibly you have already deleted it or it was never created in the first place.';
        }
    } else {
        if (!unlink($filename)) {
            $err .= $err ? ' Another' : 'An';
            $err .= ' error occurred: failed to delete the ' . $name . ' file ' . ($sensitive ? '(contains username and password if you supplied them).' : '(does NOT contain either username or password).');
        } else {