Skip to content

Commit

Permalink
Installer update server modifications and version bump (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
obuisard authored Nov 21, 2024
1 parent 1eaf10f commit f9ad685
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 30 deletions.
4 changes: 2 additions & 2 deletions administrator/components/com_j2store/models/updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public function __construct($config = array())
}
$this->extraQuery = null;
$this->updateSiteName = 'J2Store Professional';
$this->updateSite = 'https://cdn.j2store.net/j2store4.xml';
$this->updateSite = 'https://updates.j2commerce.com/j2store/j2store4.xml';
}
}
}
4 changes: 2 additions & 2 deletions administrator/components/com_j2store/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
defined('_JEXEC') or die('Restricted Access');

define('J2STORE_PRO', '1');
define('J2STORE_VERSION', '4.0.9');
define('J2STORE_DATE', '2024-11-12');
define('J2STORE_VERSION', '4.0.10');
define('J2STORE_DATE', '2024-11-21');


2 changes: 1 addition & 1 deletion com_j2store.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<copyright>Copyright (c) 2024 J2Commerce. All rights reserved.</copyright>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://j2commerce.com</authorUrl>
<version>4.0.9</version>
<version>4.0.10</version>
<license>https://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3 or later</license>
<description><![CDATA[<h3>J2Store V4 Professional</h3>
Flexible and native Joomla shopping cart solution. <br>
Expand Down
34 changes: 9 additions & 25 deletions script.j2store.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ public function preflight($type, $parent)
$app = Factory::getApplication();
$db = Factory::getDbo();

// Remove the old j2store component update site that is now obsolete
$this->_removeUpdateSite('component', 'com_j2store', '', 'https://cdn.j2store.net/j2store4.xml');

//check of curl is present
if (!function_exists('curl_init') || !is_callable('curl_init')) {

Expand Down Expand Up @@ -313,9 +316,6 @@ public function preflight($type, $parent)
//----end of file removal//
//all set. Lets rock..

// Remove the old j2store component update site that is now obsolete
$this->_removeUpdateSite('component', 'com_j2store', '', 'https://cdn.j2store.net/j2store4.xml');

return true;
}

Expand Down Expand Up @@ -608,12 +608,16 @@ private function _removeUpdateSite($type, $element, $folder = '', $location = ''

if (empty($updatesite_id)) {
return false;
} else if (count($updatesite_id) == 1) {
}

foreach ($updatesite_id as $id) {
$query->clear();

$query->delete($db->quoteName('#__update_sites'));
$query->where($db->quoteName('update_site_id').' = '.$db->quote($updatesite_id[0]));
$query->where($db->quoteName('update_site_id').' = '.$db->quote($id));
if ($location) {
$query->where($db->quoteName('location').' = '.$db->quote($location));
}

$db->setQuery($query);

Expand All @@ -623,26 +627,6 @@ private function _removeUpdateSite($type, $element, $folder = '', $location = ''
Factory::getApplication()->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return false;
}
} else { // several update sites exist for the same extension therefore we need to specify which to delete

if ($location) {
$query->clear();

$query->delete($db->quoteName('#__update_sites'));
$query->where($db->quoteName('update_site_id').' IN ('.implode(',', $updatesite_id).')');
$query->where($db->quoteName('location').' = '.$db->quote($location));

$db->setQuery($query);

try {
$db->execute();
} catch (\RuntimeException $e) {
Factory::getApplication()->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return false;
}
} else {
return false;
}
}
} else {
return false;
Expand Down

0 comments on commit f9ad685

Please sign in to comment.