11942 lines
741 KiB
PHP
11942 lines
741 KiB
PHP
<?php
|
|
/**
|
|
* @package Joomla.Component.Builder
|
|
*
|
|
* @created 30th April, 2015
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
* @git Joomla Component Builder <https://git.vdm.dev/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');
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\Language\Text;
|
|
use Joomla\CMS\Filesystem\File;
|
|
use Joomla\CMS\Filesystem\Folder;
|
|
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
|
|
use Joomla\CMS\Version;
|
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
|
use VDM\Joomla\FOF\Encrypt\AES;
|
|
use VDM\Joomla\Utilities\StringHelper;
|
|
use VDM\Joomla\Utilities\JsonHelper;
|
|
use VDM\Joomla\Utilities\ArrayHelper;
|
|
use VDM\Joomla\Componentbuilder\PHPConfigurationChecker;
|
|
use VDM\Joomla\Componentbuilder\Table\SchemaChecker;
|
|
use VDM\Joomla\Utilities\GetHelper;
|
|
HTML::_('bootstrap.renderModal');
|
|
|
|
/**
|
|
* Script File of Componentbuilder Component
|
|
*
|
|
* @since 1.5.0
|
|
*/
|
|
class Com_ComponentbuilderInstallerScript
|
|
{
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param ComponentAdapter $parent The object responsible for running this script
|
|
* @since 1.5.0
|
|
*/
|
|
public function __construct(ComponentAdapter $parent) {}
|
|
|
|
/**
|
|
* Called on installation
|
|
*
|
|
* @param ComponentAdapter $parent The object responsible for running this script
|
|
*
|
|
* @return boolean True on success
|
|
* @since 1.5.0
|
|
*/
|
|
public function install(ComponentAdapter $parent) {}
|
|
|
|
/**
|
|
* Called on uninstallation
|
|
*
|
|
* @param ComponentAdapter $parent The object responsible for running this script
|
|
*
|
|
* @since 1.5.0
|
|
*/
|
|
public function uninstall(ComponentAdapter $parent)
|
|
{
|
|
// Get Application object
|
|
$app = Factory::getApplication();
|
|
|
|
// Get The Database object
|
|
$db = Factory::getDbo();
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Joomla_component alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_component') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$joomla_component_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($joomla_component_found)
|
|
{
|
|
// Since there are load the needed joomla_component type ids
|
|
$joomla_component_ids = $db->loadColumn();
|
|
// Remove Joomla_component from the content type table
|
|
$joomla_component_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_component') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($joomla_component_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_component items
|
|
$joomla_component_done = $db->execute();
|
|
if ($joomla_component_done)
|
|
{
|
|
// If successfully remove Joomla_component add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_component) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Joomla_component items from the contentitem tag map table
|
|
$joomla_component_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_component') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($joomla_component_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_component items
|
|
$joomla_component_done = $db->execute();
|
|
if ($joomla_component_done)
|
|
{
|
|
// If successfully remove Joomla_component add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_component) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Joomla_component items from the ucm content table
|
|
$joomla_component_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.joomla_component') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($joomla_component_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_component items
|
|
$joomla_component_done = $db->execute();
|
|
if ($joomla_component_done)
|
|
{
|
|
// If successfully removed Joomla_component add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_component) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Joomla_component items are cleared from DB
|
|
foreach ($joomla_component_ids as $joomla_component_id)
|
|
{
|
|
// Remove Joomla_component items from the ucm base table
|
|
$joomla_component_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_component_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($joomla_component_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_component items
|
|
$db->execute();
|
|
|
|
// Remove Joomla_component items from the ucm history table
|
|
$joomla_component_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_component_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($joomla_component_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_component items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Joomla_module alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_module') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$joomla_module_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($joomla_module_found)
|
|
{
|
|
// Since there are load the needed joomla_module type ids
|
|
$joomla_module_ids = $db->loadColumn();
|
|
// Remove Joomla_module from the content type table
|
|
$joomla_module_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_module') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($joomla_module_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_module items
|
|
$joomla_module_done = $db->execute();
|
|
if ($joomla_module_done)
|
|
{
|
|
// If successfully remove Joomla_module add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_module) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Joomla_module items from the contentitem tag map table
|
|
$joomla_module_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_module') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($joomla_module_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_module items
|
|
$joomla_module_done = $db->execute();
|
|
if ($joomla_module_done)
|
|
{
|
|
// If successfully remove Joomla_module add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_module) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Joomla_module items from the ucm content table
|
|
$joomla_module_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.joomla_module') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($joomla_module_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_module items
|
|
$joomla_module_done = $db->execute();
|
|
if ($joomla_module_done)
|
|
{
|
|
// If successfully removed Joomla_module add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_module) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Joomla_module items are cleared from DB
|
|
foreach ($joomla_module_ids as $joomla_module_id)
|
|
{
|
|
// Remove Joomla_module items from the ucm base table
|
|
$joomla_module_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_module_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($joomla_module_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_module items
|
|
$db->execute();
|
|
|
|
// Remove Joomla_module items from the ucm history table
|
|
$joomla_module_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_module_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($joomla_module_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_module items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Joomla_plugin alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$joomla_plugin_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($joomla_plugin_found)
|
|
{
|
|
// Since there are load the needed joomla_plugin type ids
|
|
$joomla_plugin_ids = $db->loadColumn();
|
|
// Remove Joomla_plugin from the content type table
|
|
$joomla_plugin_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($joomla_plugin_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_plugin items
|
|
$joomla_plugin_done = $db->execute();
|
|
if ($joomla_plugin_done)
|
|
{
|
|
// If successfully remove Joomla_plugin add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Joomla_plugin items from the contentitem tag map table
|
|
$joomla_plugin_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($joomla_plugin_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_plugin items
|
|
$joomla_plugin_done = $db->execute();
|
|
if ($joomla_plugin_done)
|
|
{
|
|
// If successfully remove Joomla_plugin add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Joomla_plugin items from the ucm content table
|
|
$joomla_plugin_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.joomla_plugin') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($joomla_plugin_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_plugin items
|
|
$joomla_plugin_done = $db->execute();
|
|
if ($joomla_plugin_done)
|
|
{
|
|
// If successfully removed Joomla_plugin add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Joomla_plugin items are cleared from DB
|
|
foreach ($joomla_plugin_ids as $joomla_plugin_id)
|
|
{
|
|
// Remove Joomla_plugin items from the ucm base table
|
|
$joomla_plugin_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($joomla_plugin_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_plugin items
|
|
$db->execute();
|
|
|
|
// Remove Joomla_plugin items from the ucm history table
|
|
$joomla_plugin_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($joomla_plugin_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_plugin items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Joomla_power alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_power') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$joomla_power_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($joomla_power_found)
|
|
{
|
|
// Since there are load the needed joomla_power type ids
|
|
$joomla_power_ids = $db->loadColumn();
|
|
// Remove Joomla_power from the content type table
|
|
$joomla_power_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_power') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($joomla_power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_power items
|
|
$joomla_power_done = $db->execute();
|
|
if ($joomla_power_done)
|
|
{
|
|
// If successfully remove Joomla_power add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_power) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Joomla_power items from the contentitem tag map table
|
|
$joomla_power_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_power') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($joomla_power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_power items
|
|
$joomla_power_done = $db->execute();
|
|
if ($joomla_power_done)
|
|
{
|
|
// If successfully remove Joomla_power add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_power) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Joomla_power items from the ucm content table
|
|
$joomla_power_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.joomla_power') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($joomla_power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_power items
|
|
$joomla_power_done = $db->execute();
|
|
if ($joomla_power_done)
|
|
{
|
|
// If successfully removed Joomla_power add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.joomla_power) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Joomla_power items are cleared from DB
|
|
foreach ($joomla_power_ids as $joomla_power_id)
|
|
{
|
|
// Remove Joomla_power items from the ucm base table
|
|
$joomla_power_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_power_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($joomla_power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_power items
|
|
$db->execute();
|
|
|
|
// Remove Joomla_power items from the ucm history table
|
|
$joomla_power_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_power_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($joomla_power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Joomla_power items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Power alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.power') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$power_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($power_found)
|
|
{
|
|
// Since there are load the needed power type ids
|
|
$power_ids = $db->loadColumn();
|
|
// Remove Power from the content type table
|
|
$power_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.power') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Power items
|
|
$power_done = $db->execute();
|
|
if ($power_done)
|
|
{
|
|
// If successfully remove Power add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.power) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Power items from the contentitem tag map table
|
|
$power_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.power') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Power items
|
|
$power_done = $db->execute();
|
|
if ($power_done)
|
|
{
|
|
// If successfully remove Power add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.power) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Power items from the ucm content table
|
|
$power_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.power') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Power items
|
|
$power_done = $db->execute();
|
|
if ($power_done)
|
|
{
|
|
// If successfully removed Power add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.power) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Power items are cleared from DB
|
|
foreach ($power_ids as $power_id)
|
|
{
|
|
// Remove Power items from the ucm base table
|
|
$power_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $power_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Power items
|
|
$db->execute();
|
|
|
|
// Remove Power items from the ucm history table
|
|
$power_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $power_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($power_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Power items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Admin_view alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_view') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$admin_view_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($admin_view_found)
|
|
{
|
|
// Since there are load the needed admin_view type ids
|
|
$admin_view_ids = $db->loadColumn();
|
|
// Remove Admin_view from the content type table
|
|
$admin_view_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_view items
|
|
$admin_view_done = $db->execute();
|
|
if ($admin_view_done)
|
|
{
|
|
// If successfully remove Admin_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_view) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Admin_view items from the contentitem tag map table
|
|
$admin_view_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_view items
|
|
$admin_view_done = $db->execute();
|
|
if ($admin_view_done)
|
|
{
|
|
// If successfully remove Admin_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_view) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Admin_view items from the ucm content table
|
|
$admin_view_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.admin_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_view items
|
|
$admin_view_done = $db->execute();
|
|
if ($admin_view_done)
|
|
{
|
|
// If successfully removed Admin_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_view) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Admin_view items are cleared from DB
|
|
foreach ($admin_view_ids as $admin_view_id)
|
|
{
|
|
// Remove Admin_view items from the ucm base table
|
|
$admin_view_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $admin_view_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_view items
|
|
$db->execute();
|
|
|
|
// Remove Admin_view items from the ucm history table
|
|
$admin_view_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $admin_view_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_view items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Custom_admin_view alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.custom_admin_view') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$custom_admin_view_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($custom_admin_view_found)
|
|
{
|
|
// Since there are load the needed custom_admin_view type ids
|
|
$custom_admin_view_ids = $db->loadColumn();
|
|
// Remove Custom_admin_view from the content type table
|
|
$custom_admin_view_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.custom_admin_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($custom_admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_admin_view items
|
|
$custom_admin_view_done = $db->execute();
|
|
if ($custom_admin_view_done)
|
|
{
|
|
// If successfully remove Custom_admin_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.custom_admin_view) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Custom_admin_view items from the contentitem tag map table
|
|
$custom_admin_view_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.custom_admin_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($custom_admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_admin_view items
|
|
$custom_admin_view_done = $db->execute();
|
|
if ($custom_admin_view_done)
|
|
{
|
|
// If successfully remove Custom_admin_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.custom_admin_view) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Custom_admin_view items from the ucm content table
|
|
$custom_admin_view_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.custom_admin_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($custom_admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_admin_view items
|
|
$custom_admin_view_done = $db->execute();
|
|
if ($custom_admin_view_done)
|
|
{
|
|
// If successfully removed Custom_admin_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.custom_admin_view) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Custom_admin_view items are cleared from DB
|
|
foreach ($custom_admin_view_ids as $custom_admin_view_id)
|
|
{
|
|
// Remove Custom_admin_view items from the ucm base table
|
|
$custom_admin_view_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $custom_admin_view_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($custom_admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_admin_view items
|
|
$db->execute();
|
|
|
|
// Remove Custom_admin_view items from the ucm history table
|
|
$custom_admin_view_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $custom_admin_view_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($custom_admin_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_admin_view items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Site_view alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.site_view') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$site_view_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($site_view_found)
|
|
{
|
|
// Since there are load the needed site_view type ids
|
|
$site_view_ids = $db->loadColumn();
|
|
// Remove Site_view from the content type table
|
|
$site_view_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.site_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($site_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Site_view items
|
|
$site_view_done = $db->execute();
|
|
if ($site_view_done)
|
|
{
|
|
// If successfully remove Site_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.site_view) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Site_view items from the contentitem tag map table
|
|
$site_view_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.site_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($site_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Site_view items
|
|
$site_view_done = $db->execute();
|
|
if ($site_view_done)
|
|
{
|
|
// If successfully remove Site_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.site_view) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Site_view items from the ucm content table
|
|
$site_view_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.site_view') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($site_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Site_view items
|
|
$site_view_done = $db->execute();
|
|
if ($site_view_done)
|
|
{
|
|
// If successfully removed Site_view add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.site_view) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Site_view items are cleared from DB
|
|
foreach ($site_view_ids as $site_view_id)
|
|
{
|
|
// Remove Site_view items from the ucm base table
|
|
$site_view_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $site_view_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($site_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Site_view items
|
|
$db->execute();
|
|
|
|
// Remove Site_view items from the ucm history table
|
|
$site_view_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $site_view_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($site_view_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Site_view items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Template alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.template') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$template_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($template_found)
|
|
{
|
|
// Since there are load the needed template type ids
|
|
$template_ids = $db->loadColumn();
|
|
// Remove Template from the content type table
|
|
$template_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.template') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($template_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Template items
|
|
$template_done = $db->execute();
|
|
if ($template_done)
|
|
{
|
|
// If successfully remove Template add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.template) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Template items from the contentitem tag map table
|
|
$template_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.template') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($template_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Template items
|
|
$template_done = $db->execute();
|
|
if ($template_done)
|
|
{
|
|
// If successfully remove Template add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.template) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Template items from the ucm content table
|
|
$template_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.template') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($template_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Template items
|
|
$template_done = $db->execute();
|
|
if ($template_done)
|
|
{
|
|
// If successfully removed Template add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.template) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Template items are cleared from DB
|
|
foreach ($template_ids as $template_id)
|
|
{
|
|
// Remove Template items from the ucm base table
|
|
$template_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $template_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($template_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Template items
|
|
$db->execute();
|
|
|
|
// Remove Template items from the ucm history table
|
|
$template_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $template_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($template_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Template items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Layout alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.layout') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$layout_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($layout_found)
|
|
{
|
|
// Since there are load the needed layout type ids
|
|
$layout_ids = $db->loadColumn();
|
|
// Remove Layout from the content type table
|
|
$layout_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.layout') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($layout_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Layout items
|
|
$layout_done = $db->execute();
|
|
if ($layout_done)
|
|
{
|
|
// If successfully remove Layout add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.layout) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Layout items from the contentitem tag map table
|
|
$layout_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.layout') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($layout_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Layout items
|
|
$layout_done = $db->execute();
|
|
if ($layout_done)
|
|
{
|
|
// If successfully remove Layout add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.layout) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Layout items from the ucm content table
|
|
$layout_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.layout') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($layout_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Layout items
|
|
$layout_done = $db->execute();
|
|
if ($layout_done)
|
|
{
|
|
// If successfully removed Layout add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.layout) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Layout items are cleared from DB
|
|
foreach ($layout_ids as $layout_id)
|
|
{
|
|
// Remove Layout items from the ucm base table
|
|
$layout_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $layout_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($layout_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Layout items
|
|
$db->execute();
|
|
|
|
// Remove Layout items from the ucm history table
|
|
$layout_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $layout_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($layout_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Layout items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Dynamic_get alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.dynamic_get') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$dynamic_get_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($dynamic_get_found)
|
|
{
|
|
// Since there are load the needed dynamic_get type ids
|
|
$dynamic_get_ids = $db->loadColumn();
|
|
// Remove Dynamic_get from the content type table
|
|
$dynamic_get_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.dynamic_get') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($dynamic_get_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Dynamic_get items
|
|
$dynamic_get_done = $db->execute();
|
|
if ($dynamic_get_done)
|
|
{
|
|
// If successfully remove Dynamic_get add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.dynamic_get) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Dynamic_get items from the contentitem tag map table
|
|
$dynamic_get_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.dynamic_get') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($dynamic_get_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Dynamic_get items
|
|
$dynamic_get_done = $db->execute();
|
|
if ($dynamic_get_done)
|
|
{
|
|
// If successfully remove Dynamic_get add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.dynamic_get) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Dynamic_get items from the ucm content table
|
|
$dynamic_get_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.dynamic_get') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($dynamic_get_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Dynamic_get items
|
|
$dynamic_get_done = $db->execute();
|
|
if ($dynamic_get_done)
|
|
{
|
|
// If successfully removed Dynamic_get add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.dynamic_get) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Dynamic_get items are cleared from DB
|
|
foreach ($dynamic_get_ids as $dynamic_get_id)
|
|
{
|
|
// Remove Dynamic_get items from the ucm base table
|
|
$dynamic_get_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $dynamic_get_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($dynamic_get_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Dynamic_get items
|
|
$db->execute();
|
|
|
|
// Remove Dynamic_get items from the ucm history table
|
|
$dynamic_get_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $dynamic_get_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($dynamic_get_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Dynamic_get items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Custom_code alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.custom_code') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$custom_code_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($custom_code_found)
|
|
{
|
|
// Since there are load the needed custom_code type ids
|
|
$custom_code_ids = $db->loadColumn();
|
|
// Remove Custom_code from the content type table
|
|
$custom_code_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.custom_code') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($custom_code_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_code items
|
|
$custom_code_done = $db->execute();
|
|
if ($custom_code_done)
|
|
{
|
|
// If successfully remove Custom_code add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.custom_code) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Custom_code items from the contentitem tag map table
|
|
$custom_code_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.custom_code') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($custom_code_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_code items
|
|
$custom_code_done = $db->execute();
|
|
if ($custom_code_done)
|
|
{
|
|
// If successfully remove Custom_code add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.custom_code) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Custom_code items from the ucm content table
|
|
$custom_code_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.custom_code') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($custom_code_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_code items
|
|
$custom_code_done = $db->execute();
|
|
if ($custom_code_done)
|
|
{
|
|
// If successfully removed Custom_code add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.custom_code) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Custom_code items are cleared from DB
|
|
foreach ($custom_code_ids as $custom_code_id)
|
|
{
|
|
// Remove Custom_code items from the ucm base table
|
|
$custom_code_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $custom_code_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($custom_code_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_code items
|
|
$db->execute();
|
|
|
|
// Remove Custom_code items from the ucm history table
|
|
$custom_code_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $custom_code_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($custom_code_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Custom_code items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Class_property alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_property') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$class_property_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($class_property_found)
|
|
{
|
|
// Since there are load the needed class_property type ids
|
|
$class_property_ids = $db->loadColumn();
|
|
// Remove Class_property from the content type table
|
|
$class_property_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_property') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($class_property_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_property items
|
|
$class_property_done = $db->execute();
|
|
if ($class_property_done)
|
|
{
|
|
// If successfully remove Class_property add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.class_property) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Class_property items from the contentitem tag map table
|
|
$class_property_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_property') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($class_property_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_property items
|
|
$class_property_done = $db->execute();
|
|
if ($class_property_done)
|
|
{
|
|
// If successfully remove Class_property add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.class_property) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Class_property items from the ucm content table
|
|
$class_property_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.class_property') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($class_property_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_property items
|
|
$class_property_done = $db->execute();
|
|
if ($class_property_done)
|
|
{
|
|
// If successfully removed Class_property add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.class_property) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Class_property items are cleared from DB
|
|
foreach ($class_property_ids as $class_property_id)
|
|
{
|
|
// Remove Class_property items from the ucm base table
|
|
$class_property_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_property_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($class_property_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_property items
|
|
$db->execute();
|
|
|
|
// Remove Class_property items from the ucm history table
|
|
$class_property_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_property_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($class_property_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_property items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Class_method alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_method') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$class_method_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($class_method_found)
|
|
{
|
|
// Since there are load the needed class_method type ids
|
|
$class_method_ids = $db->loadColumn();
|
|
// Remove Class_method from the content type table
|
|
$class_method_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_method') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($class_method_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_method items
|
|
$class_method_done = $db->execute();
|
|
if ($class_method_done)
|
|
{
|
|
// If successfully remove Class_method add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.class_method) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Class_method items from the contentitem tag map table
|
|
$class_method_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_method') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($class_method_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_method items
|
|
$class_method_done = $db->execute();
|
|
if ($class_method_done)
|
|
{
|
|
// If successfully remove Class_method add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.class_method) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Class_method items from the ucm content table
|
|
$class_method_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.class_method') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($class_method_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_method items
|
|
$class_method_done = $db->execute();
|
|
if ($class_method_done)
|
|
{
|
|
// If successfully removed Class_method add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.class_method) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Class_method items are cleared from DB
|
|
foreach ($class_method_ids as $class_method_id)
|
|
{
|
|
// Remove Class_method items from the ucm base table
|
|
$class_method_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_method_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($class_method_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_method items
|
|
$db->execute();
|
|
|
|
// Remove Class_method items from the ucm history table
|
|
$class_method_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_method_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($class_method_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Class_method items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Placeholder alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.placeholder') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$placeholder_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($placeholder_found)
|
|
{
|
|
// Since there are load the needed placeholder type ids
|
|
$placeholder_ids = $db->loadColumn();
|
|
// Remove Placeholder from the content type table
|
|
$placeholder_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.placeholder') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($placeholder_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Placeholder items
|
|
$placeholder_done = $db->execute();
|
|
if ($placeholder_done)
|
|
{
|
|
// If successfully remove Placeholder add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.placeholder) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Placeholder items from the contentitem tag map table
|
|
$placeholder_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.placeholder') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($placeholder_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Placeholder items
|
|
$placeholder_done = $db->execute();
|
|
if ($placeholder_done)
|
|
{
|
|
// If successfully remove Placeholder add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.placeholder) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Placeholder items from the ucm content table
|
|
$placeholder_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.placeholder') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($placeholder_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Placeholder items
|
|
$placeholder_done = $db->execute();
|
|
if ($placeholder_done)
|
|
{
|
|
// If successfully removed Placeholder add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.placeholder) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Placeholder items are cleared from DB
|
|
foreach ($placeholder_ids as $placeholder_id)
|
|
{
|
|
// Remove Placeholder items from the ucm base table
|
|
$placeholder_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $placeholder_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($placeholder_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Placeholder items
|
|
$db->execute();
|
|
|
|
// Remove Placeholder items from the ucm history table
|
|
$placeholder_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $placeholder_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($placeholder_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Placeholder items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Library alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.library') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$library_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($library_found)
|
|
{
|
|
// Since there are load the needed library type ids
|
|
$library_ids = $db->loadColumn();
|
|
// Remove Library from the content type table
|
|
$library_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.library') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($library_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Library items
|
|
$library_done = $db->execute();
|
|
if ($library_done)
|
|
{
|
|
// If successfully remove Library add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.library) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Library items from the contentitem tag map table
|
|
$library_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.library') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($library_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Library items
|
|
$library_done = $db->execute();
|
|
if ($library_done)
|
|
{
|
|
// If successfully remove Library add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.library) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Library items from the ucm content table
|
|
$library_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.library') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($library_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Library items
|
|
$library_done = $db->execute();
|
|
if ($library_done)
|
|
{
|
|
// If successfully removed Library add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.library) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Library items are cleared from DB
|
|
foreach ($library_ids as $library_id)
|
|
{
|
|
// Remove Library items from the ucm base table
|
|
$library_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $library_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($library_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Library items
|
|
$db->execute();
|
|
|
|
// Remove Library items from the ucm history table
|
|
$library_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $library_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($library_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Library items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Snippet alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.snippet') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$snippet_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($snippet_found)
|
|
{
|
|
// Since there are load the needed snippet type ids
|
|
$snippet_ids = $db->loadColumn();
|
|
// Remove Snippet from the content type table
|
|
$snippet_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.snippet') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($snippet_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Snippet items
|
|
$snippet_done = $db->execute();
|
|
if ($snippet_done)
|
|
{
|
|
// If successfully remove Snippet add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.snippet) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Snippet items from the contentitem tag map table
|
|
$snippet_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.snippet') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($snippet_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Snippet items
|
|
$snippet_done = $db->execute();
|
|
if ($snippet_done)
|
|
{
|
|
// If successfully remove Snippet add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.snippet) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Snippet items from the ucm content table
|
|
$snippet_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.snippet') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($snippet_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Snippet items
|
|
$snippet_done = $db->execute();
|
|
if ($snippet_done)
|
|
{
|
|
// If successfully removed Snippet add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.snippet) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Snippet items are cleared from DB
|
|
foreach ($snippet_ids as $snippet_id)
|
|
{
|
|
// Remove Snippet items from the ucm base table
|
|
$snippet_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $snippet_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($snippet_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Snippet items
|
|
$db->execute();
|
|
|
|
// Remove Snippet items from the ucm history table
|
|
$snippet_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $snippet_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($snippet_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Snippet items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Validation_rule alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.validation_rule') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$validation_rule_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($validation_rule_found)
|
|
{
|
|
// Since there are load the needed validation_rule type ids
|
|
$validation_rule_ids = $db->loadColumn();
|
|
// Remove Validation_rule from the content type table
|
|
$validation_rule_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.validation_rule') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($validation_rule_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Validation_rule items
|
|
$validation_rule_done = $db->execute();
|
|
if ($validation_rule_done)
|
|
{
|
|
// If successfully remove Validation_rule add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.validation_rule) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Validation_rule items from the contentitem tag map table
|
|
$validation_rule_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.validation_rule') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($validation_rule_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Validation_rule items
|
|
$validation_rule_done = $db->execute();
|
|
if ($validation_rule_done)
|
|
{
|
|
// If successfully remove Validation_rule add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.validation_rule) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Validation_rule items from the ucm content table
|
|
$validation_rule_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.validation_rule') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($validation_rule_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Validation_rule items
|
|
$validation_rule_done = $db->execute();
|
|
if ($validation_rule_done)
|
|
{
|
|
// If successfully removed Validation_rule add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.validation_rule) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Validation_rule items are cleared from DB
|
|
foreach ($validation_rule_ids as $validation_rule_id)
|
|
{
|
|
// Remove Validation_rule items from the ucm base table
|
|
$validation_rule_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $validation_rule_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($validation_rule_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Validation_rule items
|
|
$db->execute();
|
|
|
|
// Remove Validation_rule items from the ucm history table
|
|
$validation_rule_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $validation_rule_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($validation_rule_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Validation_rule items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Field alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.field') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$field_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($field_found)
|
|
{
|
|
// Since there are load the needed field type ids
|
|
$field_ids = $db->loadColumn();
|
|
// Remove Field from the content type table
|
|
$field_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.field') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($field_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field items
|
|
$field_done = $db->execute();
|
|
if ($field_done)
|
|
{
|
|
// If successfully remove Field add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.field) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Field items from the contentitem tag map table
|
|
$field_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.field') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($field_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field items
|
|
$field_done = $db->execute();
|
|
if ($field_done)
|
|
{
|
|
// If successfully remove Field add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.field) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Field items from the ucm content table
|
|
$field_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.field') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($field_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field items
|
|
$field_done = $db->execute();
|
|
if ($field_done)
|
|
{
|
|
// If successfully removed Field add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.field) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Field items are cleared from DB
|
|
foreach ($field_ids as $field_id)
|
|
{
|
|
// Remove Field items from the ucm base table
|
|
$field_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $field_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($field_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field items
|
|
$db->execute();
|
|
|
|
// Remove Field items from the ucm history table
|
|
$field_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $field_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($field_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Field catid alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.field.category') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$field_catid_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($field_catid_found)
|
|
{
|
|
// Since there are load the needed field_catid type ids
|
|
$field_catid_ids = $db->loadColumn();
|
|
// Remove Field catid from the content type table
|
|
$field_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.field.category') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($field_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field catid items
|
|
$field_catid_done = $db->execute();
|
|
if ($field_catid_done)
|
|
{
|
|
// If successfully remove Field catid add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.field.category) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Field catid items from the contentitem tag map table
|
|
$field_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.field.category') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($field_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field catid items
|
|
$field_catid_done = $db->execute();
|
|
if ($field_catid_done)
|
|
{
|
|
// If successfully remove Field catid add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.field.category) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Field catid items from the ucm content table
|
|
$field_catid_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.field.category') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($field_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field catid items
|
|
$field_catid_done = $db->execute();
|
|
if ($field_catid_done)
|
|
{
|
|
// If successfully removed Field catid add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.field.category) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Field catid items are cleared from DB
|
|
foreach ($field_catid_ids as $field_catid_id)
|
|
{
|
|
// Remove Field catid items from the ucm base table
|
|
$field_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $field_catid_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($field_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field catid items
|
|
$db->execute();
|
|
|
|
// Remove Field catid items from the ucm history table
|
|
$field_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $field_catid_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($field_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Field catid items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Fieldtype alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.fieldtype') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$fieldtype_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($fieldtype_found)
|
|
{
|
|
// Since there are load the needed fieldtype type ids
|
|
$fieldtype_ids = $db->loadColumn();
|
|
// Remove Fieldtype from the content type table
|
|
$fieldtype_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.fieldtype') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($fieldtype_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype items
|
|
$fieldtype_done = $db->execute();
|
|
if ($fieldtype_done)
|
|
{
|
|
// If successfully remove Fieldtype add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.fieldtype) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Fieldtype items from the contentitem tag map table
|
|
$fieldtype_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.fieldtype') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($fieldtype_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype items
|
|
$fieldtype_done = $db->execute();
|
|
if ($fieldtype_done)
|
|
{
|
|
// If successfully remove Fieldtype add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.fieldtype) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Fieldtype items from the ucm content table
|
|
$fieldtype_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.fieldtype') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($fieldtype_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype items
|
|
$fieldtype_done = $db->execute();
|
|
if ($fieldtype_done)
|
|
{
|
|
// If successfully removed Fieldtype add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.fieldtype) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Fieldtype items are cleared from DB
|
|
foreach ($fieldtype_ids as $fieldtype_id)
|
|
{
|
|
// Remove Fieldtype items from the ucm base table
|
|
$fieldtype_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $fieldtype_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($fieldtype_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype items
|
|
$db->execute();
|
|
|
|
// Remove Fieldtype items from the ucm history table
|
|
$fieldtype_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $fieldtype_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($fieldtype_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Fieldtype catid alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.fieldtype.category') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$fieldtype_catid_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($fieldtype_catid_found)
|
|
{
|
|
// Since there are load the needed fieldtype_catid type ids
|
|
$fieldtype_catid_ids = $db->loadColumn();
|
|
// Remove Fieldtype catid from the content type table
|
|
$fieldtype_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.fieldtype.category') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($fieldtype_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype catid items
|
|
$fieldtype_catid_done = $db->execute();
|
|
if ($fieldtype_catid_done)
|
|
{
|
|
// If successfully remove Fieldtype catid add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.fieldtype.category) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Fieldtype catid items from the contentitem tag map table
|
|
$fieldtype_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.fieldtype.category') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($fieldtype_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype catid items
|
|
$fieldtype_catid_done = $db->execute();
|
|
if ($fieldtype_catid_done)
|
|
{
|
|
// If successfully remove Fieldtype catid add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.fieldtype.category) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Fieldtype catid items from the ucm content table
|
|
$fieldtype_catid_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.fieldtype.category') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($fieldtype_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype catid items
|
|
$fieldtype_catid_done = $db->execute();
|
|
if ($fieldtype_catid_done)
|
|
{
|
|
// If successfully removed Fieldtype catid add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.fieldtype.category) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Fieldtype catid items are cleared from DB
|
|
foreach ($fieldtype_catid_ids as $fieldtype_catid_id)
|
|
{
|
|
// Remove Fieldtype catid items from the ucm base table
|
|
$fieldtype_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $fieldtype_catid_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($fieldtype_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype catid items
|
|
$db->execute();
|
|
|
|
// Remove Fieldtype catid items from the ucm history table
|
|
$fieldtype_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $fieldtype_catid_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($fieldtype_catid_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Fieldtype catid items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Language_translation alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.language_translation') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$language_translation_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($language_translation_found)
|
|
{
|
|
// Since there are load the needed language_translation type ids
|
|
$language_translation_ids = $db->loadColumn();
|
|
// Remove Language_translation from the content type table
|
|
$language_translation_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.language_translation') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($language_translation_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language_translation items
|
|
$language_translation_done = $db->execute();
|
|
if ($language_translation_done)
|
|
{
|
|
// If successfully remove Language_translation add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.language_translation) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Language_translation items from the contentitem tag map table
|
|
$language_translation_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.language_translation') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($language_translation_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language_translation items
|
|
$language_translation_done = $db->execute();
|
|
if ($language_translation_done)
|
|
{
|
|
// If successfully remove Language_translation add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.language_translation) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Language_translation items from the ucm content table
|
|
$language_translation_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.language_translation') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($language_translation_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language_translation items
|
|
$language_translation_done = $db->execute();
|
|
if ($language_translation_done)
|
|
{
|
|
// If successfully removed Language_translation add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.language_translation) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Language_translation items are cleared from DB
|
|
foreach ($language_translation_ids as $language_translation_id)
|
|
{
|
|
// Remove Language_translation items from the ucm base table
|
|
$language_translation_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $language_translation_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($language_translation_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language_translation items
|
|
$db->execute();
|
|
|
|
// Remove Language_translation items from the ucm history table
|
|
$language_translation_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $language_translation_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($language_translation_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language_translation items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Language alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.language') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$language_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($language_found)
|
|
{
|
|
// Since there are load the needed language type ids
|
|
$language_ids = $db->loadColumn();
|
|
// Remove Language from the content type table
|
|
$language_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.language') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($language_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language items
|
|
$language_done = $db->execute();
|
|
if ($language_done)
|
|
{
|
|
// If successfully remove Language add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.language) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Language items from the contentitem tag map table
|
|
$language_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.language') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($language_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language items
|
|
$language_done = $db->execute();
|
|
if ($language_done)
|
|
{
|
|
// If successfully remove Language add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.language) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Language items from the ucm content table
|
|
$language_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.language') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($language_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language items
|
|
$language_done = $db->execute();
|
|
if ($language_done)
|
|
{
|
|
// If successfully removed Language add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.language) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Language items are cleared from DB
|
|
foreach ($language_ids as $language_id)
|
|
{
|
|
// Remove Language items from the ucm base table
|
|
$language_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $language_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($language_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language items
|
|
$db->execute();
|
|
|
|
// Remove Language items from the ucm history table
|
|
$language_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $language_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($language_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Language items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Server alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.server') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$server_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($server_found)
|
|
{
|
|
// Since there are load the needed server type ids
|
|
$server_ids = $db->loadColumn();
|
|
// Remove Server from the content type table
|
|
$server_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.server') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($server_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Server items
|
|
$server_done = $db->execute();
|
|
if ($server_done)
|
|
{
|
|
// If successfully remove Server add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.server) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Server items from the contentitem tag map table
|
|
$server_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.server') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($server_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Server items
|
|
$server_done = $db->execute();
|
|
if ($server_done)
|
|
{
|
|
// If successfully remove Server add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.server) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Server items from the ucm content table
|
|
$server_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.server') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($server_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Server items
|
|
$server_done = $db->execute();
|
|
if ($server_done)
|
|
{
|
|
// If successfully removed Server add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.server) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Server items are cleared from DB
|
|
foreach ($server_ids as $server_id)
|
|
{
|
|
// Remove Server items from the ucm base table
|
|
$server_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $server_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($server_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Server items
|
|
$db->execute();
|
|
|
|
// Remove Server items from the ucm history table
|
|
$server_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $server_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($server_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Server items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Repository alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.repository') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$repository_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($repository_found)
|
|
{
|
|
// Since there are load the needed repository type ids
|
|
$repository_ids = $db->loadColumn();
|
|
// Remove Repository from the content type table
|
|
$repository_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.repository') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($repository_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Repository items
|
|
$repository_done = $db->execute();
|
|
if ($repository_done)
|
|
{
|
|
// If successfully remove Repository add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.repository) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Repository items from the contentitem tag map table
|
|
$repository_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.repository') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($repository_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Repository items
|
|
$repository_done = $db->execute();
|
|
if ($repository_done)
|
|
{
|
|
// If successfully remove Repository add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.repository) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Repository items from the ucm content table
|
|
$repository_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.repository') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($repository_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Repository items
|
|
$repository_done = $db->execute();
|
|
if ($repository_done)
|
|
{
|
|
// If successfully removed Repository add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.repository) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Repository items are cleared from DB
|
|
foreach ($repository_ids as $repository_id)
|
|
{
|
|
// Remove Repository items from the ucm base table
|
|
$repository_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $repository_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($repository_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Repository items
|
|
$db->execute();
|
|
|
|
// Remove Repository items from the ucm history table
|
|
$repository_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $repository_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($repository_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Repository items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Help_document alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.help_document') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$help_document_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($help_document_found)
|
|
{
|
|
// Since there are load the needed help_document type ids
|
|
$help_document_ids = $db->loadColumn();
|
|
// Remove Help_document from the content type table
|
|
$help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.help_document') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($help_document_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Help_document items
|
|
$help_document_done = $db->execute();
|
|
if ($help_document_done)
|
|
{
|
|
// If successfully remove Help_document add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.help_document) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Help_document items from the contentitem tag map table
|
|
$help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.help_document') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($help_document_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Help_document items
|
|
$help_document_done = $db->execute();
|
|
if ($help_document_done)
|
|
{
|
|
// If successfully remove Help_document add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.help_document) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Help_document items from the ucm content table
|
|
$help_document_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.help_document') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($help_document_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Help_document items
|
|
$help_document_done = $db->execute();
|
|
if ($help_document_done)
|
|
{
|
|
// If successfully removed Help_document add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.help_document) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Help_document items are cleared from DB
|
|
foreach ($help_document_ids as $help_document_id)
|
|
{
|
|
// Remove Help_document items from the ucm base table
|
|
$help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($help_document_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Help_document items
|
|
$db->execute();
|
|
|
|
// Remove Help_document items from the ucm history table
|
|
$help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($help_document_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Help_document items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Admin_fields alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$admin_fields_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($admin_fields_found)
|
|
{
|
|
// Since there are load the needed admin_fields type ids
|
|
$admin_fields_ids = $db->loadColumn();
|
|
// Remove Admin_fields from the content type table
|
|
$admin_fields_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($admin_fields_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields items
|
|
$admin_fields_done = $db->execute();
|
|
if ($admin_fields_done)
|
|
{
|
|
// If successfully remove Admin_fields add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_fields) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Admin_fields items from the contentitem tag map table
|
|
$admin_fields_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($admin_fields_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields items
|
|
$admin_fields_done = $db->execute();
|
|
if ($admin_fields_done)
|
|
{
|
|
// If successfully remove Admin_fields add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_fields) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Admin_fields items from the ucm content table
|
|
$admin_fields_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.admin_fields') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($admin_fields_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields items
|
|
$admin_fields_done = $db->execute();
|
|
if ($admin_fields_done)
|
|
{
|
|
// If successfully removed Admin_fields add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_fields) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Admin_fields items are cleared from DB
|
|
foreach ($admin_fields_ids as $admin_fields_id)
|
|
{
|
|
// Remove Admin_fields items from the ucm base table
|
|
$admin_fields_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $admin_fields_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($admin_fields_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields items
|
|
$db->execute();
|
|
|
|
// Remove Admin_fields items from the ucm history table
|
|
$admin_fields_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $admin_fields_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($admin_fields_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Admin_fields_conditions alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields_conditions') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$admin_fields_conditions_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($admin_fields_conditions_found)
|
|
{
|
|
// Since there are load the needed admin_fields_conditions type ids
|
|
$admin_fields_conditions_ids = $db->loadColumn();
|
|
// Remove Admin_fields_conditions from the content type table
|
|
$admin_fields_conditions_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields_conditions') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($admin_fields_conditions_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields_conditions items
|
|
$admin_fields_conditions_done = $db->execute();
|
|
if ($admin_fields_conditions_done)
|
|
{
|
|
// If successfully remove Admin_fields_conditions add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_fields_conditions) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Admin_fields_conditions items from the contentitem tag map table
|
|
$admin_fields_conditions_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields_conditions') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($admin_fields_conditions_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields_conditions items
|
|
$admin_fields_conditions_done = $db->execute();
|
|
if ($admin_fields_conditions_done)
|
|
{
|
|
// If successfully remove Admin_fields_conditions add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_fields_conditions) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
|
}
|
|
|
|
// Remove Admin_fields_conditions items from the ucm content table
|
|
$admin_fields_conditions_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.admin_fields_conditions') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_content'));
|
|
$query->where($admin_fields_conditions_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields_conditions items
|
|
$admin_fields_conditions_done = $db->execute();
|
|
if ($admin_fields_conditions_done)
|
|
{
|
|
// If successfully removed Admin_fields_conditions add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_fields_conditions) type alias was removed from the <b>#__ucm_content</b> table'));
|
|
}
|
|
|
|
// Make sure that all the Admin_fields_conditions items are cleared from DB
|
|
foreach ($admin_fields_conditions_ids as $admin_fields_conditions_id)
|
|
{
|
|
// Remove Admin_fields_conditions items from the ucm base table
|
|
$admin_fields_conditions_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $admin_fields_conditions_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_base'));
|
|
$query->where($admin_fields_conditions_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields_conditions items
|
|
$db->execute();
|
|
|
|
// Remove Admin_fields_conditions items from the ucm history table
|
|
$admin_fields_conditions_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $admin_fields_conditions_id);
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__ucm_history'));
|
|
$query->where($admin_fields_conditions_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields_conditions items
|
|
$db->execute();
|
|
}
|
|
}
|
|
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
// Select id from content type table
|
|
$query->select($db->quoteName('type_id'));
|
|
$query->from($db->quoteName('#__content_types'));
|
|
// Where Admin_fields_relations alias is found
|
|
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields_relations') );
|
|
$db->setQuery($query);
|
|
// Execute query to see if alias is found
|
|
$db->execute();
|
|
$admin_fields_relations_found = $db->getNumRows();
|
|
// Now check if there were any rows
|
|
if ($admin_fields_relations_found)
|
|
{
|
|
// Since there are load the needed admin_fields_relations type ids
|
|
$admin_fields_relations_ids = $db->loadColumn();
|
|
// Remove Admin_fields_relations from the content type table
|
|
$admin_fields_relations_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields_relations') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__content_types'));
|
|
$query->where($admin_fields_relations_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields_relations items
|
|
$admin_fields_relations_done = $db->execute();
|
|
if ($admin_fields_relations_done)
|
|
{
|
|
// If successfully remove Admin_fields_relations add queued success message.
|
|
$app->enqueueMessage(Text::_('The (com_componentbuilder.admin_fields_relations) type alias was removed from the <b>#__content_type</b> table'));
|
|
}
|
|
|
|
// Remove Admin_fields_relations items from the contentitem tag map table
|
|
$admin_fields_relations_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.admin_fields_relations') );
|
|
// Create a new query object.
|
|
$query = $db->getQuery(true);
|
|
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
|
$query->where($admin_fields_relations_condition);
|
|
$db->setQuery($query);
|
|
// Execute the query to remove Admin_fields_relations items
|
|
$admin_fields_relations_done = $db->execute();
|
|
if ($admin_fields_relations_done)
|
|
{
|
|
// If successfully remove Admin_fields_relations |