@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) { // [4454] Get Application object $app = JFactory::getApplication(); // [4456] Get The Database object $db = JFactory::getDbo(); // [4465] Create a new query object. $query = $db->getQuery(true); // [4467] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4470] Where Preacher alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); $db->setQuery($query); // [4473] Execute query to see if alias is found $db->execute(); $preacher_found = $db->getNumRows(); // [4476] Now check if there were any rows if ($preacher_found) { // [4479] Since there are load the needed preacher type ids $preacher_ids = $db->loadColumn(); // [4483] Remove Preacher from the content type table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4485] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($preacher_condition); $db->setQuery($query); // [4490] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4494] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__content_type table')); } // [4500] Remove Preacher items from the contentitem tag map table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4502] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($preacher_condition); $db->setQuery($query); // [4507] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4511] 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')); } // [4517] Remove Preacher items from the ucm content table $preacher_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.preacher') ); // [4519] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($preacher_condition); $db->setQuery($query); // [4524] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4528] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__ucm_content table')); } // [4534] Make sure that all the Preacher items are cleared from DB foreach ($preacher_ids as $preacher_id) { // [4539] Remove Preacher items from the ucm base table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4541] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($preacher_condition); $db->setQuery($query); // [4546] Execute the query to remove Preacher items $db->execute(); // [4550] Remove Preacher items from the ucm history table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4552] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($preacher_condition); $db->setQuery($query); // [4557] Execute the query to remove Preacher items $db->execute(); } } // [4465] Create a new query object. $query = $db->getQuery(true); // [4467] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4470] Where Sermon alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); $db->setQuery($query); // [4473] Execute query to see if alias is found $db->execute(); $sermon_found = $db->getNumRows(); // [4476] Now check if there were any rows if ($sermon_found) { // [4479] Since there are load the needed sermon type ids $sermon_ids = $db->loadColumn(); // [4483] Remove Sermon from the content type table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4485] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_condition); $db->setQuery($query); // [4490] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4494] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__content_type table')); } // [4500] Remove Sermon items from the contentitem tag map table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4502] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_condition); $db->setQuery($query); // [4507] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4511] 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')); } // [4517] Remove Sermon items from the ucm content table $sermon_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermon') ); // [4519] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_condition); $db->setQuery($query); // [4524] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4528] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__ucm_content table')); } // [4534] Make sure that all the Sermon items are cleared from DB foreach ($sermon_ids as $sermon_id) { // [4539] Remove Sermon items from the ucm base table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4541] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_condition); $db->setQuery($query); // [4546] Execute the query to remove Sermon items $db->execute(); // [4550] Remove Sermon items from the ucm history table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4552] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_condition); $db->setQuery($query); // [4557] Execute the query to remove Sermon items $db->execute(); } } // [4465] Create a new query object. $query = $db->getQuery(true); // [4467] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4470] Where Sermon catid alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); $db->setQuery($query); // [4473] Execute query to see if alias is found $db->execute(); $sermon_catid_found = $db->getNumRows(); // [4476] Now check if there were any rows if ($sermon_catid_found) { // [4479] Since there are load the needed sermon_catid type ids $sermon_catid_ids = $db->loadColumn(); // [4483] Remove Sermon catid from the content type table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4485] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4490] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4494] 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')); } // [4500] Remove Sermon catid items from the contentitem tag map table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4502] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4507] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4511] 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')); } // [4517] Remove Sermon catid items from the ucm content table $sermon_catid_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermons.category') ); // [4519] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4524] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4528] 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')); } // [4534] Make sure that all the Sermon catid items are cleared from DB foreach ($sermon_catid_ids as $sermon_catid_id) { // [4539] Remove Sermon catid items from the ucm base table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4541] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4546] Execute the query to remove Sermon catid items $db->execute(); // [4550] Remove Sermon catid items from the ucm history table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4552] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4557] Execute the query to remove Sermon catid items $db->execute(); } } // [4465] Create a new query object. $query = $db->getQuery(true); // [4467] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4470] Where Series alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); $db->setQuery($query); // [4473] Execute query to see if alias is found $db->execute(); $series_found = $db->getNumRows(); // [4476] Now check if there were any rows if ($series_found) { // [4479] Since there are load the needed series type ids $series_ids = $db->loadColumn(); // [4483] Remove Series from the content type table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4485] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($series_condition); $db->setQuery($query); // [4490] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4494] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__content_type table')); } // [4500] Remove Series items from the contentitem tag map table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4502] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($series_condition); $db->setQuery($query); // [4507] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4511] 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')); } // [4517] Remove Series items from the ucm content table $series_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.series') ); // [4519] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($series_condition); $db->setQuery($query); // [4524] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4528] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__ucm_content table')); } // [4534] Make sure that all the Series items are cleared from DB foreach ($series_ids as $series_id) { // [4539] Remove Series items from the ucm base table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4541] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($series_condition); $db->setQuery($query); // [4546] Execute the query to remove Series items $db->execute(); // [4550] Remove Series items from the ucm history table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4552] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($series_condition); $db->setQuery($query); // [4557] Execute the query to remove Series items $db->execute(); } } // [4465] Create a new query object. $query = $db->getQuery(true); // [4467] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4470] Where Statistic alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); $db->setQuery($query); // [4473] Execute query to see if alias is found $db->execute(); $statistic_found = $db->getNumRows(); // [4476] Now check if there were any rows if ($statistic_found) { // [4479] Since there are load the needed statistic type ids $statistic_ids = $db->loadColumn(); // [4483] Remove Statistic from the content type table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4485] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($statistic_condition); $db->setQuery($query); // [4490] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4494] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__content_type table')); } // [4500] Remove Statistic items from the contentitem tag map table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4502] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($statistic_condition); $db->setQuery($query); // [4507] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4511] 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')); } // [4517] Remove Statistic items from the ucm content table $statistic_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.statistic') ); // [4519] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($statistic_condition); $db->setQuery($query); // [4524] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4528] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__ucm_content table')); } // [4534] Make sure that all the Statistic items are cleared from DB foreach ($statistic_ids as $statistic_id) { // [4539] Remove Statistic items from the ucm base table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4541] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($statistic_condition); $db->setQuery($query); // [4546] Execute the query to remove Statistic items $db->execute(); // [4550] Remove Statistic items from the ucm history table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4552] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($statistic_condition); $db->setQuery($query); // [4557] Execute the query to remove Statistic items $db->execute(); } } // [4465] Create a new query object. $query = $db->getQuery(true); // [4467] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4470] Where Help_document alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); $db->setQuery($query); // [4473] Execute query to see if alias is found $db->execute(); $help_document_found = $db->getNumRows(); // [4476] Now check if there were any rows if ($help_document_found) { // [4479] Since there are load the needed help_document type ids $help_document_ids = $db->loadColumn(); // [4483] Remove Help_document from the content type table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); // [4485] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($help_document_condition); $db->setQuery($query); // [4490] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4494] 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')); } // [4500] Remove Help_document items from the contentitem tag map table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); // [4502] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($help_document_condition); $db->setQuery($query); // [4507] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4511] 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')); } // [4517] Remove Help_document items from the ucm content table $help_document_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.help_document') ); // [4519] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($help_document_condition); $db->setQuery($query); // [4524] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4528] 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')); } // [4534] Make sure that all the Help_document items are cleared from DB foreach ($help_document_ids as $help_document_id) { // [4539] Remove Help_document items from the ucm base table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4541] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($help_document_condition); $db->setQuery($query); // [4546] Execute the query to remove Help_document items $db->execute(); // [4550] Remove Help_document items from the ucm history table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4552] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($help_document_condition); $db->setQuery($query); // [4557] Execute the query to remove Help_document items $db->execute(); } } // [4565] 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')); // [4570] Remove sermondistributor assets from the assets table $sermondistributor_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_sermondistributor%') ); // [4572] 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); { // [4580] 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!