namespace Friendica\Core;
use Friendica\BaseObject;
-use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Model\Process;
use Friendica\Util\DateTimeFormat;
*
* @param boolean $run_cron Should the cron processes be executed?
* @return void
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function processQueue($run_cron = true)
{
* @brief Returns the number of deferred entries in the worker queue
*
* @return integer Number of deferred entries in the worker queue
+ * @throws \Exception
*/
private static function deferredEntries()
{
* @brief Returns the number of non executed entries in the worker queue
*
* @return integer Number of non executed entries in the worker queue
+ * @throws \Exception
*/
private static function totalEntries()
{
* @brief Returns the highest priority in the worker queue that isn't executed
*
* @return integer Number of active worker processes
+ * @throws \Exception
*/
private static function highestPriority()
{
* @param integer $priority The priority that should be checked
*
* @return integer Is there a process running with that priority?
+ * @throws \Exception
*/
private static function processWithPriorityActive($priority)
{
* @param array $queue Workerqueue entry
*
* @return boolean "true" if further processing should be stopped
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function execute($queue)
{
* @param array $argv Array of values to be passed to the function
* @param boolean $method_call boolean
* @return void
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function execFunction($queue, $funcname, $argv, $method_call)
{
* @brief Checks if the number of database connections has reached a critical limit.
*
* @return bool Are more than 3/4 of the maximum connections used?
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function maxConnectionsReached()
{
/**
* @brief fix the queue entry if the worker process died
* @return void
+ * @throws \Exception
*/
private static function killStaleWorkers()
{
* @brief Checks if the number of active workers exceeds the given limits
*
* @return bool Are there too much workers running?
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function tooMuchWorkers()
{
* @brief Returns the number of active worker processes
*
* @return integer Number of active worker processes
+ * @throws \Exception
*/
private static function activeWorkers()
{
*
* @param string $highest_priority Returns the currently highest priority
* @return bool We let pass a slower process than $highest_priority
+ * @throws \Exception
*/
private static function passingSlow(&$highest_priority)
{
*
* @param boolean $passing_slow Returns if we had passed low priority processes
* @return boolean Have we found something?
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function findWorkerProcesses(&$passing_slow)
{
*
* @param boolean $passing_slow Returns if we had passed low priority processes
* @return string SQL statement
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function workerProcess(&$passing_slow)
{
/**
* @brief Removes a workerqueue entry from the current process
* @return void
+ * @throws \Exception
*/
public static function unclaimProcess()
{
/**
* @brief Call the front end worker
* @return void
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function callWorker()
{
/**
* @brief Call the front end worker if there aren't any active
* @return void
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function executeIfIdle()
{
/**
* @brief Removes long running worker processes
* @return void
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function clearProcesses()
{
/**
* @brief Runs the cron processes
* @return void
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function runCron()
{
/**
* @brief Spawns a new worker
+ * @param bool $do_cron
* @return void
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function spawnWorker($do_cron = false)
{
* or: Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id);
* or: Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "CreateShadowEntry", $post_id);
*
+ * @return boolean "false" if proc_run couldn't be executed
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @note $cmd and string args are surrounded with ""
*
* @hooks 'proc_run'
- * array $arr
+ * array $arr
*
- * @return boolean "false" if proc_run couldn't be executed
*/
public static function add($cmd)
{
$arr = ['args' => $args, 'run_cmd' => true];
- Addon::callHooks("proc_run", $arr);
+ Hook::callAll("proc_run", $arr);
if (!$arr['run_cmd'] || !count($args)) {
return true;
}
*
* @brief Remove the active process from the "process" table
* @return bool
+ * @throws \Exception
*/
public static function endProcess()
{
*
* @brief Set the flag if some job is waiting
* @param boolean $jobs Is there a waiting job?
+ * @throws \Exception
*/
public static function IPCSetJobState($jobs)
{
*
* @brief Checks if some worker job waits to be executed
* @return bool
+ * @throws \Exception
*/
public static function IPCJobsExists()
{