@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); JHTML::_('behavior.modal'); jimport('joomla.installer.installer'); jimport('joomla.installer.helper'); /** * Script File of Costbenefitprojection Component */ class com_costbenefitprojectionInstallerScript { /** * method to install the component * * * @return void */ function install($parent) { } /** * method to uninstall the component * * @return void */ function uninstall($parent) { // [4475] Get Application object $app = JFactory::getApplication(); // [4477] Get The Database object $db = JFactory::getDbo(); // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Company alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.company') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $company_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($company_found) { // [4500] Since there are load the needed company type ids $company_ids = $db->loadColumn(); // [4504] Remove Company from the content type table $company_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.company') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($company_condition); $db->setQuery($query); // [4511] Execute the query to remove Company items $company_done = $db->execute(); if ($company_done); { // [4515] If succesfully remove Company add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.company) type alias was removed from the #__content_type table')); } // [4521] Remove Company items from the contentitem tag map table $company_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.company') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($company_condition); $db->setQuery($query); // [4528] Execute the query to remove Company items $company_done = $db->execute(); if ($company_done); { // [4532] If succesfully remove Company add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.company) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Company items from the ucm content table $company_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.company') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($company_condition); $db->setQuery($query); // [4545] Execute the query to remove Company items $company_done = $db->execute(); if ($company_done); { // [4549] If succesfully remove Company add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.company) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Company items are cleared from DB foreach ($company_ids as $company_id) { // [4560] Remove Company items from the ucm base table $company_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $company_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($company_condition); $db->setQuery($query); // [4567] Execute the query to remove Company items $db->execute(); // [4571] Remove Company items from the ucm history table $company_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $company_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($company_condition); $db->setQuery($query); // [4578] Execute the query to remove Company items $db->execute(); } } // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Service_provider alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.service_provider') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $service_provider_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($service_provider_found) { // [4500] Since there are load the needed service_provider type ids $service_provider_ids = $db->loadColumn(); // [4504] Remove Service_provider from the content type table $service_provider_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.service_provider') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($service_provider_condition); $db->setQuery($query); // [4511] Execute the query to remove Service_provider items $service_provider_done = $db->execute(); if ($service_provider_done); { // [4515] If succesfully remove Service_provider add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.service_provider) type alias was removed from the #__content_type table')); } // [4521] Remove Service_provider items from the contentitem tag map table $service_provider_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.service_provider') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($service_provider_condition); $db->setQuery($query); // [4528] Execute the query to remove Service_provider items $service_provider_done = $db->execute(); if ($service_provider_done); { // [4532] If succesfully remove Service_provider add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.service_provider) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Service_provider items from the ucm content table $service_provider_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.service_provider') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($service_provider_condition); $db->setQuery($query); // [4545] Execute the query to remove Service_provider items $service_provider_done = $db->execute(); if ($service_provider_done); { // [4549] If succesfully remove Service_provider add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.service_provider) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Service_provider items are cleared from DB foreach ($service_provider_ids as $service_provider_id) { // [4560] Remove Service_provider items from the ucm base table $service_provider_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $service_provider_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($service_provider_condition); $db->setQuery($query); // [4567] Execute the query to remove Service_provider items $db->execute(); // [4571] Remove Service_provider items from the ucm history table $service_provider_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $service_provider_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($service_provider_condition); $db->setQuery($query); // [4578] Execute the query to remove Service_provider items $db->execute(); } } // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Country alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.country') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $country_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($country_found) { // [4500] Since there are load the needed country type ids $country_ids = $db->loadColumn(); // [4504] Remove Country from the content type table $country_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.country') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($country_condition); $db->setQuery($query); // [4511] Execute the query to remove Country items $country_done = $db->execute(); if ($country_done); { // [4515] If succesfully remove Country add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.country) type alias was removed from the #__content_type table')); } // [4521] Remove Country items from the contentitem tag map table $country_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.country') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($country_condition); $db->setQuery($query); // [4528] Execute the query to remove Country items $country_done = $db->execute(); if ($country_done); { // [4532] If succesfully remove Country add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.country) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Country items from the ucm content table $country_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.country') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($country_condition); $db->setQuery($query); // [4545] Execute the query to remove Country items $country_done = $db->execute(); if ($country_done); { // [4549] If succesfully remove Country add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.country) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Country items are cleared from DB foreach ($country_ids as $country_id) { // [4560] Remove Country items from the ucm base table $country_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $country_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($country_condition); $db->setQuery($query); // [4567] Execute the query to remove Country items $db->execute(); // [4571] Remove Country items from the ucm history table $country_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $country_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($country_condition); $db->setQuery($query); // [4578] Execute the query to remove Country items $db->execute(); } } // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Causerisk alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.causerisk') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $causerisk_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($causerisk_found) { // [4500] Since there are load the needed causerisk type ids $causerisk_ids = $db->loadColumn(); // [4504] Remove Causerisk from the content type table $causerisk_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.causerisk') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($causerisk_condition); $db->setQuery($query); // [4511] Execute the query to remove Causerisk items $causerisk_done = $db->execute(); if ($causerisk_done); { // [4515] If succesfully remove Causerisk add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.causerisk) type alias was removed from the #__content_type table')); } // [4521] Remove Causerisk items from the contentitem tag map table $causerisk_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.causerisk') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($causerisk_condition); $db->setQuery($query); // [4528] Execute the query to remove Causerisk items $causerisk_done = $db->execute(); if ($causerisk_done); { // [4532] If succesfully remove Causerisk add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.causerisk) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Causerisk items from the ucm content table $causerisk_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.causerisk') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($causerisk_condition); $db->setQuery($query); // [4545] Execute the query to remove Causerisk items $causerisk_done = $db->execute(); if ($causerisk_done); { // [4549] If succesfully remove Causerisk add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.causerisk) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Causerisk items are cleared from DB foreach ($causerisk_ids as $causerisk_id) { // [4560] Remove Causerisk items from the ucm base table $causerisk_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $causerisk_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($causerisk_condition); $db->setQuery($query); // [4567] Execute the query to remove Causerisk items $db->execute(); // [4571] Remove Causerisk items from the ucm history table $causerisk_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $causerisk_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($causerisk_condition); $db->setQuery($query); // [4578] Execute the query to remove Causerisk items $db->execute(); } } // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Health_data alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.health_data') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $health_data_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($health_data_found) { // [4500] Since there are load the needed health_data type ids $health_data_ids = $db->loadColumn(); // [4504] Remove Health_data from the content type table $health_data_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.health_data') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($health_data_condition); $db->setQuery($query); // [4511] Execute the query to remove Health_data items $health_data_done = $db->execute(); if ($health_data_done); { // [4515] If succesfully remove Health_data add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.health_data) type alias was removed from the #__content_type table')); } // [4521] Remove Health_data items from the contentitem tag map table $health_data_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.health_data') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($health_data_condition); $db->setQuery($query); // [4528] Execute the query to remove Health_data items $health_data_done = $db->execute(); if ($health_data_done); { // [4532] If succesfully remove Health_data add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.health_data) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Health_data items from the ucm content table $health_data_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.health_data') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($health_data_condition); $db->setQuery($query); // [4545] Execute the query to remove Health_data items $health_data_done = $db->execute(); if ($health_data_done); { // [4549] If succesfully remove Health_data add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.health_data) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Health_data items are cleared from DB foreach ($health_data_ids as $health_data_id) { // [4560] Remove Health_data items from the ucm base table $health_data_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $health_data_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($health_data_condition); $db->setQuery($query); // [4567] Execute the query to remove Health_data items $db->execute(); // [4571] Remove Health_data items from the ucm history table $health_data_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $health_data_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($health_data_condition); $db->setQuery($query); // [4578] Execute the query to remove Health_data items $db->execute(); } } // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Scaling_factor alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.scaling_factor') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $scaling_factor_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($scaling_factor_found) { // [4500] Since there are load the needed scaling_factor type ids $scaling_factor_ids = $db->loadColumn(); // [4504] Remove Scaling_factor from the content type table $scaling_factor_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.scaling_factor') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($scaling_factor_condition); $db->setQuery($query); // [4511] Execute the query to remove Scaling_factor items $scaling_factor_done = $db->execute(); if ($scaling_factor_done); { // [4515] If succesfully remove Scaling_factor add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.scaling_factor) type alias was removed from the #__content_type table')); } // [4521] Remove Scaling_factor items from the contentitem tag map table $scaling_factor_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.scaling_factor') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($scaling_factor_condition); $db->setQuery($query); // [4528] Execute the query to remove Scaling_factor items $scaling_factor_done = $db->execute(); if ($scaling_factor_done); { // [4532] If succesfully remove Scaling_factor add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.scaling_factor) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Scaling_factor items from the ucm content table $scaling_factor_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.scaling_factor') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($scaling_factor_condition); $db->setQuery($query); // [4545] Execute the query to remove Scaling_factor items $scaling_factor_done = $db->execute(); if ($scaling_factor_done); { // [4549] If succesfully remove Scaling_factor add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.scaling_factor) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Scaling_factor items are cleared from DB foreach ($scaling_factor_ids as $scaling_factor_id) { // [4560] Remove Scaling_factor items from the ucm base table $scaling_factor_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $scaling_factor_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($scaling_factor_condition); $db->setQuery($query); // [4567] Execute the query to remove Scaling_factor items $db->execute(); // [4571] Remove Scaling_factor items from the ucm history table $scaling_factor_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $scaling_factor_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($scaling_factor_condition); $db->setQuery($query); // [4578] Execute the query to remove Scaling_factor items $db->execute(); } } // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Intervention alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.intervention') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $intervention_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($intervention_found) { // [4500] Since there are load the needed intervention type ids $intervention_ids = $db->loadColumn(); // [4504] Remove Intervention from the content type table $intervention_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.intervention') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($intervention_condition); $db->setQuery($query); // [4511] Execute the query to remove Intervention items $intervention_done = $db->execute(); if ($intervention_done); { // [4515] If succesfully remove Intervention add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.intervention) type alias was removed from the #__content_type table')); } // [4521] Remove Intervention items from the contentitem tag map table $intervention_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.intervention') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($intervention_condition); $db->setQuery($query); // [4528] Execute the query to remove Intervention items $intervention_done = $db->execute(); if ($intervention_done); { // [4532] If succesfully remove Intervention add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.intervention) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Intervention items from the ucm content table $intervention_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.intervention') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($intervention_condition); $db->setQuery($query); // [4545] Execute the query to remove Intervention items $intervention_done = $db->execute(); if ($intervention_done); { // [4549] If succesfully remove Intervention add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.intervention) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Intervention items are cleared from DB foreach ($intervention_ids as $intervention_id) { // [4560] Remove Intervention items from the ucm base table $intervention_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $intervention_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($intervention_condition); $db->setQuery($query); // [4567] Execute the query to remove Intervention items $db->execute(); // [4571] Remove Intervention items from the ucm history table $intervention_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $intervention_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($intervention_condition); $db->setQuery($query); // [4578] Execute the query to remove Intervention items $db->execute(); } } // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Currency alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.currency') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $currency_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($currency_found) { // [4500] Since there are load the needed currency type ids $currency_ids = $db->loadColumn(); // [4504] Remove Currency from the content type table $currency_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.currency') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($currency_condition); $db->setQuery($query); // [4511] Execute the query to remove Currency items $currency_done = $db->execute(); if ($currency_done); { // [4515] If succesfully remove Currency add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.currency) type alias was removed from the #__content_type table')); } // [4521] Remove Currency items from the contentitem tag map table $currency_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.currency') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($currency_condition); $db->setQuery($query); // [4528] Execute the query to remove Currency items $currency_done = $db->execute(); if ($currency_done); { // [4532] If succesfully remove Currency add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.currency) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Currency items from the ucm content table $currency_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.currency') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($currency_condition); $db->setQuery($query); // [4545] Execute the query to remove Currency items $currency_done = $db->execute(); if ($currency_done); { // [4549] If succesfully remove Currency add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.currency) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Currency items are cleared from DB foreach ($currency_ids as $currency_id) { // [4560] Remove Currency items from the ucm base table $currency_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $currency_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($currency_condition); $db->setQuery($query); // [4567] Execute the query to remove Currency items $db->execute(); // [4571] Remove Currency items from the ucm history table $currency_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $currency_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($currency_condition); $db->setQuery($query); // [4578] Execute the query to remove Currency items $db->execute(); } } // [4486] Create a new query object. $query = $db->getQuery(true); // [4488] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4491] Where Help_document alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.help_document') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $help_document_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($help_document_found) { // [4500] Since there are load the needed help_document type ids $help_document_ids = $db->loadColumn(); // [4504] Remove Help_document from the content type table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.help_document') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($help_document_condition); $db->setQuery($query); // [4511] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4515] If succesfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.help_document) type alias was removed from the #__content_type table')); } // [4521] Remove Help_document items from the contentitem tag map table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.help_document') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($help_document_condition); $db->setQuery($query); // [4528] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4532] If succesfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.help_document) type alias was removed from the #__contentitem_tag_map table')); } // [4538] Remove Help_document items from the ucm content table $help_document_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.help_document') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($help_document_condition); $db->setQuery($query); // [4545] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4549] If succesfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_costbenefitprojection.help_document) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Help_document items are cleared from DB foreach ($help_document_ids as $help_document_id) { // [4560] Remove Help_document items from the ucm base table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($help_document_condition); $db->setQuery($query); // [4567] Execute the query to remove Help_document items $db->execute(); // [4571] Remove Help_document items from the ucm history table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($help_document_condition); $db->setQuery($query); // [4578] Execute the query to remove Help_document items $db->execute(); } } // [4586] If All related items was removed queued success message. $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_base table')); $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_history table')); // [4591] Remove costbenefitprojection assets from the assets table $costbenefitprojection_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_costbenefitprojection%') ); // [4593] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__assets')); $query->where($costbenefitprojection_condition); $db->setQuery($query); $help_document_done = $db->execute(); if ($help_document_done); { // [4601] If succesfully remove costbenefitprojection add queued success message. $app->enqueueMessage(JText::_('All related items was removed from the #__assets table')); } // little notice as after service, in case of bad experience with component. echo '
Please let me know at llewellyn@vdm.io.
We at Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb are committed to building extensions that performs proficiently! You can help us, really!
Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
Visit us at http://www.vdm.io today!