Release of v5.0.1-alpha5

Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes.
This commit is contained in:
2024-06-21 03:25:28 +02:00
parent fc6b04cb5c
commit c51ef999a9
120 changed files with 8945 additions and 3699 deletions

View File

@@ -465,6 +465,42 @@ abstract class FilterHelper
return null;
}
/**
* get available repositories of target area
*
* @param int $target The target area
*
* @return array|null The result ids
* @since 3.2.0
**/
public static function repositories(int $target): ?array
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query
->select($db->quoteName(array('repository', 'organisation')))
->from($db->quoteName('#__componentbuilder_repository'))
->where($db->quoteName('published') . ' >= 1')
->where($db->quoteName('target') . ' = ' . $target)
->order($db->quoteName('ordering') . ' desc');
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
$options = [];
foreach($items as $item)
{
$path = $item->organisation . '/' . $item->repository;
$options[$path] = $path;
}
return $options;
}
return null;
}
/**
* Get a component admin views IDs
*

View File

@@ -0,0 +1,78 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Utilities;
use Joomla\CMS\Factory;
/**
* Repositories Helper
*
* @since 3.2.2
*/
abstract class RepoHelper
{
/**
* get available repositories of target area
*
* @param int $target The target area
*
* @return array|null The result set
* @since 3.2.0
**/
public static function get(int $target): ?array
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array(
'type',
'base',
'organisation',
'repository',
'read_branch',
'write_branch',
'token',
'username',
'target',
'access_repo',
'guid'
)))
->from($db->quoteName('#__componentbuilder_repository'))
->where($db->quoteName('published') . ' >= 1')
->where($db->quoteName('target') . ' = ' . $target)
->order($db->quoteName('ordering') . ' desc');
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
$options = [];
foreach($items as $item)
{
if ($item->access_repo != 1)
{
unset($item->username);
unset($item->token);
}
unset($item->access_repo);
$path = $item->organisation . '/' . $item->repository;
$options[$path] = $item;
}
return $options;
}
return null;
}
}