Release of v5.1.1-beta4

Fix the FieldXML interface mismatch. #1228. Adds Initialize, Reset, and Push functionality to the Repository entities.
This commit is contained in:
2025-06-25 10:16:52 +00:00
parent dbebb5663c
commit af4b12a82b
69 changed files with 1721 additions and 577 deletions

View File

@@ -14,7 +14,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Interfaces\GrepInterface;
use VDM\Joomla\Abstraction\Grep as ExtendingGrep;
use VDM\Joomla\Componentbuilder\Remote\Grep as ExtendingGrep;
/**
@@ -37,99 +37,6 @@ final class Grep extends ExtendingGrep implements GrepInterface
**/
protected ?string $target = 'joomla-powers';
/**
* Order of global search
*
* @var array
* @since 3.2.1
**/
protected array $order = ['remote'];
/**
* Search for a remote item
*
* @param string $guid The global unique id of the item
*
* @return object|null
* @since 3.2.0
*/
protected function searchRemote(string $guid): ?object
{
// check if it exists remotely
if (($path = $this->existsRemotely($guid)) !== null)
{
return $this->getRemote($path, $guid);
}
return null;
}
/**
* Get a remote joomla power object from a repository.
*
* @param object $path The repository path details
* @param string $guid The global unique ID of the power
*
* @return object|null
* @since 5.1.1
*/
protected function getRemote(object $path, string $guid): ?object
{
$relative_path = $path->index[$this->entity]->{$guid}->path ?? null;
if (empty($relative_path))
{
return null;
}
$branch = $this->getBranchName($path);
$guid_field = $this->getGuidField();
$settings_name = $this->getSettingsName();
$readme_enabled = $this->hasItemReadme();
// set the target system
$target = $path->target ?? 'gitea';
$this->contents->setTarget($target);
// load the base and token if set
$this->loadApi(
$this->contents,
$target === 'gitea' ? ($path->base ?? null) : null,
$path->token ?? null
);
$power = $this->loadRemoteFile(
$path->organisation,
$path->repository,
"{$relative_path}/{$settings_name}",
$branch
);
if ($power === null || !isset($power->{$guid_field}))
{
$this->contents->reset_();
return null;
}
$path_guid = $path->guid ?? null;
$branch_field = $this->getBranchField();
if ($branch_field === 'write_branch' && $path_guid !== null)
{
$this->setRepoItemSha($power, $path, "{$relative_path}/{$settings_name}", $branch, "{$path_guid}-settings");
if ($readme_enabled)
{
$readme_name = $this->getItemReadmeName();
$this->setRepoItemSha($power, $path, "{$relative_path}/{$readme_name}", $branch, "{$path_guid}-readme");
}
}
$this->contents->reset_();
return $power;
}
/**
* Set repository messages and errors based on given conditions.
*

View File

@@ -17,7 +17,7 @@ use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\JoomlaPower\Config;
use VDM\Joomla\Componentbuilder\JoomlaPower\Grep;
use VDM\Joomla\Componentbuilder\JoomlaPower\Remote\Config as RemoteConfig;
use VDM\Joomla\Componentbuilder\Power\Remote\Get;
use VDM\Joomla\Componentbuilder\Remote\Get;
use VDM\Joomla\Componentbuilder\JoomlaPower\Remote\Set;
use VDM\Joomla\Componentbuilder\JoomlaPower\Readme\Item as ItemReadme;
use VDM\Joomla\Componentbuilder\JoomlaPower\Readme\Main as MainReadme;