]> git.mxchange.org Git - friendica.git/commitdiff
Fixing value check for configuration
authorPhilipp Holzer <admin@philipp.info>
Mon, 18 Feb 2019 10:27:51 +0000 (11:27 +0100)
committerPhilipp Holzer <admin@philipp.info>
Mon, 18 Feb 2019 10:29:51 +0000 (11:29 +0100)
src/Core/Config/Adapter/JITConfigAdapter.php
src/Core/Config/Adapter/JITPConfigAdapter.php
src/Core/Config/Adapter/PreloadConfigAdapter.php
src/Core/Config/Adapter/PreloadPConfigAdapter.php
src/Core/Config/Configuration.php
src/Core/Worker.php

index 0c94f812744039c8393d6f3b44380e6ba62fed6c..5d06dc2b3e73f6879e69da1340aa50c9dc8dde83 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 namespace Friendica\Core\Config\Adapter;
 
-use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 
 /**
@@ -58,22 +57,14 @@ class JITConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAdapte
                        // manage array value
                        $value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
 
-                       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;
-                       return '!<unset>!';
                }
+
+               $this->in_db[$cat][$key] = false;
+               return '!<unset>!';
        }
 
        /**
@@ -99,10 +90,6 @@ 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 c5f3a381ed0044a1f673e90f85e872f6f20a3fe7..d3c38623b43d8794acea014e554ab8e9342e4b28 100644 (file)
@@ -57,13 +57,14 @@ class JITPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfigAdap
                        // manage array value
                        $value = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']);
 
-                       $this->in_db[$uid][$cat][$key] = true;
-                       return $value;
-               } else {
-
-                       $this->in_db[$uid][$cat][$key] = false;
-                       return '!<unset>!';
+                       if (isset($value) && $value !== '') {
+                               $this->in_db[$uid][$cat][$key] = true;
+                               return $value;
+                       }
                }
+
+               $this->in_db[$uid][$cat][$key] = false;
+               return '!<unset>!';
        }
 
        /**
index fa691a16d353443ce1630204ab04607807909bd7..b1866a259d86567ed5fe4324dc87650925bb636b 100644 (file)
@@ -55,11 +55,12 @@ class PreloadConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAd
                        // manage array value
                        $value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
 
-                       return $value;
-               } else {
-
-                       return '!<unset>!';
+                       if (isset($value) && $value !== '') {
+                               return $value;
+                       }
                }
+
+               return '!<unset>!';
        }
 
        /**
index e79a4a1e3cbb93dbfe09d839b9a2d48bf204487f..857f2b17664035e83d99dda28e5f654fec90de5a 100644 (file)
@@ -71,10 +71,11 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
                        // manage array value
                        $value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
 
-                       return $value;
-               } else {
-                       return '!<unset>!';
+                       if (isset($value) && $value !== '') {
+                               return $value;
+                       }
                }
+               return '!<unset>!';
        }
 
        /**
index 48220c2de527cefe23037691413f4a7119c4007a..2ac0da0ad1b967b0d580f1f559b2d971f3f055e7 100644 (file)
@@ -2,8 +2,6 @@
 
 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
@@ -116,10 +114,6 @@ 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 13db8d97e8b7bbd33aac36282be41d73c5dc9477..4007a7923cae2dda94ec8f3af051ebc1551b4e27 100644 (file)
@@ -277,8 +277,6 @@ 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]);