From 552a2664ba0c7a8431b4498881bb1f3a2ebbf46e Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 7 Mar 2021 23:40:55 +0200 Subject: [PATCH] Adds the namespacing to the compiler classes for the File, and Folder classes of Joomla. --- README.md | 2 +- admin/README.txt | 2 +- admin/helpers/compiler/a_Get.php | 9 +++-- admin/helpers/compiler/b_Structure.php | 47 ++++++++++++++------------ admin/helpers/compiler/f_Infusion.php | 9 +++-- componentbuilder.xml | 2 +- 6 files changed, 40 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 236cf84ac..475569ee1 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 5th March, 2021 ++ *Last Build*: 7th March, 2021 + *Version*: 2.12.8 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/README.txt b/admin/README.txt index 236cf84ac..475569ee1 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -143,7 +143,7 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 5th March, 2021 ++ *Last Build*: 7th March, 2021 + *Version*: 2.12.8 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 0fe7c2a2b..74ddada49 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -12,6 +12,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; + /** * Get class as the main compilers class */ @@ -7248,7 +7251,7 @@ class Get if ((!filter_var($target, FILTER_VALIDATE_URL) === false && ComponentbuilderHelper::urlExists($target)) || (JPath::clean($target) === $target - && JFile::exists($target))) + && File::exists($target))) { $this->getExternalCodeString($target, $bucket); } @@ -10344,7 +10347,7 @@ class Get foreach ($fileTypes as $type) { // get a list of files in the current directory tree (only PHP, JS and XML for now) - $files = JFolder::files('.', $type, true, true); + $files = Folder::files('.', $type, true, true); // check if files found if (ComponentbuilderHelper::checkArray($files)) { @@ -11540,7 +11543,7 @@ class Get // check if the local install is found foreach ($localPaths as $key => $localPath) { - if (!JFolder::exists($localPath)) + if (!Folder::exists($localPath)) { unset($localPaths[$key]); } diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index e745115c3..908cf3075 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -12,6 +12,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; + /** * Structure class */ @@ -1403,12 +1406,12 @@ class Structure extends Get private function createFolder($path) { // check if the path exist - if (!JFolder::exists( + if (!Folder::exists( $path )) { // create the path - JFolder::create( + Folder::create( $path ); // count the folder created @@ -1436,9 +1439,9 @@ class Structure extends Get array(&$this->componentContext, &$this->libraries) ); // creat the main component folder - if (!JFolder::exists($this->componentPath)) + if (!Folder::exists($this->componentPath)) { - JFolder::create($this->componentPath); + Folder::create($this->componentPath); // count the folder created $this->folderCount++; $this->indexHTML(''); @@ -1736,9 +1739,9 @@ class Structure extends Get )) { // creat the main component folder - if (!JFolder::exists($this->componentPath)) + if (!Folder::exists($this->componentPath)) { - JFolder::create($this->componentPath); + Folder::create($this->componentPath); // count the folder created $this->folderCount++; $this->indexHTML(''); @@ -1995,7 +1998,7 @@ class Structure extends Get // now move the file if ($details->type === 'file') { - if (!JFile::exists($currentFullPath)) + if (!File::exists($currentFullPath)) { $this->app->enqueueMessage( JText::_('

File Path Error

'), 'Error' @@ -2014,12 +2017,12 @@ class Structure extends Get basename($packageFullPath), '', $packageFullPath ); // check if path exist, if not creat it - if (!JFolder::exists($packageFullPath0nly)) + if (!Folder::exists($packageFullPath0nly)) { - JFolder::create($packageFullPath0nly); + Folder::create($packageFullPath0nly); } // move the file to its place - JFile::copy($currentFullPath, $packageFullPath); + File::copy($currentFullPath, $packageFullPath); // count the file created $this->fileCount++; // store the new files @@ -2054,7 +2057,7 @@ class Structure extends Get } elseif ($details->type === 'folder') { - if (!JFolder::exists($currentFullPath)) + if (!Folder::exists($currentFullPath)) { $this->app->enqueueMessage( JText::_('

Folder Path Error

'), @@ -2070,7 +2073,7 @@ class Structure extends Get else { // move the folder to its place - JFolder::copy( + Folder::copy( $currentFullPath, $packageFullPath, '', true ); // count the folder created @@ -2359,13 +2362,13 @@ class Structure extends Get if (!isset($this->extentionTrackingFilesMoved[$check])) { // check files exist - if (JFile::exists( + if (File::exists( $this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php' )) { // copy the custom field - JFile::copy( + File::copy( $this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php', $path . '/fields/' . $field['type_name'] . '.php' @@ -2386,14 +2389,14 @@ class Structure extends Get if (!isset($this->extentionTrackingFilesMoved[$check])) { // check files exist - if (JFile::exists( + if (File::exists( $this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php' )) { // copy the custom field - JFile::copy( + File::copy( $this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php', $path . '/rules/' @@ -2651,9 +2654,9 @@ class Structure extends Get } // setup the folder - if (!JFolder::exists($path)) + if (!Folder::exists($path)) { - JFolder::create($path); + Folder::create($path); $this->indexHTML($zipPath); // count the folder created $this->folderCount++; @@ -2683,10 +2686,10 @@ class Structure extends Get { $new = $item; } - if (!JFile::exists($path . '/' . $new)) + if (!File::exists($path . '/' . $new)) { // move the file to its place - JFile::copy( + File::copy( $this->templatePath . '/' . $item, $path . '/' . $new ); @@ -3043,7 +3046,7 @@ class Structure extends Get // use path if exist if (strlen($path) > 0) { - JFile::copy( + File::copy( $this->templatePath . '/index.html', $root . $path . '/index.html' ); @@ -3052,7 +3055,7 @@ class Structure extends Get } else { - JFile::copy( + File::copy( $this->templatePath . '/index.html', $root . '/index.html' ); // count the file created diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 7376bbe1d..44d78d887 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -12,6 +12,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; + /** * Infusion class */ @@ -2620,14 +2623,14 @@ class Infusion extends Interpretation // build the path to place the lang file $path = $this->componentPath . '/' . $p . '/language/' . $tag . '/'; - if (!JFolder::exists($path)) + if (!Folder::exists($path)) { - JFolder::create($path); + Folder::create($path); // count the folder created $this->folderCount++; } // move the file to its place - JFile::copy($getPAth, $path . $file_name); + File::copy($getPAth, $path . $file_name); // count the file created $this->fileCount++; // add content to it diff --git a/componentbuilder.xml b/componentbuilder.xml index 100e0f71c..65cdb247c 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 5th March, 2021 + 7th March, 2021 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com