Release of v5.0.0-rc2

Improved the Schema Table update engine (more). Fix autoloader timing, and loading. Implement the Joomla Powers in JCB code, to move away from JClasses. Remove the SQL update, to only use the Schema updates of table columns to avoid collusion.
This commit is contained in:
Robot 2024-04-30 12:29:37 +02:00
parent 2a9a66b8a7
commit 8ab5f2daf4
Signed by untrusted user: Robot
GPG Key ID: 14DECD44E7E1BB95
16 changed files with 95 additions and 176 deletions

View File

@ -1,36 +1,25 @@
# v5.0.0-rc1 # v5.0.0-rc2
- Improved the Schema Table update engine (more). - Improved the Schema Table update engine (more).
- Fix autoloader timing, and loading. - Fix autoloader timing, and loading.
- Implement the Joomla Powers in JCB code, to move away from JClasses. - Implement the Joomla Powers in JCB code, to move away from JClasses.
- Remove the SQL update, to only use the Schema updates of table columns to avoid collusion.
# v5.0.0-beta5 # v5.0.0-beta
- Add the compiler menu back.
- Fix the CustomfolderlistField #1094
- Add view list and single name fix.
- Add component code name fix.
- Add reset list of powers.
- Add Joomla powers for namespace dynamic management.
- Add fallback option to ensure that all JCB tables and fields exist.
- Move the powers autoloader to its own file.
- Fix the media field size limitation. #1109 - Fix the media field size limitation. #1109
- Add dynamic datatype update to schema field check. - Add dynamic datatype update to schema field check.
- Fix version_update column size. - Fix version_update column size.
- Improved the Schema Table update engine. - Improved the Schema Table update engine.
# v5.0.0-beta4
- Add fallback option to ensure that all JCB tables and fields exist.
- Move the powers autoloader to its own file.
# v5.0.0-beta3
- Add Joomla powers for namespace dynamic management.
# v5.0.0-beta2
- Add view list and single name fix.
- Add component code name fix.
- Add reset list of powers.
# v5.0.0-beta1
- Add the compiler menu back.
- Fix the CustomfolderlistField #1094
# v5.0.0-alpha # v5.0.0-alpha
- First alpha release of Component Builder towards Joomla 5 (very unstable...) - First alpha release of Component Builder towards Joomla 5 (very unstable...)
@ -54,9 +43,12 @@
- Add power path override option on component level. - Add power path override option on component level.
- Fix the sql build feature. #1032 - Fix the sql build feature. #1032
# v4.0.0-rc1 # v4.0.0-rc2
- Improved the Schema Table update engine (more). - Improved the Schema Table update engine (more).
- Fix autoloader timing, and loading.
- Implement the Joomla Powers in JCB code, to move away from JClasses.
- Remove the SQL update, to only use the Schema updates of table columns to avoid collusion.
# v3.2.0 # v3.2.0

View File

@ -3210,7 +3210,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder"> echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/> <img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a> </a>
<h3>Upgrade to Version 5.0.0-rc1 Was Successful! Let us know if anything is not working as expected.</h3></div>'; <h3>Upgrade to Version 5.0.0-rc2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
// Add/Update component in the action logs extensions table. // Add/Update component in the action logs extensions table.
$this->setActionLogsExtensions(); $this->setActionLogsExtensions();

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have! Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.0-rc1) with **ALL** its features and **ALL** concepts totally open-source and free! You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.0-rc2) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,13 +144,13 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 27th April, 2024 + *Last Build*: 30th April, 2024
+ *Version*: 5.0.0-rc1 + *Version*: 5.0.0-rc2
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **745920** + *Line count*: **745955**
+ *Field count*: **2097** + *Field count*: **2097**
+ *File count*: **5293** + *File count*: **5289**
+ *Folder count*: **528** + *Folder count*: **528**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com). > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have! Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.0-rc1) with **ALL** its features and **ALL** concepts totally open-source and free! You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.0-rc2) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,13 +144,13 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 27th April, 2024 + *Last Build*: 30th April, 2024
+ *Version*: 5.0.0-rc1 + *Version*: 5.0.0-rc2
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **745920** + *Line count*: **745955**
+ *Field count*: **2097** + *Field count*: **2097**
+ *File count*: **5293** + *File count*: **5289**
+ *Folder count*: **528** + *Folder count*: **528**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com). > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).

View File

@ -1,3 +1 @@
ALTER TABLE `#__componentbuilder_joomla_component` ADD `add_jcb_powers_path` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_javascript`;
ALTER TABLE `#__componentbuilder_joomla_component` ADD `jcb_powers_path` VARCHAR(255) NOT NULL DEFAULT '' AFTER `javascript`;

View File

@ -1,28 +0,0 @@
CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_power` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
`description` TEXT NULL,
`guid` VARCHAR(36) NOT NULL DEFAULT '',
`settings` TEXT NOT NULL,
`system_name` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
`created` DATETIME DEFAULT CURRENT_TIMESTAMP,
`modified` DATETIME DEFAULT NULL,
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
`checked_out_time` DATETIME DEFAULT NULL,
`version` INT(10) unsigned NOT NULL DEFAULT 1,
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
`access` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_system_name` (`system_name`),
KEY `idx_guid` (`guid`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

View File

@ -1,2 +0,0 @@
ALTER TABLE `#__componentbuilder_joomla_component` ADD `add_php_method_install` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_helper_site`;
ALTER TABLE `#__componentbuilder_joomla_component` ADD `php_method_install` MEDIUMTEXT NOT NULL AFTER `php_helper_site`;

View File

@ -1,18 +0,0 @@
UPDATE `#__componentbuilder_admin_view`
SET `alias_builder_type` = 0
WHERE `alias_builder_type` = '';
UPDATE `#__componentbuilder_dynamic_get`
SET `addcalculation` = 0
WHERE `addcalculation` = '';
ALTER TABLE `#__componentbuilder_joomla_component` CHANGE `image` `image` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `#__componentbuilder_admin_view` CHANGE `alias_builder_type` `alias_builder_type` TINYINT(1) NOT NULL DEFAULT 0;
ALTER TABLE `#__componentbuilder_admin_view` CHANGE `icon` `icon` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `#__componentbuilder_admin_view` CHANGE `icon_add` `icon_add` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `#__componentbuilder_admin_view` CHANGE `icon_category` `icon_category` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `#__componentbuilder_custom_admin_view` CHANGE `icon` `icon` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `#__componentbuilder_dynamic_get` CHANGE `addcalculation` `addcalculation` TINYINT(1) NOT NULL DEFAULT 0;
ALTER TABLE `#__componentbuilder_component_updates` CHANGE `version_update` `version_update` MEDIUMTEXT NOT NULL;
ALTER TABLE `#__componentbuilder_joomla_module_updates` CHANGE `version_update` `version_update` MEDIUMTEXT NOT NULL;
ALTER TABLE `#__componentbuilder_joomla_plugin_updates` CHANGE `version_update` `version_update` MEDIUMTEXT NOT NULL;

View File

@ -1 +0,0 @@

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="5.0" method="upgrade"> <extension type="component" version="5.0" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>27th April, 2024</creationDate> <creationDate>30th April, 2024</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail> <authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl> <authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright> <copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>5.0.0-rc1</version> <version>5.0.0-rc2</version>
<description><![CDATA[ <description><![CDATA[
<h1>Component Builder (v.5.0.0-rc1)</h1> <h1>Component Builder (v.5.0.0-rc2)</h1>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time. <p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -23,10 +23,10 @@
<element>pkg_component_builder</element> <element>pkg_component_builder</element>
<type>package</type> <type>package</type>
<client>site</client> <client>site</client>
<version>4.0.0-rc1</version> <version>4.0.0-rc2</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl> <infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads> <downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.0-rc1.zip</downloadurl> <downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.0-rc2.zip</downloadurl>
</downloads> </downloads>
<tags> <tags>
<tag>beta</tag> <tag>beta</tag>
@ -44,7 +44,7 @@
<version>5.0.0-alpha</version> <version>5.0.0-alpha</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl> <infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads> <downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-beta1.zip</downloadurl> <downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-alpha8.zip</downloadurl>
</downloads> </downloads>
<tags> <tags>
<tag>alpha</tag> <tag>alpha</tag>
@ -59,79 +59,7 @@
<element>pkg_component_builder</element> <element>pkg_component_builder</element>
<type>package</type> <type>package</type>
<client>site</client> <client>site</client>
<version>5.0.0-beta1</version> <version>5.0.0-beta</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-beta1.zip</downloadurl>
</downloads>
<tags>
<tag>beta</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://dev.vdm.io</maintainerurl>
<targetplatform name="joomla" version="5\.[01]"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>5.0.0-beta2</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-beta2.zip</downloadurl>
</downloads>
<tags>
<tag>beta</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://dev.vdm.io</maintainerurl>
<targetplatform name="joomla" version="5\.[01]"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>5.0.0-beta3</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-beta3.zip</downloadurl>
</downloads>
<tags>
<tag>beta</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://dev.vdm.io</maintainerurl>
<targetplatform name="joomla" version="5\.[01]"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>5.0.0-beta4</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-beta4.zip</downloadurl>
</downloads>
<tags>
<tag>beta</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://dev.vdm.io</maintainerurl>
<targetplatform name="joomla" version="5\.[01]"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>5.0.0-beta5</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl> <infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads> <downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-beta5.zip</downloadurl> <downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-beta5.zip</downloadurl>
@ -149,10 +77,10 @@
<element>pkg_component_builder</element> <element>pkg_component_builder</element>
<type>package</type> <type>package</type>
<client>site</client> <client>site</client>
<version>5.0.0-rc1</version> <version>5.0.0-rc2</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl> <infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads> <downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-rc1.zip</downloadurl> <downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-rc2.zip</downloadurl>
</downloads> </downloads>
<tags> <tags>
<tag>releasecandidate</tag> <tag>releasecandidate</tag>

View File

@ -12,6 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\JoomlaPower; namespace VDM\Joomla\Componentbuilder\Compiler\JoomlaPower;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\ExtractorInterface; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\ExtractorInterface;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor as ExtendingExtractor; use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor as ExtendingExtractor;

View File

@ -121,7 +121,8 @@ class Utilities implements ServiceProviderInterface
public function getFileInjector(Container $container): FileInjector public function getFileInjector(Container $container): FileInjector
{ {
return new FileInjector( return new FileInjector(
$container->get('Power.Injector') $container->get('Power.Injector'),
$container->get('Joomla.Power.Injector')
); );
} }

View File

@ -13,6 +13,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Utilities;
use VDM\Joomla\Componentbuilder\Compiler\Power\Injector as Power; use VDM\Joomla\Componentbuilder\Compiler\Power\Injector as Power;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Injector as JoomlaPower;
use VDM\Joomla\Utilities\MathHelper; use VDM\Joomla\Utilities\MathHelper;
@ -33,23 +34,41 @@ final class FileInjector
protected Power $power; protected Power $power;
/** /**
* The pattern to get the powers * The Joomla Injector Class.
*
* @var JoomlaPower
* @since 3.2.1
*/
protected JoomlaPower $joomla;
/**
* The power pattern to get the powers
* *
* @var string * @var string
* @since 3.2.0 * @since 3.2.0
**/ **/
protected string $pattern = '/Super_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/'; protected string $powerPattern = '/Super_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* The Joomla power pattern to get the powers
*
* @var string
* @since 3.2.1
**/
protected string $joomlaPattern = '/Joomla_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/** /**
* Constructor. * Constructor.
* *
* @param Power $power The Injector Class. * @param Power $power The Injector Class.
* @param JoomlaPower $joomla The Joomla Injector Class.
* *
* @since 3.2.0 * @since 3.2.1
*/ */
public function __construct(Power $power) public function __construct(Power $power, JoomlaPower $joomla)
{ {
$this->power = $power; $this->power = $power;
$this->joomla = $joomla;
} }
/** /**
@ -72,7 +91,9 @@ final class FileInjector
throw new \InvalidArgumentException('Position cannot be negative.'); throw new \InvalidArgumentException('Position cannot be negative.');
} }
$found_super_powers = preg_match($this->pattern, $data); $found_joomla_powers = preg_match($this->joomlaPattern, $data);
$found_super_powers = preg_match($this->powerPattern, $data);
$actual_file = $this->openFileWithLock($file); $actual_file = $this->openFileWithLock($file);
try try
@ -85,6 +106,11 @@ final class FileInjector
$this->processFile($actual_file, $temp_file, $data, $position, $replace); $this->processFile($actual_file, $temp_file, $data, $position, $replace);
if ($found_joomla_powers)
{
$this->injectJoomlaPowers($actual_file);
}
if ($found_super_powers) if ($found_super_powers)
{ {
$this->injectSuperPowers($actual_file); $this->injectSuperPowers($actual_file);
@ -209,5 +235,27 @@ final class FileInjector
fwrite($actual_file, $power_data); fwrite($actual_file, $power_data);
} }
/**
* Injects Joomla powers into the file content, if found, and updates the file.
*
* @param resource $actual_file The file handle of the actual file.
*
* @return void
* @since 3.2.1
*/
private function injectJoomlaPowers($actual_file): void
{
rewind($actual_file);
$power_data = $this->joomla->power(
stream_get_contents($actual_file)
);
ftruncate($actual_file, 0);
rewind($actual_file);
fwrite($actual_file, $power_data);
}
} }