Esempio n. 1
0
File: run.php Progetto: ezeql/fups
                    $file_errs .= 'Error: unable to write to the status file.';
                }
                if (file_put_contents($errs_filename, '') === false) {
                    if ($file_errs) {
                        $file_errs .= ' ';
                    }
                    $file_errs .= 'Error: unable to write to the error file.';
                }
                if (file_put_contents($serialize_filename, '') === false) {
                    if ($file_errs) {
                        $file_errs .= ' ';
                    }
                    $file_errs .= 'Error: unable to write to the serialization file.';
                }
                $cmd = make_php_exec_cmd(array('token' => $token));
                if (!try_run_bg_proc($cmd)) {
                    $err = 'Apologies, the server encountered a technical error: it was unable to initiate the background process to perform the task of scraping, sorting and finally presenting your posts. The command used was:<br />' . PHP_EOL . '<br />' . PHP_EOL . $cmd . '<br />' . PHP_EOL . '<br />' . PHP_EOL . 'You might like to try again or <a href="' . FUPS_CONTACT_URL . '">contact me</a> about this error.';
                }
            }
        }
    }
} else {
    $token = $_GET['token'];
    if (validate_token($token, $err)) {
        $status_filename = make_status_filename($token);
        $errs_filename = make_errs_filename($token);
        $errs_admin_filename = make_errs_admin_filename($token);
    }
}
if (!$err) {
    $ts = @filemtime($status_filename);
Esempio n. 2
0
 protected function check_do_chain()
 {
     if (time() - $this->start_time > $this->FUPS_CHAIN_DURATION) {
         $serialize_filename = make_serialize_filename($this->web_initiated ? $this->token : $this->settings_filename);
         if ($this->dbg) {
             $this->write_err('Set $serialize_filename to "' . $serialize_filename . '".');
         }
         if (!file_put_contents($serialize_filename, serialize($this))) {
             $this->exit_err('file_put_contents returned false.', __FILE__, __METHOD__, __LINE__);
         }
         $args = array('chained' => true);
         if ($this->web_initiated) {
             $args['token'] = $this->token;
         } else {
             $args['settings_filename'] = $this->settings_filename;
             $args['output_dirname'] = $this->output_dirname;
             $args['quiet'] = $this->quiet;
         }
         curl_close($this->ch);
         // So we save the cookie file to disk for the chained process.
         $cmd = make_php_exec_cmd($args);
         $this->write_status('Chaining next process.');
         if ($this->dbg) {
             $this->write_err('Chaining process: about to run command: ' . $cmd);
         }
         if (!try_run_bg_proc($cmd)) {
             $this->exit_err('Apologies, the server encountered a technical error: it was unable to initiate a chained background process to continue the task of scraping, sorting and finally presenting your posts. The command used was:' . PHP_EOL . PHP_EOL . $cmd . PHP_EOL . PHP_EOL . 'Any output was:' . PHP_EOL . implode(PHP_EOL, $output) . PHP_EOL . PHP_EOL . 'You might like to try again.', __FILE__, __METHOD__, __LINE__);
         }
         if ($this->dbg) {
             $this->write_err('Exiting parent chaining process.');
         }
         exit;
     }
 }