@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) { // [4212] Get Application object $app = JFactory::getApplication(); // [4214] Get The Database object $db = JFactory::getDbo(); // [4223] Create a new query object. $query = $db->getQuery(true); // [4225] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4228] Where Preacher alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); $db->setQuery($query); // [4231] Execute query to see if alias is found $db->execute(); $preacher_found = $db->getNumRows(); // [4234] Now check if there were any rows if ($preacher_found) { // [4237] Since there are load the needed preacher type ids $preacher_ids = $db->loadColumn(); // [4241] Remove Preacher from the content type table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4243] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($preacher_condition); $db->setQuery($query); // [4248] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4252] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__content_type table')); } // [4258] Remove Preacher items from the contentitem tag map table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4260] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($preacher_condition); $db->setQuery($query); // [4265] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4269] 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')); } // [4275] Remove Preacher items from the ucm content table $preacher_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.preacher') ); // [4277] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($preacher_condition); $db->setQuery($query); // [4282] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4286] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__ucm_content table')); } // [4292] Make sure that all the Preacher items are cleared from DB foreach ($preacher_ids as $preacher_id) { // [4297] Remove Preacher items from the ucm base table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4299] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($preacher_condition); $db->setQuery($query); // [4304] Execute the query to remove Preacher items $db->execute(); // [4308] Remove Preacher items from the ucm history table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4310] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($preacher_condition); $db->setQuery($query); // [4315] Execute the query to remove Preacher items $db->execute(); } } // [4223] Create a new query object. $query = $db->getQuery(true); // [4225] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4228] Where Sermon alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); $db->setQuery($query); // [4231] Execute query to see if alias is found $db->execute(); $sermon_found = $db->getNumRows(); // [4234] Now check if there were any rows if ($sermon_found) { // [4237] Since there are load the needed sermon type ids $sermon_ids = $db->loadColumn(); // [4241] Remove Sermon from the content type table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4243] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_condition); $db->setQuery($query); // [4248] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4252] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__content_type table')); } // [4258] Remove Sermon items from the contentitem tag map table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4260] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_condition); $db->setQuery($query); // [4265] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4269] 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')); } // [4275] Remove Sermon items from the ucm content table $sermon_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermon') ); // [4277] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_condition); $db->setQuery($query); // [4282] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4286] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__ucm_content table')); } // [4292] Make sure that all the Sermon items are cleared from DB foreach ($sermon_ids as $sermon_id) { // [4297] Remove Sermon items from the ucm base table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4299] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_condition); $db->setQuery($query); // [4304] Execute the query to remove Sermon items $db->execute(); // [4308] Remove Sermon items from the ucm history table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4310] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_condition); $db->setQuery($query); // [4315] Execute the query to remove Sermon items $db->execute(); } } // [4223] Create a new query object. $query = $db->getQuery(true); // [4225] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4228] Where Sermon catid alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); $db->setQuery($query); // [4231] Execute query to see if alias is found $db->execute(); $sermon_catid_found = $db->getNumRows(); // [4234] Now check if there were any rows if ($sermon_catid_found) { // [4237] Since there are load the needed sermon_catid type ids $sermon_catid_ids = $db->loadColumn(); // [4241] Remove Sermon catid from the content type table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4243] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4248] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4252] 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')); } // [4258] Remove Sermon catid items from the contentitem tag map table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4260] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4265] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4269] 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')); } // [4275] Remove Sermon catid items from the ucm content table $sermon_catid_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermons.category') ); // [4277] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4282] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4286] 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')); } // [4292] Make sure that all the Sermon catid items are cleared from DB foreach ($sermon_catid_ids as $sermon_catid_id) { // [4297] Remove Sermon catid items from the ucm base table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4299] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4304] Execute the query to remove Sermon catid items $db->execute(); // [4308] Remove Sermon catid items from the ucm history table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4310] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4315] Execute the query to remove Sermon catid items $db->execute(); } } // [4223] Create a new query object. $query = $db->getQuery(true); // [4225] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4228] Where Series alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); $db->setQuery($query); // [4231] Execute query to see if alias is found $db->execute(); $series_found = $db->getNumRows(); // [4234] Now check if there were any rows if ($series_found) { // [4237] Since there are load the needed series type ids $series_ids = $db->loadColumn(); // [4241] Remove Series from the content type table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4243] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($series_condition); $db->setQuery($query); // [4248] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4252] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__content_type table')); } // [4258] Remove Series items from the contentitem tag map table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4260] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($series_condition); $db->setQuery($query); // [4265] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4269] 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')); } // [4275] Remove Series items from the ucm content table $series_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.series') ); // [4277] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($series_condition); $db->setQuery($query); // [4282] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4286] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__ucm_content table')); } // [4292] Make sure that all the Series items are cleared from DB foreach ($series_ids as $series_id) { // [4297] Remove Series items from the ucm base table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4299] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($series_condition); $db->setQuery($query); // [4304] Execute the query to remove Series items $db->execute(); // [4308] Remove Series items from the ucm history table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4310] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($series_condition); $db->setQuery($query); // [4315] Execute the query to remove Series items $db->execute(); } } // [4223] Create a new query object. $query = $db->getQuery(true); // [4225] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4228] Where Statistic alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); $db->setQuery($query); // [4231] Execute query to see if alias is found $db->execute(); $statistic_found = $db->getNumRows(); // [4234] Now check if there were any rows if ($statistic_found) { // [4237] Since there are load the needed statistic type ids $statistic_ids = $db->loadColumn(); // [4241] Remove Statistic from the content type table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4243] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($statistic_condition); $db->setQuery($query); // [4248] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4252] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__content_type table')); } // [4258] Remove Statistic items from the contentitem tag map table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4260] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($statistic_condition); $db->setQuery($query); // [4265] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4269] 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')); } // [4275] Remove Statistic items from the ucm content table $statistic_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.statistic') ); // [4277] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($statistic_condition); $db->setQuery($query); // [4282] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4286] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__ucm_content table')); } // [4292] Make sure that all the Statistic items are cleared from DB foreach ($statistic_ids as $statistic_id) { // [4297] Remove Statistic items from the ucm base table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4299] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($statistic_condition); $db->setQuery($query); // [4304] Execute the query to remove Statistic items $db->execute(); // [4308] Remove Statistic items from the ucm history table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4310] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($statistic_condition); $db->setQuery($query); // [4315] Execute the query to remove Statistic items $db->execute(); } } // [4223] Create a new query object. $query = $db->getQuery(true); // [4225] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4228] Where Help_document alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); $db->setQuery($query); // [4231] Execute query to see if alias is found $db->execute(); $help_document_found = $db->getNumRows(); // [4234] Now check if there were any rows if ($help_document_found) { // [4237] Since there are load the needed help_document type ids $help_document_ids = $db->loadColumn(); // [4241] Remove Help_document from the content type table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); // [4243] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($help_document_condition); $db->setQuery($query); // [4248] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4252] 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')); } // [4258] Remove Help_document items from the contentitem tag map table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); // [4260] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($help_document_condition); $db->setQuery($query); // [4265] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4269] 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')); } // [4275] Remove Help_document items from the ucm content table $help_document_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.help_document') ); // [4277] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($help_document_condition); $db->setQuery($query); // [4282] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4286] 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')); } // [4292] Make sure that all the Help_document items are cleared from DB foreach ($help_document_ids as $help_document_id) { // [4297] Remove Help_document items from the ucm base table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4299] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($help_document_condition); $db->setQuery($query); // [4304] Execute the query to remove Help_document items $db->execute(); // [4308] Remove Help_document items from the ucm history table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4310] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($help_document_condition); $db->setQuery($query); // [4315] Execute the query to remove Help_document items $db->execute(); } } // [4323] 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')); // [4328] Remove sermondistributor assets from the assets table $sermondistributor_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_sermondistributor%') ); // [4330] 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); { // [4338] 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!
'; } } }