Commit dc0490a7 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-986 Added option to completely disable the TopCollector.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 19824533
...@@ -132,6 +132,10 @@ class TopCollector extends InterProcessData { ...@@ -132,6 +132,10 @@ class TopCollector extends InterProcessData {
* @return boolean * @return boolean
*/ */
public function AnnounceInformation($addinfo, $preserve = false, $terminating = false) { public function AnnounceInformation($addinfo, $preserve = false, $terminating = false) {
if (defined('TOPCOLLECTOR_DISABLED') && constant('TOPCOLLECTOR_DISABLED') === true) {
return true;
}
$this->latest["addinfo"] = $addinfo; $this->latest["addinfo"] = $addinfo;
$this->latest["update"] = time(); $this->latest["update"] = time();
......
...@@ -78,7 +78,7 @@ include_once(ZPUSH_CONFIG); ...@@ -78,7 +78,7 @@ include_once(ZPUSH_CONFIG);
system("stty sane"); system("stty sane");
} }
else else
echo "Z-Push shared memory interprocess communication is not available.\n"; echo "Z-Push interprocess communication (IPC) is not available or TopCollector is disabled.\n";
} }
catch (ZPushException $zpe) { catch (ZPushException $zpe) {
fwrite(STDERR, get_class($zpe) . ": ". $zpe->getMessage() . "\n"); fwrite(STDERR, get_class($zpe) . ": ". $zpe->getMessage() . "\n");
...@@ -219,6 +219,9 @@ class ZPushTop { ...@@ -219,6 +219,9 @@ class ZPushTop {
* @return boolean * @return boolean
*/ */
public function IsAvailable() { public function IsAvailable() {
if (defined('TOPCOLLECTOR_DISABLED') && constant('TOPCOLLECTOR_DISABLED') === true) {
return false;
}
return $this->topCollector->IsActive(); return $this->topCollector->IsActive();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment