From 6748fd95ed0891c46a70db48e871c45acfd471b1 Mon Sep 17 00:00:00 2001 From: aB0t Date: Sat, 13 Apr 2024 20:01:28 +0200 Subject: [PATCH] update 2024-04-13 20:01:28 --- .../README.md | 38 ++---- .../code.php | 110 +++--------------- .../code.power | 110 +++--------------- .../code.php | 4 +- .../code.power | 4 +- .../code.php | 4 +- .../code.power | 4 +- .../README.md | 32 +++++ .../code.php | 56 +++++++++ .../code.power | 56 +++++++++ 10 files changed, 189 insertions(+), 229 deletions(-) diff --git a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/README.md b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/README.md index 0fe464c..c2122ef 100644 --- a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/README.md +++ b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/README.md @@ -18,13 +18,11 @@ class Config #Gold { # getAddcustomgiteaurl() : int # getCustomgiteaurl() : ?string # getCustomgiteatoken() : ?string - # getSuperpowerscoreorganisation() : string - # getSuperpowersinitrepos() : array + # getJoomlapowerscoreorganisation() : string + # getJoomlapowersinitrepos() : array # getTmppath() : string - # getAddsuperpowers() : bool - # getAddownpowers() : bool - # getLocalpowersrepositorypath() : string - # getApprovedpaths() : array + # getLocaljoomlapowersrepositorypath() : string + # getApprovedjoomlapaths() : array } note right of Config::__construct @@ -66,15 +64,15 @@ note right of Config::getCustomgiteatoken return: ?string end note -note left of Config::getSuperpowerscoreorganisation +note left of Config::getJoomlapowerscoreorganisation Get super power core organisation since: 3.2.0 return: string end note -note right of Config::getSuperpowersinitrepos - Get super power init repos +note right of Config::getJoomlapowersinitrepos + Get Joomla power init repos since: 3.2.0 return: array @@ -87,29 +85,15 @@ note left of Config::getTmppath return: string end note -note right of Config::getAddsuperpowers - Get switch to add super powers - - since: 3.2.0 - return: bool -end note - -note left of Config::getAddownpowers - Get switch to add own super powers - - since: 3.2.0 - return: bool -end note - -note right of Config::getLocalpowersrepositorypath - Get local super powers repository path +note right of Config::getLocaljoomlapowersrepositorypath + Get local joomla super powers repository path since: 3.2.0 return: string end note -note left of Config::getApprovedpaths - Get super power approved paths +note left of Config::getApprovedjoomlapaths + Get joomla power approved paths since: 3.2.0 return: array diff --git a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php index e5e395e..b9bb447 100644 --- a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php +++ b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php @@ -117,56 +117,25 @@ class Config extends BaseConfig * @return string The super power core organisation * @since 3.2.0 */ - protected function getSuperpowerscoreorganisation(): string + protected function getJoomlapowerscoreorganisation(): string { // the VDM default organisation is [joomla] $organisation = 'joomla'; - if ($this->add_custom_gitea_url == 2) - { - return $this->params->get('super_powers_core_organisation', $organisation); - } - - return $organisation; + return $this->params->get('joomla_powers_core_organisation', $organisation); } /** - * Get super power init repos + * Get Joomla power init repos * * @return array The init repositories on Gitea * @since 3.2.0 */ - protected function getSuperpowersinitrepos(): array + protected function getJoomlapowersinitrepos(): array { // some defaults repos we need by JCB $repos = []; - - // only add custom init with custom gitea - $paths = null; - if ($this->add_custom_gitea_url == 2) - { - $paths = $this->params->get('super_powers_init_repos'); - } - - if (!empty($paths) && is_array($paths)) - { - foreach ($paths as $path) - { - $owner = $path->owner ?? null; - $repo = $path->repo ?? null; - if ($owner !== null && $repo !== null) - { - // we make sure to get only the objects - $repos = ["{$owner}.{$repo}" => $path] + $repos; - } - } - } - else - { - $repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master']; - $repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master']; - $repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master']; - } + $repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master']; return $repos; } @@ -184,81 +153,28 @@ class Config extends BaseConfig } /** - * Get switch to add super powers - * - * @return bool Switch to add super powers - * @since 3.2.0 - */ - protected function getAddsuperpowers(): bool - { - return (bool) $this->params->get('powers_repository', 0); - } - - /** - * Get switch to add own super powers - * - * @return bool Switch to add own super powers - * @since 3.2.0 - */ - protected function getAddownpowers(): bool - { - if ($this->add_super_powers) - { - return (bool) $this->params->get('super_powers_repositories', 0); - } - - return false; - } - - /** - * Get local super powers repository path + * Get local joomla super powers repository path * * @return string The path to the local repository * @since 3.2.0 */ - protected function getLocalpowersrepositorypath(): string + protected function getLocaljoomlapowersrepositorypath(): string { - $default = $this->tmp_path . '/super_powers'; + $default = $this->tmp_path . '/joomla_powers'; - if (!$this->add_super_powers) - { - return $default; - } - - return $this->params->get('local_powers_repository_path', $default); + return $this->params->get('local_joomla_powers_repository_path', $default); } /** - * Get super power approved paths + * Get joomla power approved paths * - * @return array The approved paths to the repositories on Gitea + * @return array The paths to the repositories on Gitea * @since 3.2.0 */ - protected function getApprovedpaths(): array + protected function getApprovedjoomlapaths(): array { // some defaults repos we need by JCB - $approved = $this->super_powers_init_repos; - - if (!$this->add_own_powers) - { - return array_values($approved); - } - - $paths = $this->params->get('approved_paths'); - - if (!empty($paths)) - { - foreach ($paths as $path) - { - $owner = $path->owner ?? null; - $repo = $path->repo ?? null; - if ($owner !== null && $repo !== null) - { - // we make sure to get only the objects - $approved = ["{$owner}.{$repo}" => $path] + $approved; - } - } - } + $approved = $this->joomla_powers_init_repos; return array_values($approved); } diff --git a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.power b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.power index 8565070..4217cb0 100644 --- a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.power +++ b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.power @@ -83,56 +83,25 @@ * @return string The super power core organisation * @since 3.2.0 */ - protected function getSuperpowerscoreorganisation(): string + protected function getJoomlapowerscoreorganisation(): string { // the VDM default organisation is [joomla] $organisation = 'joomla'; - if ($this->add_custom_gitea_url == 2) - { - return $this->params->get('super_powers_core_organisation', $organisation); - } - - return $organisation; + return $this->params->get('joomla_powers_core_organisation', $organisation); } /** - * Get super power init repos + * Get Joomla power init repos * * @return array The init repositories on Gitea * @since 3.2.0 */ - protected function getSuperpowersinitrepos(): array + protected function getJoomlapowersinitrepos(): array { // some defaults repos we need by JCB $repos = []; - - // only add custom init with custom gitea - $paths = null; - if ($this->add_custom_gitea_url == 2) - { - $paths = $this->params->get('super_powers_init_repos'); - } - - if (!empty($paths) && is_array($paths)) - { - foreach ($paths as $path) - { - $owner = $path->owner ?? null; - $repo = $path->repo ?? null; - if ($owner !== null && $repo !== null) - { - // we make sure to get only the objects - $repos = ["{$owner}.{$repo}" => $path] + $repos; - } - } - } - else - { - $repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master']; - $repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master']; - $repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master']; - } + $repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master']; return $repos; } @@ -150,81 +119,28 @@ } /** - * Get switch to add super powers - * - * @return bool Switch to add super powers - * @since 3.2.0 - */ - protected function getAddsuperpowers(): bool - { - return (bool) $this->params->get('powers_repository', 0); - } - - /** - * Get switch to add own super powers - * - * @return bool Switch to add own super powers - * @since 3.2.0 - */ - protected function getAddownpowers(): bool - { - if ($this->add_super_powers) - { - return (bool) $this->params->get('super_powers_repositories', 0); - } - - return false; - } - - /** - * Get local super powers repository path + * Get local joomla super powers repository path * * @return string The path to the local repository * @since 3.2.0 */ - protected function getLocalpowersrepositorypath(): string + protected function getLocaljoomlapowersrepositorypath(): string { - $default = $this->tmp_path . '/super_powers'; + $default = $this->tmp_path . '/joomla_powers'; - if (!$this->add_super_powers) - { - return $default; - } - - return $this->params->get('local_powers_repository_path', $default); + return $this->params->get('local_joomla_powers_repository_path', $default); } /** - * Get super power approved paths + * Get joomla power approved paths * - * @return array The approved paths to the repositories on Gitea + * @return array The paths to the repositories on Gitea * @since 3.2.0 */ - protected function getApprovedpaths(): array + protected function getApprovedjoomlapaths(): array { // some defaults repos we need by JCB - $approved = $this->super_powers_init_repos; - - if (!$this->add_own_powers) - { - return array_values($approved); - } - - $paths = $this->params->get('approved_paths'); - - if (!empty($paths)) - { - foreach ($paths as $path) - { - $owner = $path->owner ?? null; - $repo = $path->repo ?? null; - if ($owner !== null && $repo !== null) - { - // we make sure to get only the objects - $approved = ["{$owner}.{$repo}" => $path] + $approved; - } - } - } + $approved = $this->joomla_powers_init_repos; return array_values($approved); } \ No newline at end of file diff --git a/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php b/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php index 00384c4..502ef17 100644 --- a/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php +++ b/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php @@ -91,8 +91,8 @@ class JoomlaPower implements ServiceProviderInterface public function getGrep(Container $container): Grep { return new Grep( - $container->get('Config')->local_powers_repository_path, - $container->get('Config')->approved_paths, + $container->get('Config')->local_joomla_powers_repository_path, + $container->get('Config')->approved_joomla_paths, $container->get('Gitea.Repository.Contents') ); } diff --git a/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.power b/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.power index ec839f7..165f7c7 100644 --- a/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.power +++ b/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.power @@ -61,8 +61,8 @@ public function getGrep(Container $container): Grep { return new Grep( - $container->get('Config')->local_powers_repository_path, - $container->get('Config')->approved_paths, + $container->get('Config')->local_joomla_powers_repository_path, + $container->get('Config')->approved_joomla_paths, $container->get('Gitea.Repository.Contents') ); } diff --git a/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php b/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php index b6b5d09..0d625eb 100644 --- a/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php +++ b/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php @@ -109,8 +109,8 @@ class JoomlaPower implements ServiceProviderInterface public function getGrep(Container $container): Grep { return new Grep( - $container->get('Config')->local_powers_repository_path, - $container->get('Config')->approved_paths, + $container->get('Config')->local_joomla_powers_repository_path, + $container->get('Config')->approved_joomla_paths, $container->get('Gitea.Repository.Contents') ); } diff --git a/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.power b/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.power index 36046ba..dc5fa0c 100644 --- a/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.power +++ b/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.power @@ -76,8 +76,8 @@ public function getGrep(Container $container): Grep { return new Grep( - $container->get('Config')->local_powers_repository_path, - $container->get('Config')->approved_paths, + $container->get('Config')->local_joomla_powers_repository_path, + $container->get('Config')->approved_joomla_paths, $container->get('Gitea.Repository.Contents') ); } diff --git a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/README.md b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/README.md index e066bfa..9401298 100644 --- a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/README.md +++ b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/README.md @@ -62,6 +62,10 @@ class Config #Gold { # getPowerlibraryfolder() : string # getLocalpowersrepositorypath() : string # getApprovedpaths() : array + # getJoomlapowerscoreorganisation() : string + # getJoomlapowersinitrepos() : array + # getLocaljoomlapowersrepositorypath() : string + # getApprovedjoomlapaths() : array # getBompath() : string # getCustomfolderpath() : string # getAddassetstablefix() : int @@ -434,6 +438,34 @@ note right of Config::getApprovedpaths return: array end note +note left of Config::getJoomlapowerscoreorganisation + Get super power core organisation + + since: 3.2.0 + return: string +end note + +note right of Config::getJoomlapowersinitrepos + Get Joomla power init repos + + since: 3.2.0 + return: array +end note + +note left of Config::getLocaljoomlapowersrepositorypath + Get local joomla super powers repository path + + since: 3.2.0 + return: string +end note + +note right of Config::getApprovedjoomlapaths + Get joomla power approved paths + + since: 3.2.0 + return: array +end note + note left of Config::getBompath get bom path diff --git a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php index 4a8ff2b..4364a5b 100644 --- a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php +++ b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php @@ -800,6 +800,62 @@ class Config extends BaseConfig return array_values($approved); } + /** + * Get super power core organisation + * + * @return string The super power core organisation + * @since 3.2.0 + */ + protected function getJoomlapowerscoreorganisation(): string + { + // the VDM default organisation is [joomla] + $organisation = 'joomla'; + + return $this->params->get('joomla_powers_core_organisation', $organisation); + } + + /** + * Get Joomla power init repos + * + * @return array The init repositories on Gitea + * @since 3.2.0 + */ + protected function getJoomlapowersinitrepos(): array + { + // some defaults repos we need by JCB + $repos = []; + $repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master']; + + return $repos; + } + + /** + * Get local joomla super powers repository path + * + * @return string The path to the local repository + * @since 3.2.0 + */ + protected function getLocaljoomlapowersrepositorypath(): string + { + $default = $this->tmp_path . '/joomla_powers'; + + return $this->params->get('local_joomla_powers_repository_path', $default); + } + + /** + * Get joomla power approved paths + * + * @return array The paths to the repositories on Gitea + * @since 3.2.0 + */ + protected function getApprovedjoomlapaths(): array + { + // some defaults repos we need by JCB + $approved = $this->joomla_powers_init_repos; + + return array_values($approved); + } + /** * get bom path * diff --git a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.power b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.power index 17e3351..1604775 100644 --- a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.power +++ b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.power @@ -766,6 +766,62 @@ return array_values($approved); } + /** + * Get super power core organisation + * + * @return string The super power core organisation + * @since 3.2.0 + */ + protected function getJoomlapowerscoreorganisation(): string + { + // the VDM default organisation is [joomla] + $organisation = 'joomla'; + + return $this->params->get('joomla_powers_core_organisation', $organisation); + } + + /** + * Get Joomla power init repos + * + * @return array The init repositories on Gitea + * @since 3.2.0 + */ + protected function getJoomlapowersinitrepos(): array + { + // some defaults repos we need by JCB + $repos = []; + $repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master']; + + return $repos; + } + + /** + * Get local joomla super powers repository path + * + * @return string The path to the local repository + * @since 3.2.0 + */ + protected function getLocaljoomlapowersrepositorypath(): string + { + $default = $this->tmp_path . '/joomla_powers'; + + return $this->params->get('local_joomla_powers_repository_path', $default); + } + + /** + * Get joomla power approved paths + * + * @return array The paths to the repositories on Gitea + * @since 3.2.0 + */ + protected function getApprovedjoomlapaths(): array + { + // some defaults repos we need by JCB + $approved = $this->joomla_powers_init_repos; + + return array_values($approved); + } + /** * get bom path *