Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Remove old third-party FR language pack on installation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlumpf committed Dec 29, 2015
1 parent 9e7a9cd commit 6d68114
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions mod_osmod.script.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @copyright Copyright (C) Martin Kröll. All Rights Reserved.
* @license tp://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/

// No direct access to this file
Expand Down Expand Up @@ -44,21 +44,42 @@ function preflight($type, $parent) {
// $type is the type of change (install, update or discover_install)
echo '<p>' . JText::_('MOD_OSMOD_PREFLIGHT') . '<ul>';

// Remove FR language pack
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('extension_id', 'name')))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('element') . ' = '. $db->quote('OSModulFrenchPack'));
$db->setQuery($query);

$frPack = $db->loadRow();
if(!empty($frPack)) {
echo '<li>' . $frPack[1] . '</li>';
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__extensions'))
->where($db->quoteName('extension_id') . ' = '. $frPack[0]);
$db->setQuery($query);
$db->execute();
rrmdir(JPATH_ROOT . '/modules/mod_osmod/language/fr-FR');
}


// Remove files from older releases
$folders = array('/modules/mod_osmod/leaflet',
'/modules/mod_osmod/images');

$files = array('/language/de-DE/de-DE.mod_osmod.ini',
'/language/de-DE/de-DE.mod_osmod.sys.ini',
'/language/en-GB/en-GB.mod_osmod.ini',
'/language/en-GB/en-GB.mod_osmod.sys.ini');

foreach ($folders as &$f) {
if (file_exists(JPATH_ROOT . $f)) {
echo '<li>' . JPATH_ROOT . $f . '</li>';
rrmdir(JPATH_ROOT . $f);
}
}

foreach ($files as &$f) {
if (file_exists(JPATH_ROOT . $f)) {
echo '<li>' . JPATH_ROOT . $f . '</li>';
Expand Down

0 comments on commit 6d68114

Please sign in to comment.