Continued to add the namespacing for the file and folder classes across the system. gh-682
This commit is contained in:
@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
@ -227,7 +229,7 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
|
||||
// Move uploaded file
|
||||
jimport('joomla.filesystem.file');
|
||||
$p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
|
||||
$p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
@ -383,12 +385,12 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
// Is the package file a valid file?
|
||||
if (is_file($package))
|
||||
{
|
||||
JFile::delete($package);
|
||||
File::delete($package);
|
||||
}
|
||||
elseif (is_file(JPath::clean($package)))
|
||||
{
|
||||
// It might also be just a base filename
|
||||
JFile::delete(JPath::clean($package));
|
||||
File::delete(JPath::clean($package));
|
||||
}
|
||||
}###IMPORT_SETDATA_METHOD######IMPORT_SAVE_METHOD###
|
||||
|
||||
|
@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
@ -116,8 +118,7 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
$tmp_src = $userfile['tmp_name'];
|
||||
|
||||
// Move uploaded file
|
||||
jimport('joomla.filesystem.file');
|
||||
$p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
|
||||
$p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
@ -274,12 +275,12 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
// Is the package file a valid file?
|
||||
if (is_file($package))
|
||||
{
|
||||
JFile::delete($package);
|
||||
File::delete($package);
|
||||
}
|
||||
elseif (is_file(JPath::clean($package)))
|
||||
{
|
||||
// It might also be just a base filename
|
||||
JFile::delete(JPath::clean($package));
|
||||
File::delete(JPath::clean($package));
|
||||
}
|
||||
}
|
||||
###IMPORT_SETDATA_METHOD###
|
||||
|
@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access'); ###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_GET_MODULE_JIMPORT###
|
||||
|
||||
###CUSTOM_ADMIN_VIEW_HTML_HEADER###
|
||||
/**
|
||||
* ###Component### View class for the ###SView###
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
###ADMIN_VIEW_HTML_HEADER###
|
||||
/**
|
||||
* ###View### View class
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
###SITE_ADMIN_VIEW_HTML_HEADER###
|
||||
/**
|
||||
* ###View### View class
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
###ADMIN_VIEWS_HTML_HEADER###
|
||||
/**
|
||||
* ###Component### View class for the ###Views###
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_GET_MODULE_JIMPORT###
|
||||
|
||||
###CUSTOM_ADMIN_VIEWS_HTML_HEADER###
|
||||
/**
|
||||
* ###Component### View class for the ###SViews###
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_GET_MODULE_JIMPORT###
|
||||
|
||||
###SITE_VIEWS_HTML_HEADER###
|
||||
/**
|
||||
* ###Component### View class for the ###SViews###
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_GET_MODULE_JIMPORT###
|
||||
|
||||
###SITE_VIEW_HTML_HEADER###
|
||||
/**
|
||||
* ###Component### View class for the ###SView###
|
||||
*/
|
||||
|
@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
JHTML::_('behavior.modal');
|
||||
|
||||
/**
|
||||
@ -97,12 +99,12 @@ class com_###component###InstallerScript
|
||||
{###PREINSTALLSCRIPT###
|
||||
}
|
||||
// check if the PHPExcel stuff is still around
|
||||
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel.php'))
|
||||
if (File::exists(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel.php'))
|
||||
{
|
||||
// We need to remove this old PHPExcel folder
|
||||
$this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel');
|
||||
// We need to remove this old PHPExcel file
|
||||
JFile::delete(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel.php');
|
||||
File::delete(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel.php');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -141,7 +143,7 @@ class com_###component###InstallerScript
|
||||
*/
|
||||
protected function removeFolder($dir, $ignore = false)
|
||||
{
|
||||
if (JFolder::exists($dir))
|
||||
if (Folder::exists($dir))
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir);
|
||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
@ -171,7 +173,7 @@ class com_###component###InstallerScript
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFolder::delete($file_dir);
|
||||
Folder::delete($file_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -190,13 +192,13 @@ class com_###component###InstallerScript
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFile::delete($file_dir);
|
||||
File::delete($file_dir);
|
||||
}
|
||||
}
|
||||
// delete the root folder if not ignore found
|
||||
if (!$this->checkArray($ignore))
|
||||
{
|
||||
return JFolder::delete($dir);
|
||||
return Folder::delete($dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user