From c918bbba255c4566dcd6c85c06e19646bd178183 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 3 Jul 2016 17:10:00 -0700 Subject: more work on x permissions --- install/update.php | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'install/update.php') diff --git a/install/update.php b/install/update.php index 3cb5010eb..865555b00 100644 --- a/install/update.php +++ b/install/update.php @@ -2360,4 +2360,59 @@ function update_r1178() { if($r1) return UPDATE_SUCCESS; return UPDATE_FAILED; +} + +function update_r1179() { + + require_once('install/perm_upgrade.php'); + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("create table perm_limits ( + id serial NOT NULL, + perm varchar(64) not null default '', + channel_id int(10) unsigned not null default 0, + perm_limit int(10) unsigned not null default 0 )"); + $r2 = q("create index \"idx_perm\" on perm_limits (\"perm\") "); + $r3 = q("create index \"idx_channel_id\" on perm_limits (\"channel_id\") "); + $r4 = q("create index \"idx_perm_limit\" on perm_limits (\"perm_limit\") "); + + + $r = $r1 && $r2 && $r3 && $r4; + } + + else { + $r1 = q("create table if not exists perm_limits { + id int(10) not null AUTO_INCREMENT, + perm varchar(64) not null default '', + channel_id int(10) unsigned not null default 0, + perm_limit int(10) unsigned not null default 0, + PRIMARY KEY (`id`), + KEY `perm` (`perm`), + KEY `channel_id` (`channel_id`), + KEY `perm_limit` (`perm_limit`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + $r = $r1; + } + + $r1 = q("select * from channel where true"); + if($r1) { + foreach($r1 as $rr) { + perm_limits_upgrade($rr); + } + } + + $r2 = q("select * from abook where true"); + if($r2) { + foreach($r2 as $rr) { + perm_abook_upgrade($rr); + } + } + + $r = $r && $r1 && $r2; + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + } \ No newline at end of file -- cgit v1.2.3