2014-05-02 04:03:02 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ManiaControl\Update;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Plugin Update Data Structure
|
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
|
|
|
|
*/
|
|
|
|
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
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-02 16:13:45 +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);
|
|
|
|
}
|
|
|
|
}
|