TrackManiaControl/core/Update/PluginUpdateData.php

56 lines
1.3 KiB
PHP
Raw 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>
* @copyright 2014 ManiaControl Team
* @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;
/**
* 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;
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);
}
}