update 2024-04-13 20:01:28

This commit is contained in:
Robot 2024-04-13 20:01:28 +02:00
parent cd0cb2ba43
commit 6748fd95ed
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
10 changed files with 189 additions and 229 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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')
);
}

View File

@ -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')
);
}

View File

@ -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')
);
}

View File

@ -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')
);
}

View File

@ -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

View File

@ -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
*

View File

@ -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
*