diff --git a/globals/Dependencies/Client/ClientSettings.php b/globals/Dependencies/Client/ClientSettings.php index 6ce51d1..6dda81f 100644 --- a/globals/Dependencies/Client/ClientSettings.php +++ b/globals/Dependencies/Client/ClientSettings.php @@ -409,6 +409,16 @@ namespace Alphaland\Client { $combinedDependencies = self::GetApplicationSettings($applicationName); foreach ($currentDependencies as $dependency) { + // skip it if it doesn't exist just to be safe + if (!self::ApplicationExists($dependency)) { + continue; + } + + // Check if the dependency has a dep on us already + if (self::ApplicationHasDependency($dependency, $applicationName)) { + continue; + } + if ($recursive && self::ApplicationHasAnyDependencies($dependency)) { $combinedDependencies = array_merge($combinedDependencies, self::FetchCombinedApplicationDependencies($dependency, $recursive)); } else { @@ -464,7 +474,7 @@ namespace Alphaland\Client { /** * The client settings kind. */ - class ClientSettingsKind + abstract class ClientSettingsKind { public const Unscoped = "Unscoped"; public const FastLog = "FastLog"; diff --git a/globals/Dependencies/Web/WebsiteSettings.php b/globals/Dependencies/Web/WebsiteSettings.php index 4d4b359..293c723 100644 --- a/globals/Dependencies/Web/WebsiteSettings.php +++ b/globals/Dependencies/Web/WebsiteSettings.php @@ -15,7 +15,7 @@ namespace Alphaland\Web { use PDO; - class WebsiteSettings + /* public static */ class WebsiteSettings { // default return if no settings are found // because there may be a NULL value in the database @@ -99,6 +99,24 @@ namespace Alphaland\Web { return self::ConvertStringToValue($result['value'], $result['type']); } + /** + * Gets or sets the value of a website setting. + * + * @param string $name The name of the setting. + * @param mixed $value The value of the setting. + * @param string $type The type of the setting. + * + * @return mixed The value of the setting. + */ + public static function GetOrCreateSetting(string $name, $value = null, string $type = null) + { + if (!self::SettingExists($name)) { + self::UpdateSetting($name, $value, $type); + } + + return self::GetSetting($name); + } + /** * Sets a website setting. *