@copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html A sermon distributor that links to Dropbox. /-----------------------------------------------------------------------------------------------------------------------------*/ // 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) { // [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 Preacher alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $preacher_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($preacher_found) { // [4500] Since there are load the needed preacher type ids $preacher_ids = $db->loadColumn(); // [4504] Remove Preacher from the content type table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($preacher_condition); $db->setQuery($query); // [4511] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4515] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__content_type table')); } // [4521] Remove Preacher items from the contentitem tag map table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($preacher_condition); $db->setQuery($query); // [4528] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4532] 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')); } // [4538] Remove Preacher items from the ucm content table $preacher_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.preacher') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($preacher_condition); $db->setQuery($query); // [4545] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4549] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Preacher items are cleared from DB foreach ($preacher_ids as $preacher_id) { // [4560] Remove Preacher items from the ucm base table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($preacher_condition); $db->setQuery($query); // [4567] Execute the query to remove Preacher items $db->execute(); // [4571] Remove Preacher items from the ucm history table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($preacher_condition); $db->setQuery($query); // [4578] Execute the query to remove Preacher 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 Sermon alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $sermon_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($sermon_found) { // [4500] Since there are load the needed sermon type ids $sermon_ids = $db->loadColumn(); // [4504] Remove Sermon from the content type table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_condition); $db->setQuery($query); // [4511] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4515] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__content_type table')); } // [4521] Remove Sermon items from the contentitem tag map table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_condition); $db->setQuery($query); // [4528] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4532] 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')); } // [4538] Remove Sermon items from the ucm content table $sermon_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermon') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_condition); $db->setQuery($query); // [4545] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4549] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Sermon items are cleared from DB foreach ($sermon_ids as $sermon_id) { // [4560] Remove Sermon items from the ucm base table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_condition); $db->setQuery($query); // [4567] Execute the query to remove Sermon items $db->execute(); // [4571] Remove Sermon items from the ucm history table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_condition); $db->setQuery($query); // [4578] Execute the query to remove Sermon 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 Sermon catid alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $sermon_catid_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($sermon_catid_found) { // [4500] Since there are load the needed sermon_catid type ids $sermon_catid_ids = $db->loadColumn(); // [4504] Remove Sermon catid from the content type table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4511] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4515] 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')); } // [4521] Remove Sermon catid items from the contentitem tag map table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4528] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4532] 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')); } // [4538] Remove Sermon catid items from the ucm content table $sermon_catid_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermons.category') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4545] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4549] 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')); } // [4555] Make sure that all the Sermon catid items are cleared from DB foreach ($sermon_catid_ids as $sermon_catid_id) { // [4560] Remove Sermon catid items from the ucm base table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4567] Execute the query to remove Sermon catid items $db->execute(); // [4571] Remove Sermon catid items from the ucm history table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4578] Execute the query to remove Sermon catid 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 Series alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $series_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($series_found) { // [4500] Since there are load the needed series type ids $series_ids = $db->loadColumn(); // [4504] Remove Series from the content type table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($series_condition); $db->setQuery($query); // [4511] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4515] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__content_type table')); } // [4521] Remove Series items from the contentitem tag map table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($series_condition); $db->setQuery($query); // [4528] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4532] 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')); } // [4538] Remove Series items from the ucm content table $series_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.series') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($series_condition); $db->setQuery($query); // [4545] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4549] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Series items are cleared from DB foreach ($series_ids as $series_id) { // [4560] Remove Series items from the ucm base table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($series_condition); $db->setQuery($query); // [4567] Execute the query to remove Series items $db->execute(); // [4571] Remove Series items from the ucm history table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($series_condition); $db->setQuery($query); // [4578] Execute the query to remove Series 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 Statistic alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); $db->setQuery($query); // [4494] Execute query to see if alias is found $db->execute(); $statistic_found = $db->getNumRows(); // [4497] Now check if there were any rows if ($statistic_found) { // [4500] Since there are load the needed statistic type ids $statistic_ids = $db->loadColumn(); // [4504] Remove Statistic from the content type table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4506] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($statistic_condition); $db->setQuery($query); // [4511] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4515] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__content_type table')); } // [4521] Remove Statistic items from the contentitem tag map table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4523] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($statistic_condition); $db->setQuery($query); // [4528] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4532] 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')); } // [4538] Remove Statistic items from the ucm content table $statistic_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.statistic') ); // [4540] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($statistic_condition); $db->setQuery($query); // [4545] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4549] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__ucm_content table')); } // [4555] Make sure that all the Statistic items are cleared from DB foreach ($statistic_ids as $statistic_id) { // [4560] Remove Statistic items from the ucm base table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4562] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($statistic_condition); $db->setQuery($query); // [4567] Execute the query to remove Statistic items $db->execute(); // [4571] Remove Statistic items from the ucm history table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4573] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($statistic_condition); $db->setQuery($query); // [4578] Execute the query to remove Statistic 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_sermondistributor.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_sermondistributor.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_sermondistributor.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_sermondistributor.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_sermondistributor.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_sermondistributor.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_sermondistributor.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 sermondistributor assets from the assets table $sermondistributor_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_sermondistributor%') ); // [4593] 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); { // [4601] 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!