From f9c1eb2719012eabcf85ce8ff26f929715685fed Mon Sep 17 00:00:00 2001 From: rldhont Date: Fri, 4 Jul 2025 20:42:49 +0200 Subject: [PATCH 1/2] PHP: Well deprecate lizmapRepository class The lizmapRepository class now extends \Lizmap\Project\Repository. --- .../lizmap/classes/lizmapRepository.class.php | 197 +----------------- 1 file changed, 1 insertion(+), 196 deletions(-) diff --git a/lizmap/modules/lizmap/classes/lizmapRepository.class.php b/lizmap/modules/lizmap/classes/lizmapRepository.class.php index df15743b1e..48dfb5dd43 100644 --- a/lizmap/modules/lizmap/classes/lizmapRepository.class.php +++ b/lizmap/modules/lizmap/classes/lizmapRepository.class.php @@ -1,8 +1,5 @@ array( - 'fieldType' => 'text', - 'required' => true, - ), - 'label' => array( - 'fieldType' => 'text', - 'required' => true, - ), - 'allowUserDefinedThemes' => array( - 'fieldType' => 'checkbox', - 'required' => false, - ), - 'accessControlAllowOrigin' => array( - 'fieldType' => 'text', - 'required' => false, - ), - 'iframeEmbedAllowOrigin' => array( - 'fieldType' => 'text', - 'required' => false, - ), - ); - - /** - * @var Repository The repository instance - */ - protected $repo; - - /** - * lizmapRepository Constructor - * Do not call it, if you want to instanciate a lizmapRepository, you should - * do it with the lizmapServices::getLizmapRepository method. - * - * @param string $key the name of the repository - * @param array $data the repository data - * @param string $varPath the configuration files folder path - * @param mixed $context - * @param mixed $services - */ - public function __construct($key, $data, $varPath, $context, $services) - { - $this->repo = new Repository($key, $data, $varPath, $context, $services); - } - - public function getKey() - { - return $this->repo->getKey(); - } - - public function getPath() - { - return $this->repo->getPath(); - } - - public function getOriginalPath() - { - return $this->repo->getOriginalPath(); - } - - public function getLabel() - { - return $this->repo->getLabel(); - } - - public function allowUserDefinedThemes() - { - return $this->repo->allowUserDefinedThemes(); - } - - public static function getProperties() - { - return self::$properties; - } - - public static function getRepoProperties() - { - return self::$propertiesOptions; - } - - public function getPropertiesOptions() - { - return $this->repo::getPropertiesOptions(); - } - - public function getData($key) - { - return $this->repo->getData($key); - } - - /** - * Update a repository in a \Jelix\IniFile\IniModifier object. - * - * @param array $data the repository data - * @param IniModifier $ini the object to edit the ini file - * - * @return bool true if there is at least one valid data in $data - */ - public function update($data, $ini) - { - return $this->repo->update($data, $ini); - } - - /** - * Get a project by key. - * - * @param string $key the project key - * @param bool $keepReference if we need to keep reference in projectInstances - * - * @return null|Project null if it does not exist - */ - public function getProject($key, $keepReference = true) - { - return $this->repo->getProject($key, $keepReference); - } - - /** - * Get the repository projects. - * - * @return Project[] - */ - public function getProjects() - { - return $this->repo->getProjects(); - } - - /** - * Get the repository projects metadata. - * - * @param bool $checkAcl If the ACL must be checked, according to the current user, default to true - * - * @return ProjectMetadata[] - */ - public function getProjectsMetadata($checkAcl = true) - { - return $this->repo->getProjectsMetadata($checkAcl); - } - - public function getProjectsMainData() - { - return $this->repo->getProjectsMainData(); - } - - /** - * Return the value of the Access-Control-Allow-Origin HTTP header. - * - * @param $referer The referer - * - * @return string the value of the ACAO header. If empty, the header should not be set. - */ - public function getACAOHeaderValue($referer) - { - return $this->repo->getACAOHeaderValue($referer); - } - - /** - * Check if the referer is allowed to embed iframe. - * - * @param $referer The referer - * - * @return bool is the referer allowed to embed iframe - */ - public function checkRefererEmbededIframe($referer): bool - { - return $this->repo->checkRefererEmbededIframe($referer); - } - - public function hasValidPath() - { - return $this->repo->getPath() !== false; - } -} +class lizmapRepository extends Repository {} From 73f635e0fbbaa86c4143b02a9b8b0c6625728c7f Mon Sep 17 00:00:00 2001 From: rldhont Date: Fri, 5 Dec 2025 16:46:52 +0100 Subject: [PATCH 2/2] PHP: Remove lizmapRepository class --- .../lizmap/classes/lizmapRepository.class.php | 20 ------------------- lizmap/modules/lizmap/module.xml | 1 - 2 files changed, 21 deletions(-) delete mode 100644 lizmap/modules/lizmap/classes/lizmapRepository.class.php diff --git a/lizmap/modules/lizmap/classes/lizmapRepository.class.php b/lizmap/modules/lizmap/classes/lizmapRepository.class.php deleted file mode 100644 index 48dfb5dd43..0000000000 --- a/lizmap/modules/lizmap/classes/lizmapRepository.class.php +++ /dev/null @@ -1,20 +0,0 @@ - -