Release of v5.0.1-alpha7
Add push options to Joomla Power. Complete the Joomla Power Init and Reset features. Fix Gitea Contents class functions. Last Alpha release (feature block).
This commit is contained in:
@@ -54,20 +54,36 @@ final class Grep extends ExtendingGrep implements GrepInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$path->index = null;
|
||||
|
||||
// update the branch
|
||||
$branch_field = $this->getBranchField();
|
||||
$branch = $path->{$branch_field} ?? $path->read_branch ?? 'master';
|
||||
|
||||
try
|
||||
{
|
||||
$this->contents->load_($path->base ?? null, $path->token ?? null);
|
||||
$path->index = $this->contents->get($path->organisation, $path->repository, 'joomla-powers.json', $path->read_branch);
|
||||
$source = $this->contents->metadata($path->organisation, $path->repository, 'src', $branch);
|
||||
if ($source && is_array($source))
|
||||
{
|
||||
$path->index = new \stdClass();
|
||||
foreach ($source as $index)
|
||||
{
|
||||
if (is_object($index) && isset($index->name))
|
||||
{
|
||||
$path->index->{$index->name} = $index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->contents->reset_();
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
|
||||
Text::sprintf('COM_COMPONENTBUILDER_PJOOMLA_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
|
||||
'Error'
|
||||
);
|
||||
|
||||
$path->index = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +98,7 @@ final class Grep extends ExtendingGrep implements GrepInterface
|
||||
protected function searchRemote(string $guid): ?object
|
||||
{
|
||||
// we can only search if we have paths
|
||||
if ($this->path && $this->paths)
|
||||
if (is_array($this->paths))
|
||||
{
|
||||
foreach ($this->paths as $path)
|
||||
{
|
||||
@@ -100,7 +116,7 @@ final class Grep extends ExtendingGrep implements GrepInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a remote power
|
||||
* Get a remote joomla power
|
||||
*
|
||||
* @param object $path The repository path details
|
||||
* @param string $guid The global unique id of the power
|
||||
@@ -111,20 +127,40 @@ final class Grep extends ExtendingGrep implements GrepInterface
|
||||
protected function getRemote(object $path, string $guid): ?object
|
||||
{
|
||||
$power = null;
|
||||
if (empty($path->index->{$guid}->settings))
|
||||
if (empty($path->index->{$guid}->path))
|
||||
{
|
||||
return $power;
|
||||
}
|
||||
|
||||
// get the branch name
|
||||
$branch_field = $this->getBranchField();
|
||||
$branch = $path->{$branch_field} ?? $path->read_branch ?? 'master';
|
||||
|
||||
// get the settings
|
||||
$this->contents->load_($path->base ?? null, $path->token ?? null);
|
||||
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $path->read_branch)) !== null &&
|
||||
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null &&
|
||||
isset($power->guid))
|
||||
{
|
||||
// set the git details in params
|
||||
$power->params = (object) [
|
||||
'source' => ['guid' => $path->guid ?? null]
|
||||
];
|
||||
$path_guid = $path->guid ?? null;
|
||||
if ($path_guid !== null)
|
||||
{
|
||||
if (($meta = $this->contents->metadata($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null &&
|
||||
isset($meta->sha))
|
||||
{
|
||||
if (isset($power->params) && is_object($power->params) &&
|
||||
isset($power->params->source) && is_array($power->params->source))
|
||||
{
|
||||
$power->params->source[$path_guid] = $meta->sha;
|
||||
}
|
||||
else
|
||||
{
|
||||
$power->params = (object)[
|
||||
'source' => [$path_guid => $meta->sha]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->contents->reset_();
|
||||
|
||||
|
Reference in New Issue
Block a user