TrackManiaControl/core/Update/PluginUpdateData.php

61 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2014-05-02 04:03:02 +02:00
<?php
namespace ManiaControl\Update;
/**
* Plugin Update Data Model Class
2014-05-02 17:50:30 +02:00
*
* @author ManiaControl Team <mail@maniacontrol.com>
2020-01-22 10:39:35 +01:00
* @copyright 2014-2020 ManiaControl Team
2014-05-02 17:50:30 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
2014-05-02 04:03:02 +02:00
*/
class PluginUpdateData {
/*
* Public properties
2014-05-02 04:03:02 +02:00
*/
public $pluginId = null;
public $pluginName = null;
public $pluginAuthor = null;
public $pluginDescription = null;
public $id = null;
public $version = null;
public $zipfile = null;
public $url = null;
public $minManiaControlVersion = null;
public $maxManiaControlVersion = null;
2014-05-02 04:03:02 +02:00
/**
* Construct new plugin update data instance
2014-05-02 17:50:30 +02:00
*
2014-05-02 04:03:02 +02:00
* @param object $updateData
*/
public function __construct($updateData) {
2014-05-02 17:50:30 +02:00
$this->pluginId = $updateData->id;
$this->pluginName = $updateData->name;
$this->pluginAuthor = $updateData->author;
2014-05-02 04:03:02 +02:00
$this->pluginDescription = $updateData->description;
if ($updateData->currentVersion) {
2014-05-02 17:50:30 +02:00
$this->id = $updateData->currentVersion->id;
2014-05-02 04:03:02 +02:00
$this->version = $updateData->currentVersion->version;
$this->zipfile = $updateData->currentVersion->zipfile;
2014-05-02 17:50:30 +02:00
$this->url = $updateData->currentVersion->url;
$this->minManiaControlVersion = $updateData->currentVersion->min_mc_version;
$this->maxManiaControlVersion = $updateData->currentVersion->max_mc_version;
2014-05-02 04:03:02 +02:00
}
}
/**
* Check if the plugin update data is newer than the given plugin version
2014-05-02 17:50:30 +02:00
*
2014-05-02 04:03:02 +02:00
* @param float $version
* @return bool
*/
public function isNewerThan($version) {
if (!$version) {
return true;
}
return ($this->version > $version);
}
}