Adds the namespacing to the compiler classes for the File, and Folder classes of Joomla.

This commit is contained in:
Llewellyn van der Merwe 2021-03-07 23:40:55 +02:00
parent 3c3951ae83
commit 552a2664ba
Signed by untrusted user: Llewellyn
GPG Key ID: EFC0C720A240551C
6 changed files with 40 additions and 31 deletions

View File

@ -143,7 +143,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 5th March, 2021 + *Last Build*: 7th March, 2021
+ *Version*: 2.12.8 + *Version*: 2.12.8
+ *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

View File

@ -143,7 +143,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 5th March, 2021 + *Last Build*: 7th March, 2021
+ *Version*: 2.12.8 + *Version*: 2.12.8
+ *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

View File

@ -12,6 +12,9 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/** /**
* Get class as the main compilers class * Get class as the main compilers class
*/ */
@ -7248,7 +7251,7 @@ class Get
if ((!filter_var($target, FILTER_VALIDATE_URL) === false if ((!filter_var($target, FILTER_VALIDATE_URL) === false
&& ComponentbuilderHelper::urlExists($target)) && ComponentbuilderHelper::urlExists($target))
|| (JPath::clean($target) === $target || (JPath::clean($target) === $target
&& JFile::exists($target))) && File::exists($target)))
{ {
$this->getExternalCodeString($target, $bucket); $this->getExternalCodeString($target, $bucket);
} }
@ -10344,7 +10347,7 @@ class Get
foreach ($fileTypes as $type) foreach ($fileTypes as $type)
{ {
// get a list of files in the current directory tree (only PHP, JS and XML for now) // 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 // check if files found
if (ComponentbuilderHelper::checkArray($files)) if (ComponentbuilderHelper::checkArray($files))
{ {
@ -11540,7 +11543,7 @@ class Get
// check if the local install is found // check if the local install is found
foreach ($localPaths as $key => $localPath) foreach ($localPaths as $key => $localPath)
{ {
if (!JFolder::exists($localPath)) if (!Folder::exists($localPath))
{ {
unset($localPaths[$key]); unset($localPaths[$key]);
} }

View File

@ -12,6 +12,9 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/** /**
* Structure class * Structure class
*/ */
@ -1403,12 +1406,12 @@ class Structure extends Get
private function createFolder($path) private function createFolder($path)
{ {
// check if the path exist // check if the path exist
if (!JFolder::exists( if (!Folder::exists(
$path $path
)) ))
{ {
// create the path // create the path
JFolder::create( Folder::create(
$path $path
); );
// count the folder created // count the folder created
@ -1436,9 +1439,9 @@ class Structure extends Get
array(&$this->componentContext, &$this->libraries) array(&$this->componentContext, &$this->libraries)
); );
// creat the main component folder // 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 // count the folder created
$this->folderCount++; $this->folderCount++;
$this->indexHTML(''); $this->indexHTML('');
@ -1736,9 +1739,9 @@ class Structure extends Get
)) ))
{ {
// creat the main component folder // 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 // count the folder created
$this->folderCount++; $this->folderCount++;
$this->indexHTML(''); $this->indexHTML('');
@ -1995,7 +1998,7 @@ class Structure extends Get
// now move the file // now move the file
if ($details->type === 'file') if ($details->type === 'file')
{ {
if (!JFile::exists($currentFullPath)) if (!File::exists($currentFullPath))
{ {
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::_('<hr /><h3>File Path Error</h3>'), 'Error' JText::_('<hr /><h3>File Path Error</h3>'), 'Error'
@ -2014,12 +2017,12 @@ class Structure extends Get
basename($packageFullPath), '', $packageFullPath basename($packageFullPath), '', $packageFullPath
); );
// check if path exist, if not creat it // 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 // move the file to its place
JFile::copy($currentFullPath, $packageFullPath); File::copy($currentFullPath, $packageFullPath);
// count the file created // count the file created
$this->fileCount++; $this->fileCount++;
// store the new files // store the new files
@ -2054,7 +2057,7 @@ class Structure extends Get
} }
elseif ($details->type === 'folder') elseif ($details->type === 'folder')
{ {
if (!JFolder::exists($currentFullPath)) if (!Folder::exists($currentFullPath))
{ {
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::_('<hr /><h3>Folder Path Error</h3>'), JText::_('<hr /><h3>Folder Path Error</h3>'),
@ -2070,7 +2073,7 @@ class Structure extends Get
else else
{ {
// move the folder to its place // move the folder to its place
JFolder::copy( Folder::copy(
$currentFullPath, $packageFullPath, '', true $currentFullPath, $packageFullPath, '', true
); );
// count the folder created // count the folder created
@ -2359,13 +2362,13 @@ class Structure extends Get
if (!isset($this->extentionTrackingFilesMoved[$check])) if (!isset($this->extentionTrackingFilesMoved[$check]))
{ {
// check files exist // check files exist
if (JFile::exists( if (File::exists(
$this->componentPath . '/admin/models/fields/' $this->componentPath . '/admin/models/fields/'
. $field['type_name'] . '.php' . $field['type_name'] . '.php'
)) ))
{ {
// copy the custom field // copy the custom field
JFile::copy( File::copy(
$this->componentPath . '/admin/models/fields/' $this->componentPath . '/admin/models/fields/'
. $field['type_name'] . '.php', . $field['type_name'] . '.php',
$path . '/fields/' . $field['type_name'] . '.php' $path . '/fields/' . $field['type_name'] . '.php'
@ -2386,14 +2389,14 @@ class Structure extends Get
if (!isset($this->extentionTrackingFilesMoved[$check])) if (!isset($this->extentionTrackingFilesMoved[$check]))
{ {
// check files exist // check files exist
if (JFile::exists( if (File::exists(
$this->componentPath . '/admin/models/rules/' $this->componentPath . '/admin/models/rules/'
. $this->validationLinkedFields[$field['field']] . $this->validationLinkedFields[$field['field']]
. '.php' . '.php'
)) ))
{ {
// copy the custom field // copy the custom field
JFile::copy( File::copy(
$this->componentPath . '/admin/models/rules/' $this->componentPath . '/admin/models/rules/'
. $this->validationLinkedFields[$field['field']] . $this->validationLinkedFields[$field['field']]
. '.php', $path . '/rules/' . '.php', $path . '/rules/'
@ -2651,9 +2654,9 @@ class Structure extends Get
} }
// setup the folder // setup the folder
if (!JFolder::exists($path)) if (!Folder::exists($path))
{ {
JFolder::create($path); Folder::create($path);
$this->indexHTML($zipPath); $this->indexHTML($zipPath);
// count the folder created // count the folder created
$this->folderCount++; $this->folderCount++;
@ -2683,10 +2686,10 @@ class Structure extends Get
{ {
$new = $item; $new = $item;
} }
if (!JFile::exists($path . '/' . $new)) if (!File::exists($path . '/' . $new))
{ {
// move the file to its place // move the file to its place
JFile::copy( File::copy(
$this->templatePath . '/' . $item, $this->templatePath . '/' . $item,
$path . '/' . $new $path . '/' . $new
); );
@ -3043,7 +3046,7 @@ class Structure extends Get
// use path if exist // use path if exist
if (strlen($path) > 0) if (strlen($path) > 0)
{ {
JFile::copy( File::copy(
$this->templatePath . '/index.html', $this->templatePath . '/index.html',
$root . $path . '/index.html' $root . $path . '/index.html'
); );
@ -3052,7 +3055,7 @@ class Structure extends Get
} }
else else
{ {
JFile::copy( File::copy(
$this->templatePath . '/index.html', $root . '/index.html' $this->templatePath . '/index.html', $root . '/index.html'
); );
// count the file created // count the file created

View File

@ -12,6 +12,9 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/** /**
* Infusion class * Infusion class
*/ */
@ -2620,14 +2623,14 @@ class Infusion extends Interpretation
// build the path to place the lang file // build the path to place the lang file
$path = $this->componentPath . '/' . $p . '/language/' $path = $this->componentPath . '/' . $p . '/language/'
. $tag . '/'; . $tag . '/';
if (!JFolder::exists($path)) if (!Folder::exists($path))
{ {
JFolder::create($path); Folder::create($path);
// count the folder created // count the folder created
$this->folderCount++; $this->folderCount++;
} }
// move the file to its place // move the file to its place
JFile::copy($getPAth, $path . $file_name); File::copy($getPAth, $path . $file_name);
// count the file created // count the file created
$this->fileCount++; $this->fileCount++;
// add content to it // add content to it

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>5th March, 2021</creationDate> <creationDate>7th March, 2021</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>