]> git.mxchange.org Git - friendica.git/commitdiff
check if value is set
authorPhilipp Holzer <admin@philipp.info>
Mon, 18 Feb 2019 07:51:38 +0000 (08:51 +0100)
committerPhilipp Holzer <admin@philipp.info>
Mon, 18 Feb 2019 10:29:42 +0000 (11:29 +0100)
get basepath with config instead cache

src/App.php
src/Core/Config/Adapter/JITConfigAdapter.php
src/Core/Config/Configuration.php
src/Core/Worker.php

index f41d486b5cd857c34526f40e84bb870115b28937..f48abcf9cbda92c1238e27083c73497e720da024 100644 (file)
@@ -219,7 +219,7 @@ class App
                $this->logger   = $logger;
                $this->config   = $config;
                $this->profiler = $profiler;
-               $this->basePath = $this->config->getCache()->get('system', 'basepath');
+               $this->basePath = $this->config->get('system', 'basepath');
 
                if (!Core\System::isDirectoryUsable($this->basePath, false)) {
                        throw new Exception('Basepath \'' . $this->basePath . '\' isn\'t usable.');
index 95211777f39252d62cb5c0df6b03a53fd8206d52..0c94f812744039c8393d6f3b44380e6ba62fed6c 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace Friendica\Core\Config\Adapter;
 
+use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 
 /**
@@ -57,8 +58,17 @@ class JITConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAdapte
                        // manage array value
                        $value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
 
-                       $this->in_db[$cat][$key] = true;
-                       return $value;
+                       if ($key === 'last_worker_execution') {
+                               Logger::alert('catchmeifyou', ['store' => $value, 'in_db' => $this->in_db[$cat][$key]]);
+                       }
+
+                       if (isset($value) && $value !== '') {
+                               $this->in_db[$cat][$key] = true;
+                               return $value;
+                       } else {
+                               $this->in_db[$cat][$key] = false;
+                               return '!<unset>!';
+                       }
                } else {
 
                        $this->in_db[$cat][$key] = false;
@@ -89,6 +99,10 @@ class JITConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAdapte
                        $this->in_db[$cat][$key] = false;
                }
 
+               if ($key === 'last_worker_execution') {
+                       Logger::alert('catchmeifyou', ['db' => $dbvalue, 'store' => $stored, 'in_db' => $this->in_db[$cat][$key]]);
+               }
+
                if (($stored === $dbvalue) && $this->in_db[$cat][$key]) {
                        return true;
                }
index 2ac0da0ad1b967b0d580f1f559b2d971f3f055e7..48220c2de527cefe23037691413f4a7119c4007a 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Friendica\Core\Config;
 
+use Friendica\Core\Logger;
+
 /**
  * This class is responsible for all system-wide configuration values in Friendica
  * There are two types of storage
@@ -114,6 +116,10 @@ class Configuration
         */
        public function set($cat, $key, $value)
        {
+               if ($key === 'last_worker_execution') {
+                       Logger::alert('catchmeifyou', ['value' => $value]);
+               }
+
                // set the cache first
                $cached = $this->configCache->set($cat, $key, $value);
 
index dff60e9fa5571187a09b913c2dedb7064669be6d..c5d60f14da26333c65e56c418953de5879dcbc28 100644 (file)
@@ -277,6 +277,8 @@ class Worker
                        $age = (time() - self::$last_update) / 60;
                        self::$last_update = time();
 
+                       Logger::alert('last_update', ['age' => $age, 'last_update' => self::$last_update]);
+
                        if ($age > 1) {
                                $stamp = (float)microtime(true);
                                DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);