Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Update packages :)
-> Finish caches
-> Removed ol settings profiler
  • Loading branch information
NaysKutzu committed Aug 6, 2024
1 parent 99fd7ca commit ce01f6c
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 88 deletions.
Empty file modified FIRST_INSTALL
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,8 @@
/**
* DEPRECATED: Use Settings class instead!!
*/
class SettingsManager
class DBSettingsManager
{
/**
* DEPRECATED: Use Settings class instead!!
*
* Get a setting from the database!
*
* @param string $category The category of the setting you want to get!
* @param string $key The key of the setting you want to get!
*
* @return string|null Incase if found then return the value else return null!
*/
public static function get(string $category, string $key): ?string
{
if (self::exists($category, $key)) {
$mysql = new MySQL();
$conn = $mysql->connectMYSQLI();
$stmt = $conn->prepare('SELECT `svalue` FROM framework_settings WHERE `skey` = ? AND `scategory` = ?');
$stmt->bind_param('ss', $key, $category);
$stmt->execute();
$stmt->bind_result($value);
$stmt->fetch();
$stmt->close();

return $value;
} else {
return null;
}
}

/**
* DEPRECATED: Use Settings class instead!!
* Set a setting in the database!
Expand Down
2 changes: 1 addition & 1 deletion app/Managers/LanguageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static function getLang(): mixed
try {
$fallback_lang = __DIR__ . '/../../lang/en_US.php';
if (file_exists($fallback_lang)) {
$langConfig = SettingsManager::get('app', 'lang');
$langConfig = Settings::getSetting('app', 'lang');
if (!$langConfig == '') {
$langFilePath = __DIR__ . '/../../lang/' . $langConfig . '.php';
if (file_exists($langFilePath)) {
Expand Down
2 changes: 1 addition & 1 deletion app/Managers/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function getSetting(string $category, string $name): ?string
*/
public static function updateSetting(string $category, string $name, string $value, bool $updateCache = true): void
{
SettingsManager::update($category, $name, $value);
DBSettingsManager::update($category, $name, $value);
if ($updateCache) {
MySQLCache::saveCache('framework_settings');
}
Expand Down
96 changes: 48 additions & 48 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use MythicalSystemsFramework\Database\MySQL;
use MythicalSystemsFramework\Managers\ConfigManager;
use MythicalSystemsFramework\Managers\SettingsManager as settings;
use MythicalSystemsFramework\Database\exception\database\MySQLError;
use MythicalSystemsFramework\Managers\DBSettingsManager as settings;
use MythicalSystemsFramework\Database\exception\migration\NoMigrationsFound;

ini_set('display_errors', 0);
Expand Down
2 changes: 1 addition & 1 deletion migrate/config/1.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use MythicalSystemsFramework\Managers\SettingsManager as settings;
use MythicalSystemsFramework\Managers\DBSettingsManager as settings;

settings::set('app', 'name', 'MythicalSystems');
settings::set('app', 'logo', 'https://avatars.githubusercontent.com/u/117385445');
Expand Down
2 changes: 1 addition & 1 deletion migrate/config/2.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

use MythicalSystemsFramework\Managers\SettingsManager as settings;
use MythicalSystemsFramework\Managers\DBSettingsManager as settings;

settings::set('caches', 'max_query_last_time', '600');
2 changes: 1 addition & 1 deletion migrate/config/3.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

use MythicalSystemsFramework\Managers\SettingsManager as settings;
use MythicalSystemsFramework\Managers\DBSettingsManager as settings;

settings::set('caches', 'settings_cache_life', '3600');
Loading

0 comments on commit ce01f6c

Please sign in to comment.