This commit is contained in:
Bastian Allgeier
2019-01-14 10:52:45 +01:00
parent 01277f79f2
commit 8070893b64
22 changed files with 482 additions and 351 deletions

View File

@@ -177,16 +177,7 @@ class App
public function apply(string $name, $value)
{
if ($functions = $this->extension('hooks', $name)) {
static $applied = [];
foreach ($functions as $function) {
if (in_array($function, $applied[$name] ?? []) === true) {
continue;
}
// mark the hook as triggered, to avoid endless loops
$applied[$name][] = $function;
// bind the App object to the hook
$value = $function->call($this, $value);
}

View File

@@ -387,7 +387,7 @@ trait AppPlugins
$this->extendCacheTypes([
'apcu' => 'Kirby\Cache\ApcuCache',
'file' => 'Kirby\Cache\FileCache',
'memcached' => 'Kirby\Cache\MemCache',
'memcached' => 'Kirby\Cache\MemCached',
]);
$this->extendComponents(include static::$root . '/config/components.php');

View File

@@ -7,6 +7,7 @@ use Kirby\Exception\InvalidArgumentException;
use Kirby\Exception\NotFoundException;
use Kirby\Data\Data;
use Kirby\Form\Field;
use Kirby\Toolkit\A;
use Kirby\Toolkit\F;
use Kirby\Toolkit\I18n;
use Kirby\Toolkit\Obj;
@@ -197,10 +198,10 @@ class Blueprint
if ($mixin === null) {
$props = $props;
} elseif (is_array($mixin) === true) {
$props = array_replace_recursive($mixin, $props);
$props = A::merge($mixin, $props, A::MERGE_REPLACE);
} else {
try {
$props = array_replace_recursive(Data::read($mixin), $props);
$props = A::merge(Data::read($mixin), $props, A::MERGE_REPLACE);
} catch (Exception $e) {
$props = $props;
}

View File

@@ -91,11 +91,11 @@ trait HasChildren
}
/**
* Return all drafts for the site
* Return all drafts of the model
*
* @return Pages
*/
public function drafts(): Pages
public function drafts()
{
if (is_a($this->drafts, 'Kirby\Cms\Pages') === true) {
return $this->drafts;

View File

@@ -191,10 +191,6 @@ class System
*/
public function isOk(): bool
{
if ($this->isInstallable() === false) {
return false;
}
return in_array(false, array_values($this->status()), true) === false;
}

View File

@@ -337,6 +337,16 @@ class Database
return $this->lastError;
}
/**
* Returns the name of the database
*
* @return string|null
*/
public function name(): ?string
{
return $this->database;
}
/**
* Private method to execute database queries.
* This is used by the query() and execute() methods

View File

@@ -72,7 +72,7 @@ class Sql
return [
'query' => $query,
'bindings' => [
$databaseBinding => $this->database->database,
$databaseBinding => $this->database->name(),
$tableBinding => $table,
]
];
@@ -696,7 +696,7 @@ class Sql
return [
'query' => 'SELECT TABLE_NAME AS name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ' . $binding,
'bindings' => [
$binding => $this->database->database
$binding => $this->database->name()
]
];
}