Converted all files from dos to unix, as most servers are UNIX based anyway. This fixes the linebreak mismatching issue mentioned in gh-638.
This commit is contained in:
454
script.php
454
script.php
@ -1,46 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHTML::_('behavior.modal');
|
||||
|
||||
/**
|
||||
* Script File of Componentbuilder Component
|
||||
*/
|
||||
class com_componentbuilderInstallerScript
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*/
|
||||
public function __construct(JAdapterInstance $parent) {}
|
||||
|
||||
/**
|
||||
* Called on installation
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function install(JAdapterInstance $parent) {}
|
||||
|
||||
/**
|
||||
* Called on uninstallation
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*/
|
||||
public function uninstall(JAdapterInstance $parent)
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHTML::_('behavior.modal');
|
||||
|
||||
/**
|
||||
* Script File of Componentbuilder Component
|
||||
*/
|
||||
class com_componentbuilderInstallerScript
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*/
|
||||
public function __construct(JAdapterInstance $parent) {}
|
||||
|
||||
/**
|
||||
* Called on installation
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function install(JAdapterInstance $parent) {}
|
||||
|
||||
/**
|
||||
* Called on uninstallation
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*/
|
||||
public function uninstall(JAdapterInstance $parent)
|
||||
{
|
||||
// Get Application object
|
||||
$app = JFactory::getApplication();
|
||||
@ -5501,50 +5501,50 @@ class com_componentbuilderInstallerScript
|
||||
{
|
||||
// If successfully removed Componentbuilder Joomla_plugin_files_folders_urls add queued success message.
|
||||
$app->enqueueMessage(JText::_('The com_componentbuilder.joomla_plugin_files_folders_urls type alias was removed from the <b>#__action_log_config</b> table'));
|
||||
}
|
||||
// little notice as after service, in case of bad experience with component.
|
||||
echo '<h2>Did something go wrong? Are you disappointed?</h2>
|
||||
<p>Please let me know at <a href="mailto:llewellyn@joomlacomponentbuilder.com">llewellyn@joomlacomponentbuilder.com</a>.
|
||||
<br />We at Joomla Component Builder are committed to building extensions that performs proficiently! You can help us, really!
|
||||
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
|
||||
<br />Visit us at <a href="http://www.joomlacomponentbuilder.com" target="_blank">http://www.joomlacomponentbuilder.com</a> today!</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on update
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function update(JAdapterInstance $parent){}
|
||||
|
||||
/**
|
||||
* Called before any type of action
|
||||
*
|
||||
* @param string $type Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function preflight($type, JAdapterInstance $parent)
|
||||
{
|
||||
// get application
|
||||
$app = JFactory::getApplication();
|
||||
// is redundant or so it seems ...hmmm let me know if it works again
|
||||
if ($type === 'uninstall')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// the default for both install and update
|
||||
$jversion = new JVersion();
|
||||
if (!$jversion->isCompatible('3.8.0'))
|
||||
{
|
||||
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
|
||||
return false;
|
||||
}
|
||||
// do any updates needed
|
||||
if ($type === 'update')
|
||||
}
|
||||
// little notice as after service, in case of bad experience with component.
|
||||
echo '<h2>Did something go wrong? Are you disappointed?</h2>
|
||||
<p>Please let me know at <a href="mailto:llewellyn@joomlacomponentbuilder.com">llewellyn@joomlacomponentbuilder.com</a>.
|
||||
<br />We at Joomla Component Builder are committed to building extensions that performs proficiently! You can help us, really!
|
||||
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
|
||||
<br />Visit us at <a href="http://www.joomlacomponentbuilder.com" target="_blank">http://www.joomlacomponentbuilder.com</a> today!</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on update
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function update(JAdapterInstance $parent){}
|
||||
|
||||
/**
|
||||
* Called before any type of action
|
||||
*
|
||||
* @param string $type Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function preflight($type, JAdapterInstance $parent)
|
||||
{
|
||||
// get application
|
||||
$app = JFactory::getApplication();
|
||||
// is redundant or so it seems ...hmmm let me know if it works again
|
||||
if ($type === 'uninstall')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// the default for both install and update
|
||||
$jversion = new JVersion();
|
||||
if (!$jversion->isCompatible('3.8.0'))
|
||||
{
|
||||
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
|
||||
return false;
|
||||
}
|
||||
// do any updates needed
|
||||
if ($type === 'update')
|
||||
{
|
||||
|
||||
// load the helper class
|
||||
@ -5981,39 +5981,39 @@ class com_componentbuilderInstallerScript
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// do any install needed
|
||||
if ($type === 'install')
|
||||
{
|
||||
}
|
||||
// check if the PHPExcel stuff is still around
|
||||
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel.php'))
|
||||
{
|
||||
// We need to remove this old PHPExcel folder
|
||||
$this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel');
|
||||
// We need to remove this old PHPExcel file
|
||||
JFile::delete(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel.php');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after any type of action
|
||||
*
|
||||
* @param string $type Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function postflight($type, JAdapterInstance $parent)
|
||||
{
|
||||
// get application
|
||||
|
||||
}
|
||||
// do any install needed
|
||||
if ($type === 'install')
|
||||
{
|
||||
}
|
||||
// check if the PHPExcel stuff is still around
|
||||
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel.php'))
|
||||
{
|
||||
// We need to remove this old PHPExcel folder
|
||||
$this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel');
|
||||
// We need to remove this old PHPExcel file
|
||||
JFile::delete(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel.php');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after any type of action
|
||||
*
|
||||
* @param string $type Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function postflight($type, JAdapterInstance $parent)
|
||||
{
|
||||
// get application
|
||||
$app = JFactory::getApplication();
|
||||
// We check if we have dynamic folders to copy
|
||||
$this->setDynamicF0ld3rs($app, $parent);
|
||||
// set the default component settings
|
||||
if ($type === 'install')
|
||||
$this->setDynamicF0ld3rs($app, $parent);
|
||||
// set the default component settings
|
||||
if ($type === 'install')
|
||||
{
|
||||
|
||||
// Get The Database object
|
||||
@ -7451,10 +7451,10 @@ class com_componentbuilderInstallerScript
|
||||
$joomla_plugin_files_folders_urls_action_log_config->text_prefix = 'COM_COMPONENTBUILDER';
|
||||
|
||||
// Set the object into the action log config table.
|
||||
$joomla_plugin_files_folders_urls_Inserted = $db->insertObject('#__action_log_config', $joomla_plugin_files_folders_urls_action_log_config);
|
||||
}
|
||||
// do any updates needed
|
||||
if ($type === 'update')
|
||||
$joomla_plugin_files_folders_urls_Inserted = $db->insertObject('#__action_log_config', $joomla_plugin_files_folders_urls_action_log_config);
|
||||
}
|
||||
// do any updates needed
|
||||
if ($type === 'update')
|
||||
{
|
||||
|
||||
// Get The Database object
|
||||
@ -10871,110 +10871,110 @@ class com_componentbuilderInstallerScript
|
||||
else
|
||||
{
|
||||
$joomla_plugin_files_folders_urls_action_log_config_Inserted = $db->insertObject('#__action_log_config', $joomla_plugin_files_folders_urls_action_log_config);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove folders with files
|
||||
*
|
||||
* @param string $dir The path to folder to remove
|
||||
* @param boolean $ignore The folders and files to ignore and not remove
|
||||
*
|
||||
* @return boolean True in all is removed
|
||||
*
|
||||
*/
|
||||
protected function removeFolder($dir, $ignore = false)
|
||||
{
|
||||
if (JFolder::exists($dir))
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir);
|
||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
// remove ending /
|
||||
$dir = rtrim($dir, '/');
|
||||
// now loop the files & folders
|
||||
foreach ($it as $file)
|
||||
{
|
||||
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
|
||||
// set file dir
|
||||
$file_dir = $file->getPathname();
|
||||
// check if this is a dir or a file
|
||||
if ($file->isDir())
|
||||
{
|
||||
$keeper = false;
|
||||
if ($this->checkArray($ignore))
|
||||
{
|
||||
foreach ($ignore as $keep)
|
||||
{
|
||||
if (strpos($file_dir, $dir.'/'.$keep) !== false)
|
||||
{
|
||||
$keeper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($keeper)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFolder::delete($file_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$keeper = false;
|
||||
if ($this->checkArray($ignore))
|
||||
{
|
||||
foreach ($ignore as $keep)
|
||||
{
|
||||
if (strpos($file_dir, $dir.'/'.$keep) !== false)
|
||||
{
|
||||
$keeper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($keeper)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFile::delete($file_dir);
|
||||
}
|
||||
}
|
||||
// delete the root folder if not ignore found
|
||||
if (!$this->checkArray($ignore))
|
||||
{
|
||||
return JFolder::delete($dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an array with a length
|
||||
*
|
||||
* @input array The array to check
|
||||
*
|
||||
* @returns bool/int number of items in array on success
|
||||
*/
|
||||
protected function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
|
||||
{
|
||||
// also make sure the empty strings are removed
|
||||
if ($removeEmptyString)
|
||||
{
|
||||
foreach ($array as $key => $string)
|
||||
{
|
||||
if (empty($string))
|
||||
{
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
return $this->checkArray($array, false);
|
||||
}
|
||||
return $nr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove folders with files
|
||||
*
|
||||
* @param string $dir The path to folder to remove
|
||||
* @param boolean $ignore The folders and files to ignore and not remove
|
||||
*
|
||||
* @return boolean True in all is removed
|
||||
*
|
||||
*/
|
||||
protected function removeFolder($dir, $ignore = false)
|
||||
{
|
||||
if (JFolder::exists($dir))
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir);
|
||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
// remove ending /
|
||||
$dir = rtrim($dir, '/');
|
||||
// now loop the files & folders
|
||||
foreach ($it as $file)
|
||||
{
|
||||
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
|
||||
// set file dir
|
||||
$file_dir = $file->getPathname();
|
||||
// check if this is a dir or a file
|
||||
if ($file->isDir())
|
||||
{
|
||||
$keeper = false;
|
||||
if ($this->checkArray($ignore))
|
||||
{
|
||||
foreach ($ignore as $keep)
|
||||
{
|
||||
if (strpos($file_dir, $dir.'/'.$keep) !== false)
|
||||
{
|
||||
$keeper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($keeper)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFolder::delete($file_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$keeper = false;
|
||||
if ($this->checkArray($ignore))
|
||||
{
|
||||
foreach ($ignore as $keep)
|
||||
{
|
||||
if (strpos($file_dir, $dir.'/'.$keep) !== false)
|
||||
{
|
||||
$keeper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($keeper)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFile::delete($file_dir);
|
||||
}
|
||||
}
|
||||
// delete the root folder if not ignore found
|
||||
if (!$this->checkArray($ignore))
|
||||
{
|
||||
return JFolder::delete($dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an array with a length
|
||||
*
|
||||
* @input array The array to check
|
||||
*
|
||||
* @returns bool/int number of items in array on success
|
||||
*/
|
||||
protected function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
|
||||
{
|
||||
// also make sure the empty strings are removed
|
||||
if ($removeEmptyString)
|
||||
{
|
||||
foreach ($array as $key => $string)
|
||||
{
|
||||
if (empty($string))
|
||||
{
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
return $this->checkArray($array, false);
|
||||
}
|
||||
return $nr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -11010,5 +11010,5 @@ class com_componentbuilderInstallerScript
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user