Fixing value check for configuration
This commit is contained in:
parent
86aaa6565e
commit
f536107911
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Friendica\Core\Config\Adapter;
|
namespace Friendica\Core\Config\Adapter;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,23 +57,15 @@ class JITConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAdapte
|
||||||
// manage array value
|
// manage array value
|
||||||
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
|
$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 !== '') {
|
if (isset($value) && $value !== '') {
|
||||||
$this->in_db[$cat][$key] = true;
|
$this->in_db[$cat][$key] = true;
|
||||||
return $value;
|
return $value;
|
||||||
} else {
|
|
||||||
$this->in_db[$cat][$key] = false;
|
|
||||||
return '!<unset>!';
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
$this->in_db[$cat][$key] = false;
|
$this->in_db[$cat][$key] = false;
|
||||||
return '!<unset>!';
|
return '!<unset>!';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
@ -99,10 +90,6 @@ class JITConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAdapte
|
||||||
$this->in_db[$cat][$key] = false;
|
$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]) {
|
if (($stored === $dbvalue) && $this->in_db[$cat][$key]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,14 +57,15 @@ class JITPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfigAdap
|
||||||
// manage array value
|
// manage array value
|
||||||
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']);
|
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']);
|
||||||
|
|
||||||
|
if (isset($value) && $value !== '') {
|
||||||
$this->in_db[$uid][$cat][$key] = true;
|
$this->in_db[$uid][$cat][$key] = true;
|
||||||
return $value;
|
return $value;
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->in_db[$uid][$cat][$key] = false;
|
$this->in_db[$uid][$cat][$key] = false;
|
||||||
return '!<unset>!';
|
return '!<unset>!';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
|
@ -55,12 +55,13 @@ class PreloadConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAd
|
||||||
// manage array value
|
// manage array value
|
||||||
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
|
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
|
||||||
|
|
||||||
|
if (isset($value) && $value !== '') {
|
||||||
return $value;
|
return $value;
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return '!<unset>!';
|
return '!<unset>!';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
|
@ -71,11 +71,12 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
||||||
// manage array value
|
// manage array value
|
||||||
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
|
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
|
||||||
|
|
||||||
|
if (isset($value) && $value !== '') {
|
||||||
return $value;
|
return $value;
|
||||||
} else {
|
|
||||||
return '!<unset>!';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return '!<unset>!';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Friendica\Core\Config;
|
namespace Friendica\Core\Config;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is responsible for all system-wide configuration values in Friendica
|
* This class is responsible for all system-wide configuration values in Friendica
|
||||||
* There are two types of storage
|
* There are two types of storage
|
||||||
|
@ -116,10 +114,6 @@ class Configuration
|
||||||
*/
|
*/
|
||||||
public function set($cat, $key, $value)
|
public function set($cat, $key, $value)
|
||||||
{
|
{
|
||||||
if ($key === 'last_worker_execution') {
|
|
||||||
Logger::alert('catchmeifyou', ['value' => $value]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the cache first
|
// set the cache first
|
||||||
$cached = $this->configCache->set($cat, $key, $value);
|
$cached = $this->configCache->set($cat, $key, $value);
|
||||||
|
|
||||||
|
|
|
@ -277,8 +277,6 @@ class Worker
|
||||||
$age = (time() - self::$last_update) / 60;
|
$age = (time() - self::$last_update) / 60;
|
||||||
self::$last_update = time();
|
self::$last_update = time();
|
||||||
|
|
||||||
Logger::alert('last_update', ['age' => $age, 'last_update' => self::$last_update]);
|
|
||||||
|
|
||||||
if ($age > 1) {
|
if ($age > 1) {
|
||||||
$stamp = (float)microtime(true);
|
$stamp = (float)microtime(true);
|
||||||
DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
|
DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
|
||||||
|
|
Loading…
Reference in a new issue