Release of v5.0.1-beta1

Fix subform set methods. Improved the Joomla Power Push path. Fix the metadata, metadesc, metakey database issue.
This commit is contained in:
2024-07-17 02:30:54 +02:00
parent 18545c5b8d
commit a4a4a2ab9a
78 changed files with 3356 additions and 1203 deletions

View File

@ -15,7 +15,7 @@ defined('_JCB_TEMPLATE') or die;
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper;
###CUSTOM_POWER_AUTOLOADER###
###POWER_AUTOLOADER###
###ADMIN_HELPER_CLASS_HEADER###

View File

@ -14,7 +14,7 @@ defined('_JCB_TEMPLATE') or die;
?>
###BOM###
###CUSTOM_POWER_AUTOLOADER###
###POWER_AUTOLOADER###
// (soon) use Joomla\CMS\Association\AssociationExtensionInterface;
use Joomla\CMS\Categories\CategoryFactoryInterface;
@ -55,10 +55,10 @@ return new class () implements ServiceProviderInterface
{
// (soon) $container->set(AssociationExtensionInterface::class, new AssociationsHelper());
$container->registerServiceProvider(new CategoryFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
$container->registerServiceProvider(new MVCFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
$container->registerServiceProvider(new RouterFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
$container->registerServiceProvider(new CategoryFactory('\\###NAMESPACEPREFIX###\\Component\\###ComponentNamespace###'));
$container->registerServiceProvider(new MVCFactory('\\###NAMESPACEPREFIX###\\Component\\###ComponentNamespace###'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\###NAMESPACEPREFIX###\\Component\\###ComponentNamespace###'));
$container->registerServiceProvider(new RouterFactory('\\###NAMESPACEPREFIX###\\Component\\###ComponentNamespace###'));
$container->set(
ComponentInterface::class,

View File

@ -279,6 +279,80 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
return true;
}
/**
* Remove folders with files (with ignore options)
*
* @param string $dir The path to the folder to remove.
* @param array|null $ignore The folders and files to ignore and not remove.
*
* @return bool True if all specified files/folders are removed, false otherwise.
* @since 3.2.2
*/
protected function removeFolder(string $dir, ?array $ignore = null): bool
{
if (!is_dir($dir))
{
return false;
}
$it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
$it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
// Remove trailing slash
$dir = rtrim($dir, '/');
foreach ($it as $file)
{
$filePath = $file->getPathname();
$relativePath = str_replace($dir . '/', '', $filePath);
if ($ignore !== null && in_array($relativePath, $ignore, true))
{
continue;
}
if ($file->isDir())
{
Folder::delete($filePath);
}
else
{
File::delete($filePath);
}
}
// Delete the root folder if there are no ignored files/folders left
if ($ignore === null || $this->isDirEmpty($dir, $ignore))
{
return Folder::delete($dir);
}
return true;
}
/**
* Check if a directory is empty considering ignored files/folders.
*
* @param string $dir The path to the folder to check.
* @param array $ignore The folders and files to ignore.
*
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
* @since 3.2.1
*/
protected function isDirEmpty(string $dir, array $ignore): bool
{
$it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
foreach ($it as $file)
{
$relativePath = str_replace($dir . '/', '', $file->getPathname());
if (!in_array($relativePath, $ignore, true))
{
return false;
}
}
return true;
}
/**
* Remove the files and folders in the given array from
*
@ -1095,5 +1169,29 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
);
}
}
}
/**
* Ensures that a class in the namespace is available.
* If the class is not already loaded, it attempts to load it via the specified autoloader.
*
* @param string $className The fully qualified name of the class to check.
*
* @return bool True if the class exists or was successfully loaded, false otherwise.
* @since 4.0.1
*/
protected function classExists(string $className): bool
{
if (!class_exists($className, true))
{
###THREE_POWER_AUTOLOADER###
// Check again if the class now exists after requiring the autoloader
if (!class_exists($className, true))
{
return false;
}
}
return true;
}###INSTALLERMETHODS###
}

View File

@ -15,7 +15,7 @@ defined('_JCB_TEMPLATE') or die;
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper;
###SITE_CUSTOM_POWER_AUTOLOADER###
###SITE_POWER_AUTOLOADER###
###SITE_HELPER_CLASS_HEADER###