__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package DPCalendar
* @copyright Copyright (C) 2024 Digital Peak GmbH. <https://www.digital-peak.com>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
namespace DigitalPeak\Component\DPCalendar\Administrator\Model;
\defined('_JEXEC') or die();
use DigitalPeak\Component\DPCalendar\Administrator\Helper\DPCalendarHelper;
use DigitalPeak\ThinHTTP\CurlClient;
use Joomla\CMS\Cache\CacheControllerFactoryAwareInterface;
use Joomla\CMS\Cache\CacheControllerFactoryAwareTrait;
use Joomla\CMS\Cache\Controller\OutputController;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
class VersionModel extends BaseDatabaseModel implements CacheControllerFactoryAwareInterface
{
use CacheControllerFactoryAwareTrait;
/**
* Returns the remote version.
*/
public function getRemoteVersion(string $currentVersion): string
{
/** @var OutputController $cache */
$cache = $this->getCacheControllerFactory()->createCacheController('output', ['defaultgroup' => 'com_dpcalendar_version']);
$cache->setCaching(true);
$cache->setLifeTime(3600);
if ($cache->contains($currentVersion)) {
return $cache->get($currentVersion);
}
// Ignore dev
if ($currentVersion === 'DP_DEPLOY_VERSION') {
$cache->store('0', $currentVersion);
return '0';
}
$url = 'https://cdn.digital-peak.com/update/stream.php?id=19';
if ($id = DPCalendarHelper::getComponentParameter('downloadid')) {
$url .= '&dlid=' . $id;
}
// Get the current data
$response = (new CurlClient())->get(
$url . '&j=' . JVERSION . '&p=' . phpversion() . '&m=' . $this->getDatabase()->getVersion() . '&v=' . $currentVersion
);
// Check for errors
if ($response->dp->info->http_code !== 200) {
$cache->store('0', $currentVersion);
return '0';
}
// Create the XML
$xml = new \SimpleXMLElement($response->dp->body);
if (empty($xml->update)) {
$cache->store('0', $currentVersion);
return '0';
}
// The first element contains the most recent version
$update = $xml->update[0];
if (!$update instanceof \SimpleXMLElement) {
$cache->store('0', $currentVersion);
return '0';
}
// When there is a mismatch, trigger the updates fetch
if ((string)$update->version !== $currentVersion) {
$model = $this->bootComponent('installer')->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]);
$model->purge();
$model->findUpdates(0, 300);
}
$cache->store((string)$update->version, $currentVersion);
// Get the current version
return (string)$update->version;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| BookingsModel.php | File | 10.01 KB | 0664 |
|
| CaldavModel.php | File | 1.97 KB | 0664 |
|
| CalendarModel.php | File | 2.01 KB | 0664 |
|
| CountriesModel.php | File | 3.99 KB | 0664 |
|
| CountryModel.php | File | 2.86 KB | 0664 |
|
| CouponModel.php | File | 3.76 KB | 0664 |
|
| CouponsModel.php | File | 4.04 KB | 0664 |
|
| CpanelModel.php | File | 4.28 KB | 0664 |
|
| CurrencyModel.php | File | 4.32 KB | 0664 |
|
| EventModel.php | File | 30.82 KB | 0664 |
|
| EventsModel.php | File | 14.41 KB | 0664 |
|
| ExtcalendarModel.php | File | 5.59 KB | 0664 |
|
| ExtcalendarsModel.php | File | 4.92 KB | 0664 |
|
| FieldsOrderModel.php | File | 5.9 KB | 0664 |
|
| GeoModel.php | File | 19.71 KB | 0664 |
|
| IcalModel.php | File | 14.81 KB | 0664 |
|
| ImportModel.php | File | 7.37 KB | 0664 |
|
| LayoutModel.php | File | 704 B | 0664 |
|
| LocationModel.php | File | 12.06 KB | 0664 |
|
| LocationsModel.php | File | 8.94 KB | 0664 |
|
| PluginModel.php | File | 784 B | 0664 |
|
| TaxrateModel.php | File | 4.62 KB | 0664 |
|
| TaxratesModel.php | File | 4.33 KB | 0664 |
|
| TicketsModel.php | File | 10.21 KB | 0664 |
|
| ToolsModel.php | File | 1.61 KB | 0664 |
|
| VersionModel.php | File | 2.5 KB | 0664 |
|