Merge branch 'red' into dev

This commit is contained in:
zotlabs 2018-09-09 20:59:13 -07:00
commit b837f0b8fc
5 changed files with 79 additions and 3 deletions

47
Zotlabs/Update/_1220.php Normal file
View file

@ -0,0 +1,47 @@
<?php
namespace Zotlabs\Update;
class _1220 {
function run() {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r1 = q("CREATE TABLE listeners (
id serial NOT NULL,
target_id text NOT NULL,
portable_id text NOT NULL,
ltype smallint NOT NULL DEFAULT '0',
PRIMARY KEY (id)
)");
$r2 = q("create index \"target_id_idx\" on listeners (\"target_id\")");
$r3 = q("create index \"portable_id_idx\" on listeners (\"portable_id\")");
$r4 = q("create index \"ltype_idx\" on listeners (\"ltype\")");
$r = $r1 && $r2 && $r3 && $r4;
}
if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
$r = q("CREATE TABLE IF NOT EXISTS listeners (
id int(11) NOT NULL AUTO_INCREMENT,
target_id varchar(191) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
portable_id varchar(191) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
ltype int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (id),
KEY target_id (target_id),
KEY portable_id (portable_id),
KEY ltype (ltype)
) ENGINE=InnoDB DEFAULT CHARSET=utf8");
}
if($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -38,7 +38,7 @@ define ( 'PLATFORM_ARCHITECTURE', 'zap' );
define ( 'STD_VERSION', '1.1' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1219 );
define ( 'DB_UPDATE_VERSION', 1220 );
define ( 'PROJECT_BASE', __DIR__ );

View file

@ -3990,6 +3990,7 @@ function zot_feed($uid, $observer_hash, $arr) {
$result = array();
$mindate = null;
$message_id = null;
$wall = true;
require_once('include/security.php');
@ -4003,6 +4004,10 @@ function zot_feed($uid, $observer_hash, $arr) {
$message_id = $arr['message_id'];
}
if(array_key_exists('wall',$arr)) {
$wall = intval($arr['wall']);
}
if(! $mindate)
$mindate = NULL_DATE;
@ -4031,6 +4036,10 @@ function zot_feed($uid, $observer_hash, $arr) {
$limit = '';
}
if($wall) {
$sql_extra .= " and item_wall = 1 ";
}
$items = [];
@ -4043,7 +4052,6 @@ function zot_feed($uid, $observer_hash, $arr) {
$r = q("SELECT parent, postopts FROM item
WHERE uid IN ( %s )
AND item_wall = 1
AND item_private = 0
$item_normal
$sql_extra ORDER BY created ASC $limit",
@ -4053,7 +4061,6 @@ function zot_feed($uid, $observer_hash, $arr) {
else {
$r = q("SELECT parent, postopts FROM item
WHERE uid = %d
AND item_wall = 1
$item_normal
$sql_extra ORDER BY created ASC $limit",
intval($uid)

View file

@ -753,6 +753,17 @@ CREATE TABLE IF NOT EXISTS `linkid` (
KEY `link` (`link`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS listeners (
id int(11) NOT NULL AUTO_INCREMENT,
target_id varchar(191) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
portable_id varchar(191) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
ltype int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (id),
KEY target_id (target_id),
KEY portable_id (portable_id),
KEY ltype (ltype)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `mail` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`convid` int(10) unsigned NOT NULL DEFAULT 0 ,

View file

@ -734,6 +734,17 @@ CREATE TABLE "linkid" (
);
create index "linkid_ident" on linkid ("ident");
create index "linkid_link" on linkid ("link");
CREATE TABLE listeners (
id serial NOT NULL,
target_id text NOT NULL,
portable_id text NOT NULL,
ltype smallint NOT NULL DEFAULT '0',
PRIMARY KEY (id)
);
create index "target_id_idx" on listeners ("target_id");
create index "portable_id_idx" on listeners ("portable_id");
create index "ltype_idx" on listeners ("ltype");
CREATE TABLE "mail" (
"id" serial NOT NULL,
"convid" bigint NOT NULL DEFAULT '0',