Mr.Fn4ticHz Shell
Server IP : 10.10.92.66  /  Your IP : 104.23.197.230
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux jurnalpolinema 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64
User : jurnal ( 1001)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/jurnal/public_html/plugins/generic/rqc/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/jurnal/public_html/plugins/generic/rqc/classes/DelayedRQCCallsDAO.inc.php
<?php

/**
 * @file plugins/generic/rqc/classes/DelyedRQCCallsDAO.inc.php
 *
 * Copyright (c) 2018-2023 Lutz Prechelt
 * Distributed under the GNU General Public License, Version 3.
 *
 * @class DelayedRQCCallsDAO
 * @see DelayedRQCCallsTask
 *
 * @brief Operations for retrieving and modifying DelayedRQCCall arrays/objects.
 */


/* for OJS 3.4:
namespace APP\plugins\generic\rqc;
use \PKP\db\DAO;
use \PKP\db\DAOResultFactory;
*/
import('lib.pkp.classes.db.DAO');

// TODO 2: use SchemaDAO  https://docs.pkp.sfu.ca/dev/documentation/en/architecture-database
class DelayedRQCCallsDAO extends DAO {

	/**
	 * Retrieve a reviewer submission by submission ID.
	 * @param $journalId int  which calls to get, or 0 for all calls
	 * @param $horizon int  unix timestamp. Get all calls not retried since this time.
	 * 				Defaults to 23.8 hours ago.
	 * @return DAOResultFactory
	 */
	function getCallsToRetry($journalId = 0, $horizon = null) {
		if (is_null($horizon)) {
			$horizon = time() - 23*3600 - 48*60;  // 23.8 hours ago
		}
		$result = $this->retrieve(
			'SELECT	*
			FROM rqc_delayed_calls
			WHERE (journal_id = ? OR ? = 0) AND
			      (last_try_ts < ?)',
			array(
				$journalId, $journalId,
				$horizon
			)
		);
		return new DAOResultFactory($result, $this, '_fromRow');
	}

	/**
	 * We use returned rows as-is, there is no DelayedRQCCalls class.
	 * @param $row array
	 * @return array
	 */
	function _fromRow($row) {
		return $row;
	}

	/**
	 * Update an existing review submission,
	 * usually by increasing retries and setting last_try_ts to current time.
	 * @param $row array one entry from rqc_delayed_calls
	 */
	function updateCall($row, $retries = null, $now = null) {
		if (isNull($retries)) {
			$retries = $row['retries'] + 1;
		}
		if (isNull($now)) {
			$now = time();
		}
		$this->update(
			'UPDATE rqc_delayed_calls
			SET	retries = ?,
				last_try_ts = ?
			WHERE call_id = ?',
			array(
				$retries,
				$now,
				$row['call_id'],
			)
		);
	}

	/**
	 * Delete a delayed call entry by its ID.
	 * @param $callId int  ID of one entry from rqc_delayed_calls
	 */
	function deleteById($callId) {
		return $this->update(
			'DELETE FROM rqc_delayed_calls WHERE call_id = ?',
			array($callId)
		);
	}
}

?>

Mr.F4ticHz - 2022
Mr.Fn4tcHzam