From 6ea673741cea38c926e48f3fc6e4d0f2cd971a1d Mon Sep 17 00:00:00 2001 From: Javier Roman Date: Tue, 11 Apr 2023 13:35:47 +0200 Subject: [PATCH] Add reload urls method --- .idea/workspace.xml | 57 +++++++++++++++++++++++++++++++++++++++++++++ src/Sifo/Config.php | 4 ++-- src/Sifo/Urls.php | 10 ++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..9ad43213 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,57 @@ + + + + + + + + + + $PROJECT_DIR$/composer.json + + + + + + + + + + + + + + + 1681212321240 + + + + + + \ No newline at end of file diff --git a/src/Sifo/Config.php b/src/Sifo/Config.php index a0f98f9e..6175219a 100644 --- a/src/Sifo/Config.php +++ b/src/Sifo/Config.php @@ -94,7 +94,7 @@ protected function __construct( $instance_name ) * @param string $instance_name Instance Name, needed to determine correct paths. * @return Config */ - public static function getInstance( $instance_name = null ) + public static function getInstance( $instance_name = null, $force = false ) { // Load instance from bootsrap if ( !isset( $instance_name ) ) @@ -102,7 +102,7 @@ public static function getInstance( $instance_name = null ) $instance_name = Bootstrap::$instance; } - if ( !isset ( self::$instance[$instance_name] ) ) + if ( !isset ( self::$instance[$instance_name] ) || $force === true ) { self::$instance[$instance_name] = new self( $instance_name ); } diff --git a/src/Sifo/Urls.php b/src/Sifo/Urls.php index 91dce9bf..18d226c4 100644 --- a/src/Sifo/Urls.php +++ b/src/Sifo/Urls.php @@ -276,6 +276,16 @@ public function getUrlConfig() return $this->url_instance_config; } + public function reloadUrlConfig($instance_name = null) + { + if ( null === $instance_name ) + { + $instance_name = Bootstrap::$instance; + } + + self::$instance[$instance_name] = new Urls( $instance_name ); + } + /** * Returns information that helps to determine how urls must be processed. *