more work on x permissions

This commit is contained in:
redmatrix
2016-07-03 17:10:00 -07:00
parent 57226b2e13
commit c918bbba25
3 changed files with 139 additions and 0 deletions

View File

@@ -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;
}