@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) { // [4513] Get Application object $app = JFactory::getApplication(); // [4515] Get The Database object $db = JFactory::getDbo(); // [4524] Create a new query object. $query = $db->getQuery(true); // [4526] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4529] Where Preacher alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); $db->setQuery($query); // [4532] Execute query to see if alias is found $db->execute(); $preacher_found = $db->getNumRows(); // [4535] Now check if there were any rows if ($preacher_found) { // [4538] Since there are load the needed preacher type ids $preacher_ids = $db->loadColumn(); // [4542] Remove Preacher from the content type table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4544] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($preacher_condition); $db->setQuery($query); // [4549] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4553] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__content_type table')); } // [4559] Remove Preacher items from the contentitem tag map table $preacher_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); // [4561] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($preacher_condition); $db->setQuery($query); // [4566] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4570] 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')); } // [4576] Remove Preacher items from the ucm content table $preacher_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.preacher') ); // [4578] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($preacher_condition); $db->setQuery($query); // [4583] Execute the query to remove Preacher items $preacher_done = $db->execute(); if ($preacher_done); { // [4587] If succesfully remove Preacher add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__ucm_content table')); } // [4593] Make sure that all the Preacher items are cleared from DB foreach ($preacher_ids as $preacher_id) { // [4598] Remove Preacher items from the ucm base table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4600] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($preacher_condition); $db->setQuery($query); // [4605] Execute the query to remove Preacher items $db->execute(); // [4609] Remove Preacher items from the ucm history table $preacher_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $preacher_id); // [4611] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($preacher_condition); $db->setQuery($query); // [4616] Execute the query to remove Preacher items $db->execute(); } } // [4524] Create a new query object. $query = $db->getQuery(true); // [4526] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4529] Where Sermon alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); $db->setQuery($query); // [4532] Execute query to see if alias is found $db->execute(); $sermon_found = $db->getNumRows(); // [4535] Now check if there were any rows if ($sermon_found) { // [4538] Since there are load the needed sermon type ids $sermon_ids = $db->loadColumn(); // [4542] Remove Sermon from the content type table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4544] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_condition); $db->setQuery($query); // [4549] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4553] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__content_type table')); } // [4559] Remove Sermon items from the contentitem tag map table $sermon_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); // [4561] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_condition); $db->setQuery($query); // [4566] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4570] 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')); } // [4576] Remove Sermon items from the ucm content table $sermon_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermon') ); // [4578] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_condition); $db->setQuery($query); // [4583] Execute the query to remove Sermon items $sermon_done = $db->execute(); if ($sermon_done); { // [4587] If succesfully remove Sermon add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__ucm_content table')); } // [4593] Make sure that all the Sermon items are cleared from DB foreach ($sermon_ids as $sermon_id) { // [4598] Remove Sermon items from the ucm base table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4600] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_condition); $db->setQuery($query); // [4605] Execute the query to remove Sermon items $db->execute(); // [4609] Remove Sermon items from the ucm history table $sermon_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_id); // [4611] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_condition); $db->setQuery($query); // [4616] Execute the query to remove Sermon items $db->execute(); } } // [4524] Create a new query object. $query = $db->getQuery(true); // [4526] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4529] Where Sermon catid alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); $db->setQuery($query); // [4532] Execute query to see if alias is found $db->execute(); $sermon_catid_found = $db->getNumRows(); // [4535] Now check if there were any rows if ($sermon_catid_found) { // [4538] Since there are load the needed sermon_catid type ids $sermon_catid_ids = $db->loadColumn(); // [4542] Remove Sermon catid from the content type table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4544] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4549] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4553] 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')); } // [4559] Remove Sermon catid items from the contentitem tag map table $sermon_catid_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermons.category') ); // [4561] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4566] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4570] 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')); } // [4576] Remove Sermon catid items from the ucm content table $sermon_catid_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.sermons.category') ); // [4578] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4583] Execute the query to remove Sermon catid items $sermon_catid_done = $db->execute(); if ($sermon_catid_done); { // [4587] 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')); } // [4593] Make sure that all the Sermon catid items are cleared from DB foreach ($sermon_catid_ids as $sermon_catid_id) { // [4598] Remove Sermon catid items from the ucm base table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4600] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4605] Execute the query to remove Sermon catid items $db->execute(); // [4609] Remove Sermon catid items from the ucm history table $sermon_catid_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $sermon_catid_id); // [4611] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($sermon_catid_condition); $db->setQuery($query); // [4616] Execute the query to remove Sermon catid items $db->execute(); } } // [4524] Create a new query object. $query = $db->getQuery(true); // [4526] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4529] Where Series alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); $db->setQuery($query); // [4532] Execute query to see if alias is found $db->execute(); $series_found = $db->getNumRows(); // [4535] Now check if there were any rows if ($series_found) { // [4538] Since there are load the needed series type ids $series_ids = $db->loadColumn(); // [4542] Remove Series from the content type table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4544] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($series_condition); $db->setQuery($query); // [4549] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4553] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__content_type table')); } // [4559] Remove Series items from the contentitem tag map table $series_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); // [4561] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($series_condition); $db->setQuery($query); // [4566] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4570] 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')); } // [4576] Remove Series items from the ucm content table $series_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.series') ); // [4578] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($series_condition); $db->setQuery($query); // [4583] Execute the query to remove Series items $series_done = $db->execute(); if ($series_done); { // [4587] If succesfully remove Series add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__ucm_content table')); } // [4593] Make sure that all the Series items are cleared from DB foreach ($series_ids as $series_id) { // [4598] Remove Series items from the ucm base table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4600] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($series_condition); $db->setQuery($query); // [4605] Execute the query to remove Series items $db->execute(); // [4609] Remove Series items from the ucm history table $series_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $series_id); // [4611] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($series_condition); $db->setQuery($query); // [4616] Execute the query to remove Series items $db->execute(); } } // [4524] Create a new query object. $query = $db->getQuery(true); // [4526] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4529] Where Statistic alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); $db->setQuery($query); // [4532] Execute query to see if alias is found $db->execute(); $statistic_found = $db->getNumRows(); // [4535] Now check if there were any rows if ($statistic_found) { // [4538] Since there are load the needed statistic type ids $statistic_ids = $db->loadColumn(); // [4542] Remove Statistic from the content type table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4544] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($statistic_condition); $db->setQuery($query); // [4549] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4553] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__content_type table')); } // [4559] Remove Statistic items from the contentitem tag map table $statistic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); // [4561] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($statistic_condition); $db->setQuery($query); // [4566] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4570] 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')); } // [4576] Remove Statistic items from the ucm content table $statistic_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.statistic') ); // [4578] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($statistic_condition); $db->setQuery($query); // [4583] Execute the query to remove Statistic items $statistic_done = $db->execute(); if ($statistic_done); { // [4587] If succesfully remove Statistic add queued success message. $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__ucm_content table')); } // [4593] Make sure that all the Statistic items are cleared from DB foreach ($statistic_ids as $statistic_id) { // [4598] Remove Statistic items from the ucm base table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4600] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($statistic_condition); $db->setQuery($query); // [4605] Execute the query to remove Statistic items $db->execute(); // [4609] Remove Statistic items from the ucm history table $statistic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $statistic_id); // [4611] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($statistic_condition); $db->setQuery($query); // [4616] Execute the query to remove Statistic items $db->execute(); } } // [4524] Create a new query object. $query = $db->getQuery(true); // [4526] Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); // [4529] Where Help_document alias is found $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); $db->setQuery($query); // [4532] Execute query to see if alias is found $db->execute(); $help_document_found = $db->getNumRows(); // [4535] Now check if there were any rows if ($help_document_found) { // [4538] Since there are load the needed help_document type ids $help_document_ids = $db->loadColumn(); // [4542] Remove Help_document from the content type table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); // [4544] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); $query->where($help_document_condition); $db->setQuery($query); // [4549] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4553] 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')); } // [4559] Remove Help_document items from the contentitem tag map table $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); // [4561] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); $query->where($help_document_condition); $db->setQuery($query); // [4566] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4570] 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')); } // [4576] Remove Help_document items from the ucm content table $help_document_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_sermondistributor.help_document') ); // [4578] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); $query->where($help_document_condition); $db->setQuery($query); // [4583] Execute the query to remove Help_document items $help_document_done = $db->execute(); if ($help_document_done); { // [4587] 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')); } // [4593] Make sure that all the Help_document items are cleared from DB foreach ($help_document_ids as $help_document_id) { // [4598] Remove Help_document items from the ucm base table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4600] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); $query->where($help_document_condition); $db->setQuery($query); // [4605] Execute the query to remove Help_document items $db->execute(); // [4609] Remove Help_document items from the ucm history table $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // [4611] Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); $query->where($help_document_condition); $db->setQuery($query); // [4616] Execute the query to remove Help_document items $db->execute(); } } // [4624] 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')); // [4629] Remove sermondistributor assets from the assets table $sermondistributor_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_sermondistributor%') ); // [4631] 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); { // [4639] 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!