Collections functions
General functions
Render functions
Theme permission functions
Resource functions

job_queue_update()

Description

Update the data/status/time of a job queue record.

Parameters

ColumnTypeDefaultDescription
$ref integer
$job_data array array - pass empty array to leave unchanged
$newstatus string ""
$newtime string ""
$priority NULL

Return

void

Location

include/job_functions.php lines 58 to 90

Definition

 
function job_queue_update($ref,$job_data=array(),$newstatus=""$newtime=""$priority=NULL)
    {
    
$update_sql = array();
    
$parameters = array();
    if (
count($job_data) > 0)
        {
        
$update_sql[] = "job_data = ?";
        
$parameters array_merge($parameters,array("s",json_encode($job_data)));
        } 
    if(
$newtime!="")
        {
        
$update_sql[] = "start_date = ?";
        
$parameters array_merge($parameters,array("s",$newtime));
        }
    if(
$newstatus!="")
        {
        
$update_sql[] = "status = ?";
        
$parameters array_merge($parameters,array("i",$newstatus));
        }
    if(
is_int_loose($priority))
        {
        
$update_sql[] = "priority = ?";
        
$parameters array_merge($parameters,array("i",(int)$priority));
        }
    if(
count($update_sql) == 0)
        {
        return 
false;
        }

    
$sql "UPDATE job_queue SET " implode(",",$update_sql) . " WHERE ref = ?";
    
$parameters array_merge($parameters,array("i",$ref));
    
ps_query($sql,$parameters);
    }

This article was last updated 26th June 2022 02:05 Europe/London time based on the source file dated 19th May 2022 17:05 Europe/London time.