コード例 #1
0
ファイル: table.php プロジェクト: thangredweb/redCORE
 /**
  * Uninstall Content Element from database
  *
  * @param   string  $option             The Extension Name ex. com_redcore
  * @param   string  $xmlFile            XML file to install
  * @param   bool    $showNotifications  Show notifications
  *
  * @return  boolean  Returns true if Content element was successfully installed
  */
 public static function uninstallContentElement($option = 'com_redcore', $xmlFile = '', $showNotifications = true)
 {
     $translationTables = RTranslationHelper::getInstalledTranslationTables();
     if (!empty($translationTables)) {
         $db = JFactory::getDbo();
         foreach ($translationTables as $translationTable => $translationTableParams) {
             if ($option == $translationTableParams->option && $xmlFile == $translationTableParams->xml) {
                 $newTable = self::getTranslationsTableName($translationTable, '');
                 try {
                     self::updateTableTriggers(array(), '', $translationTable);
                     $db->dropTable($newTable);
                     RTranslationHelper::setInstalledTranslationTables($option, $translationTable, null);
                     self::saveRedcoreTranslationConfig();
                 } catch (Exception $e) {
                     JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_DELETE_ERROR', $e->getMessage()), 'error');
                 }
             }
         }
     }
     if ($showNotifications) {
         JFactory::getApplication()->enqueueMessage(JText::_('COM_REDCORE_CONFIG_TRANSLATIONS_CONTENT_ELEMENT_UNINSTALLED'), 'message');
     }
     return true;
 }