Pārlūkot izejas kodu

Merge branch 'master' of https://github.com/unacms/una

AntonLV 1 gadu atpakaļ
vecāks
revīzija
6fc91452bd

+ 1 - 1
inc/classes/BxDolSession.php

@@ -8,7 +8,7 @@
  */
 
 if (!defined('BX_DOL_SESSION_IDLE_TIMEOUT'))
-    define('BX_DOL_SESSION_IDLE_TIMEOUT', 1*24*60*60);
+    define('BX_DOL_SESSION_IDLE_TIMEOUT', 2*24*60*60);
 if (!defined('BX_DOL_SESSION_IDLE_TIMEOUT_GUESTS'))
     define('BX_DOL_SESSION_IDLE_TIMEOUT_GUESTS', 4*60*60);
 if (!defined('BX_DOL_SESSION_SKIP_UPDATE'))

+ 17 - 1
inc/js/classes/BxDolLiveUpdates.js

@@ -19,6 +19,7 @@ function BxDolLiveUpdates(oOptions)
     this._iIndex = 0;
     this._iHandler = 0;
     this._bBusy = false;
+    this._lastInactiveRun = 0;
 
     this.init();
 }
@@ -69,8 +70,23 @@ BxDolLiveUpdates.prototype.destroy = function() {
 };
 
 BxDolLiveUpdates.prototype.perform = function() {
-	if(!this._bServerRequesting || this._bBusy || ('undefined' !== typeof(document.hidden) && document.hidden))
+
+    // if request already in progress, skip
+	if (!this._bServerRequesting || this._bBusy) {
 		return;
+    }
+
+    if ('undefined' !== typeof(document.hidden) && document.hidden) {
+        // when hidden → allow execution only every 2h
+        const now = Date.now();
+        if (now - this._lastInactiveRun < 2 * 60 * 60 * 1000) {
+            return; // not yet 2 hours
+        }
+        this._lastInactiveRun = now;
+    } else {
+        // when visible → reset timer
+        this._lastInactiveRun = 0;
+    }
 
 	var $this = this;
 	var oDate = new Date();

+ 6 - 2
modules/boonex/profiler/classes/BxProfiler.php

@@ -363,13 +363,17 @@ class BxProfiler extends BxDol
         $sTime = $this->_formatTime($this->_getCurrentDelay (), 3);
         if (function_exists('memory_get_usage'))
             $sMemory = $this->_formatBytes(memory_get_usage(true)) . ' of ' . ini_get('memory_limit') . ' allowed';
-
+        $aLoad = sys_getloadavg();
+        $sLoad = implode(',', array_map(function ($f) {
+            return round ($f, 2);
+        }, $aLoad));
         return $this->oTemplate->plank(
             $this->oTemplate->nameValue('Time:', $sTime) .
             (function_exists('memory_get_usage') ? $this->oTemplate->nameValue('Memory:', $sMemory) : '') .
             $this->oTemplate->nameValue('PHP:', phpversion()) .
             $this->oTemplate->nameValue('SAPI:', php_sapi_name()) .
-            $this->oTemplate->nameValue('OS:', php_uname('s r m'))
+            $this->oTemplate->nameValue('OS:', php_uname('s r m')) .
+            $this->oTemplate->nameValue('Avg load:', $sLoad)
         );
     }