add queue priority
This commit is contained in:
parent
410f3335a9
commit
011ccd57f6
2
boot.php
2
boot.php
@ -49,7 +49,7 @@ define ( 'RED_PLATFORM', 'redmatrix' );
|
|||||||
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
||||||
define ( 'ZOT_REVISION', 1 );
|
define ( 'ZOT_REVISION', 1 );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1138 );
|
define ( 'DB_UPDATE_VERSION', 1139 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant with a HTML line break.
|
* Constant with a HTML line break.
|
||||||
|
@ -20,6 +20,24 @@ function deliver_run($argv, $argc) {
|
|||||||
dbesc($argv[$x])
|
dbesc($argv[$x])
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
|
$h = parse_url($r[0]['outq_posturl']);
|
||||||
|
if($h) {
|
||||||
|
$base = $h['scheme'] . '://' . $h['host'] . (($h['port']) ? ':' . $h['port'] : '');
|
||||||
|
if($base !== z_root()) {
|
||||||
|
$x = q("select site_update from site where site_url = '%s' ",
|
||||||
|
dbesc($base)
|
||||||
|
);
|
||||||
|
if($x && $x[0]['site_update'] < datetime_convert('UTC','UTC','now - 1 month')) {
|
||||||
|
q("update outq set outq_priority = %d where outq_hash = '%s'",
|
||||||
|
intval($r[0]['outq_priority'] + 10)
|
||||||
|
dbesc($r[0]['outq_hash'])
|
||||||
|
);
|
||||||
|
logger('immediate delivery deferred for site ' . $base);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($r[0]['outq_driver'] === 'post') {
|
if($r[0]['outq_driver'] === 'post') {
|
||||||
$result = z_post_url($r[0]['outq_posturl'],$r[0]['outq_msg']);
|
$result = z_post_url($r[0]['outq_posturl'],$r[0]['outq_msg']);
|
||||||
if($result['success'] && $result['return_code'] < 300) {
|
if($result['success'] && $result['return_code'] < 300) {
|
||||||
|
@ -940,6 +940,7 @@ CREATE TABLE IF NOT EXISTS `outq` (
|
|||||||
`outq_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`outq_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`outq_notify` mediumtext NOT NULL,
|
`outq_notify` mediumtext NOT NULL,
|
||||||
`outq_msg` mediumtext NOT NULL,
|
`outq_msg` mediumtext NOT NULL,
|
||||||
|
`outq_priority` smallint NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`outq_hash`),
|
PRIMARY KEY (`outq_hash`),
|
||||||
KEY `outq_account` (`outq_account`),
|
KEY `outq_account` (`outq_account`),
|
||||||
KEY `outq_channel` (`outq_channel`),
|
KEY `outq_channel` (`outq_channel`),
|
||||||
@ -947,7 +948,8 @@ CREATE TABLE IF NOT EXISTS `outq` (
|
|||||||
KEY `outq_created` (`outq_created`),
|
KEY `outq_created` (`outq_created`),
|
||||||
KEY `outq_updated` (`outq_updated`),
|
KEY `outq_updated` (`outq_updated`),
|
||||||
KEY `outq_async` (`outq_async`),
|
KEY `outq_async` (`outq_async`),
|
||||||
KEY `outq_delivered` (`outq_delivered`)
|
KEY `outq_delivered` (`outq_delivered`),
|
||||||
|
KEY `outq_priority` (`outq_priority`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
@ -725,6 +725,7 @@ CREATE TABLE "outq" (
|
|||||||
"outq_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
"outq_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
"outq_notify" text NOT NULL,
|
"outq_notify" text NOT NULL,
|
||||||
"outq_msg" text NOT NULL,
|
"outq_msg" text NOT NULL,
|
||||||
|
"outq_priority" smallint NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY ("outq_hash")
|
PRIMARY KEY ("outq_hash")
|
||||||
);
|
);
|
||||||
create index "outq_account" on outq ("outq_account");
|
create index "outq_account" on outq ("outq_account");
|
||||||
@ -734,6 +735,7 @@ create index "outq_created" on outq ("outq_created");
|
|||||||
create index "outq_updated" on outq ("outq_updated");
|
create index "outq_updated" on outq ("outq_updated");
|
||||||
create index "outq_async" on outq ("outq_async");
|
create index "outq_async" on outq ("outq_async");
|
||||||
create index "outq_delivered" on outq ("outq_delivered");
|
create index "outq_delivered" on outq ("outq_delivered");
|
||||||
|
create index "outq_priority" on outq ("outq_priority");
|
||||||
|
|
||||||
CREATE TABLE "pconfig" (
|
CREATE TABLE "pconfig" (
|
||||||
"id" serial NOT NULL,
|
"id" serial NOT NULL,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1138 );
|
define( 'UPDATE_VERSION' , 1139 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1580,3 +1580,12 @@ function update_r1137() {
|
|||||||
return UPDATE_SUCCESS;
|
return UPDATE_SUCCESS;
|
||||||
return UPDATE_FAILED;
|
return UPDATE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function update_r1138() {
|
||||||
|
$r1 = q("alter table outq add outq_priority smallint not null default '0' ");
|
||||||
|
$r2 = q("create index outq_priority on outq ( outq_priority ) ");
|
||||||
|
if($r1 && $r2)
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user