Skip to content

Commit 7920748

Browse files
committed
improv. add function to get db type
1 parent a77ee83 commit 7920748

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

app/Controller/AppController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,9 @@ public function __initSeoConfiguration()
555555
$get_page = [];
556556
$condition = ["'" . $current_url . "' LIKE CONCAT(page, '%')"];
557557

558-
$db_type = $this->Util->getDBType();
558+
$use_sqlite = $this->Util->useSqlite();
559559

560-
if (strpos(strtolower($db_type), "sqlite"))
560+
if ($use_sqlite)
561561
$condition = ["'" . $current_url . "' LIKE 'page' || '%' "];
562562
$check = $this->Seo->find('all', ['conditions' => $condition]);
563563

app/Controller/Component/UtilComponent.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,5 +356,11 @@ public function getDBType()
356356
return $this->db_type;
357357
}
358358

359+
public function useSqlite() {
360+
if (strpos(strtolower($this->getDBType()), "sqlite"))
361+
return true;
362+
return false;
363+
}
364+
359365

360366
}

app/Model/Maintenance.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ class Maintenance extends AppModel
44
{
55
function checkMaintenance($url, $utilComponent)
66
{
7-
$db_type = $utilComponent->getDBType();
7+
$use_sqlite = $utilComponent->useSqlite();
88

99
$condition = ["'" . $url . "' LIKE CONCAT(Maintenance.url, '%')", "active" => 1];
1010

11-
if (strpos(strtolower($db_type), "sqlite"))
11+
if ($use_sqlite)
1212
$condition = ["'" . $url . "' LIKE 'Maintenance.url' || '%')", "active" => 1];
1313

1414
$check = $this->find("first", ["conditions" => $condition]);

0 commit comments

Comments
 (0)