aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-07-28 13:15:10 -0700
committerredmatrix <git@macgirvin.com>2016-07-28 13:15:10 -0700
commit35f17acb388f68745068d6a60e12c7b777b92282 (patch)
treec27819dec82394a68699d8f4de1a5625b5f1c571 /boot.php
parent58cf5f310d89026fb526e201c301075725044e48 (diff)
parent47e1c4e059303167b173a10b986086d3c00c8384 (diff)
downloadvolse-hubzilla-35f17acb388f68745068d6a60e12c7b777b92282.tar.gz
volse-hubzilla-35f17acb388f68745068d6a60e12c7b777b92282.tar.bz2
volse-hubzilla-35f17acb388f68745068d6a60e12c7b777b92282.zip
Merge branch '1.10RC' of https://github.com/redmatrix/hubzilla into 1.10RC_merge
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php71
1 files changed, 68 insertions, 3 deletions
diff --git a/boot.php b/boot.php
index 7974ce9ed..a6cc23c9f 100755
--- a/boot.php
+++ b/boot.php
@@ -44,10 +44,10 @@ require_once('include/account.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
-define ( 'STD_VERSION', '1.10RC' );
+define ( 'STD_VERSION', '1.11' );
define ( 'ZOT_REVISION', '1.1' );
-define ( 'DB_UPDATE_VERSION', 1180 );
+define ( 'DB_UPDATE_VERSION', 1181 );
/**
@@ -765,6 +765,7 @@ class App {
public static $pdl = null; // Comanche page description
private static $perms = null; // observer permissions
private static $widgets = array(); // widgets for this page
+ public static $config = array(); // config cache
public static $session = null;
public static $groups;
@@ -774,7 +775,6 @@ class App {
public static $plugins_admin;
public static $module_loaded = false;
public static $query_string;
- public static $config; // config cache
public static $page;
public static $profile;
public static $user;
@@ -1551,6 +1551,9 @@ function check_config(&$a) {
load_hooks();
+
+ check_for_new_perms();
+
check_cron_broken();
}
@@ -2440,6 +2443,67 @@ function cert_bad_email() {
}
+function check_for_new_perms() {
+
+ $pregistered = get_config('system','perms');
+ $pcurrent = array_keys(\Zotlabs\Access\Permissions::Perms());
+
+ if(! $pregistered) {
+ set_config('system','perms',$pcurrent);
+ return;
+ }
+
+ $found_new_perm = false;
+
+ foreach($pcurrent as $p) {
+ if(! in_array($p,$pregistered)) {
+ $found_new_perm = true;
+ // for all channels
+ $c = q("select channel_id from channel where true");
+ if($c) {
+ foreach($c as $cc) {
+ // get the permission role
+ $r = q("select v from pconfig where uid = %d and cat = 'system' and k = 'permissions_role'",
+ intval($cc['uid'])
+ );
+ if($r) {
+ // get a list of connections
+ $x = q("select abook_xchan from abook where abook_channel = %d and abook_self = 0",
+ intval($cc['uid'])
+ );
+ // get the permissions role details
+ $rp = \Zotlabs\Access\PermissionRoles::role_perms($r[0]['v']);
+ if($rp) {
+ // set the channel limits if appropriate or 0
+ if(array_key_exists('limits',$rp) && array_key_exists($p,$rp['limits'])) {
+ \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,$rp['limits'][$p]);
+ }
+ else {
+ \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,0);
+ }
+
+ $set = ((array_key_exists('perms_connect',$rp) && array_key_exists($p,$rp['perms_connect'])) ? true : false);
+ // foreach connection set to the perms_connect value
+ if($x) {
+ foreach($x as $xx) {
+ set_abconfig($cc['uid'],$xx['abook_xchan'],'my_perms',$p,intval($set));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // We should probably call perms_refresh here, but this should get pushed in 24 hours and there is no urgency
+ if($found_new_perm)
+ set_config('system','perms',$pcurrent);
+
+}
+
+
+
/**
* @brief Send warnings every 3-5 days if cron is not running.
*/
@@ -2449,6 +2513,7 @@ function check_cron_broken() {
if((! $d) || ($d < datetime_convert('UTC','UTC','now - 4 hours'))) {
Zotlabs\Daemon\Master::Summon(array('Cron'));
+ set_config('system','lastcron',datetime_convert());
}
$t = get_config('system','lastcroncheck');