@copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // 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 Sermondistributor Component */ class com_sermondistributorInstallerScript { /** * method to install the component * * * @return void */ function install($parent) { } /** * method to uninstall the component * * @return void */ function uninstall($parent) { // [4209] Get Application object $app = JFactory::getApplication(); // [4211] Get The Database object $db = JFactory::getDbo(); // [4220] Create a new query object. $query = $db->getQuery(true); // [4222] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4225] Where Preacher alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); $db->setQuery($query); // [4228] Execute query to see if alias is found $db->execute(); $preacher_found = $db->getNumRows(); // [4231] Now check if there were any rows if ($preacher_found) { // [4234] Since there are load the needed preacher type ids $preacher_ids = $db->loadColumn(); // [4238] Remove Preacher from the content type table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4240] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($preacher_condition); $db->setQuery($query); // [4245] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4249] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__content_type table')); } // [4255] Remove Preacher items from the contentitem tag map table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4257] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($preacher_condition); $db->setQuery($query); // [4262] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4266] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__contentitem_tag_map table')); } // [4272] Remove Preacher items from the ucm content table $preacher_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.preacher') ); // [4274] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($preacher_condition); $db->setQuery($query); // [4279] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4283] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__ucm_content table')); } // [4289] Make sure that all the Preacher items are cleared from DB foreach ($preacher_ids as $preacher_id) { // [4294] Remove Preacher items from the ucm base table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4296] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($preacher_condition); $db->setQuery($query); // [4301] Execute the query to remove Preacher items $db->execute(); // [4305] Remove Preacher items from the ucm history table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4307] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($preacher_condition); $db->setQuery($query); // [4312] Execute the query to remove Preacher items $db->execute(); } } // [4220] Create a new query object. $query = $db->getQuery(true); // [4222] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4225] Where Sermon alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); $db->setQuery($query); // [4228] Execute query to see if alias is found $db->execute(); $sermon_found = $db->getNumRows(); // [4231] Now check if there were any rows if ($sermon_found) { // [4234] Since there are load the needed sermon type ids $sermon_ids = $db->loadColumn(); // [4238] Remove Sermon from the content type table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4240] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_condition); $db->setQuery($query); // [4245] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4249] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__content_type table')); } // [4255] Remove Sermon items from the contentitem tag map table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4257] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_condition); $db->setQuery($query); // [4262] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4266] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__contentitem_tag_map table')); } // [4272] Remove Sermon items from the ucm content table $sermon_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermon') ); // [4274] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_condition); $db->setQuery($query); // [4279] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4283] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__ucm_content table')); } // [4289] Make sure that all the Sermon items are cleared from DB foreach ($sermon_ids as $sermon_id) { // [4294] Remove Sermon items from the ucm base table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4296] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_condition); $db->setQuery($query); // [4301] Execute the query to remove Sermon items $db->execute(); // [4305] Remove Sermon items from the ucm history table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4307] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_condition); $db->setQuery($query); // [4312] Execute the query to remove Sermon items $db->execute(); } } // [4220] Create a new query object. $query = $db->getQuery(true); // [4222] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4225] Where Sermon catid alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); $db->setQuery($query); // [4228] Execute query to see if alias is found $db->execute(); $sermon_catid_found = $db->getNumRows(); // [4231] Now check if there were any rows if ($sermon_catid_found) { // [4234] Since there are load the needed sermon_catid type ids $sermon_catid_ids = $db->loadColumn(); // [4238] Remove Sermon catid from the content type table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4240] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4245] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4249] If succesfully remove Sermon catid add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermons.category) type alias was removed from the #__content_type table')); } // [4255] Remove Sermon catid items from the contentitem tag map table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4257] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4262] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4266] If succesfully remove Sermon catid add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermons.category) type alias was removed from the #__contentitem_tag_map table')); } // [4272] Remove Sermon catid items from the ucm content table $sermon_catid_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermons.category') ); // [4274] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4279] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4283] If succesfully remove Sermon catid add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermons.category) type alias was removed from the #__ucm_content table')); } // [4289] Make sure that all the Sermon catid items are cleared from DB foreach ($sermon_catid_ids as $sermon_catid_id) { // [4294] Remove Sermon catid items from the ucm base table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4296] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4301] Execute the query to remove Sermon catid items $db->execute(); // [4305] Remove Sermon catid items from the ucm history table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4307] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4312] Execute the query to remove Sermon catid items $db->execute(); } } // [4220] Create a new query object. $query = $db->getQuery(true); // [4222] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4225] Where Series alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); $db->setQuery($query); // [4228] Execute query to see if alias is found $db->execute(); $series_found = $db->getNumRows(); // [4231] Now check if there were any rows if ($series_found) { // [4234] Since there are load the needed series type ids $series_ids = $db->loadColumn(); // [4238] Remove Series from the content type table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4240] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($series_condition); $db->setQuery($query); // [4245] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4249] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__content_type table')); } // [4255] Remove Series items from the contentitem tag map table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4257] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($series_condition); $db->setQuery($query); // [4262] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4266] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__contentitem_tag_map table')); } // [4272] Remove Series items from the ucm content table $series_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.series') ); // [4274] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($series_condition); $db->setQuery($query); // [4279] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4283] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__ucm_content table')); } // [4289] Make sure that all the Series items are cleared from DB foreach ($series_ids as $series_id) { // [4294] Remove Series items from the ucm base table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4296] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($series_condition); $db->setQuery($query); // [4301] Execute the query to remove Series items $db->execute(); // [4305] Remove Series items from the ucm history table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4307] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($series_condition); $db->setQuery($query); // [4312] Execute the query to remove Series items $db->execute(); } } // [4220] Create a new query object. $query = $db->getQuery(true); // [4222] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4225] Where Statistic alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); $db->setQuery($query); // [4228] Execute query to see if alias is found $db->execute(); $statistic_found = $db->getNumRows(); // [4231] Now check if there were any rows if ($statistic_found) { // [4234] Since there are load the needed statistic type ids $statistic_ids = $db->loadColumn(); // [4238] Remove Statistic from the content type table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4240] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($statistic_condition); $db->setQuery($query); // [4245] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4249] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__content_type table')); } // [4255] Remove Statistic items from the contentitem tag map table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4257] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($statistic_condition); $db->setQuery($query); // [4262] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4266] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__contentitem_tag_map table')); } // [4272] Remove Statistic items from the ucm content table $statistic_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.statistic') ); // [4274] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($statistic_condition); $db->setQuery($query); // [4279] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4283] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__ucm_content table')); } // [4289] Make sure that all the Statistic items are cleared from DB foreach ($statistic_ids as $statistic_id) { // [4294] Remove Statistic items from the ucm base table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4296] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($statistic_condition); $db->setQuery($query); // [4301] Execute the query to remove Statistic items $db->execute(); // [4305] Remove Statistic items from the ucm history table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4307] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($statistic_condition); $db->setQuery($query); // [4312] Execute the query to remove Statistic items $db->execute(); } } // [4220] Create a new query object. $query = $db->getQuery(true); // [4222] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4225] Where Help_document alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); $db->setQuery($query); // [4228] Execute query to see if alias is found $db->execute(); $help_document_found = $db->getNumRows(); // [4231] Now check if there were any rows if ($help_document_found) { // [4234] Since there are load the needed help_document type ids $help_document_ids = $db->loadColumn(); // [4238] Remove Help_document from the content type table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); // [4240] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($help_document_condition); $db->setQuery($query); // [4245] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4249] If succesfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.help_document) type alias was removed from the #__content_type table')); } // [4255] Remove Help_document items from the contentitem tag map table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); // [4257] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($help_document_condition); $db->setQuery($query); // [4262] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4266] If succesfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.help_document) type alias was removed from the #__contentitem_tag_map table')); } // [4272] Remove Help_document items from the ucm content table $help_document_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.help_document') ); // [4274] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($help_document_condition); $db->setQuery($query); // [4279] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4283] If succesfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.help_document) type alias was removed from the #__ucm_content table')); } // [4289] Make sure that all the Help_document items are cleared from DB foreach ($help_document_ids as $help_document_id) { // [4294] Remove Help_document items from the ucm base table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4296] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($help_document_condition); $db->setQuery($query); // [4301] Execute the query to remove Help_document items $db->execute(); // [4305] Remove Help_document items from the ucm history table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4307] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($help_document_condition); $db->setQuery($query); // [4312] Execute the query to remove Help_document items $db->execute(); } } // [4320] 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')); // [4325] Remove sermondistributor assets from the assets table $sermondistributor_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_sermondistributor%') ); // [4327] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__assets')); $query->where($sermondistributor_condition); $db->setQuery($query); $help_document_done = $db->execute(); if ($help_document_done); { // [4335] If succesfully remove sermondistributor 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 Vast Development Method 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 https://www.vdm.io/ today!