mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-13 07:11:14 +01:00
Added a fetch to get the latest update script, on update the update file deletes.
This commit is contained in:
parent
dd638b6dc7
commit
6030f3de74
2 changed files with 21 additions and 0 deletions
|
@ -24,6 +24,7 @@ class Update {
|
|||
public $archive = "";
|
||||
public $version = "";
|
||||
public $protocol = "";
|
||||
public $update_fiile = "";
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// METHODS
|
||||
|
@ -41,6 +42,7 @@ class Update {
|
|||
$this->archive = "https://gitlab.telaaedifex.com/xevidos/codiad/-/archive/master/codiad-master.zip";
|
||||
$this->commits = "https://gitlab.telaaedifex.com/api/v4/projects/3/repository/commits/";
|
||||
$this->tags = "https://gitlab.telaaedifex.com/api/v4/projects/3/repository/tags/";
|
||||
$this->update_file = "https://gitlab.telaaedifex.com/xevidos/codiad/raw/master/components/update/update.php";
|
||||
$this->protocol = $this->CheckProtocol();
|
||||
|
||||
}
|
||||
|
@ -126,6 +128,22 @@ class Update {
|
|||
$nightly = false;
|
||||
$response = $this->getRemoteVersion("check");
|
||||
|
||||
if ( $response["name"] > $current_version ) {
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $this->update_file);
|
||||
//curl_setopt($curl, CURLOPT_POSTFIELDS, "");
|
||||
curl_setopt($curl, CURLOPT_HEADER, 0);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13');
|
||||
$content = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
|
||||
unlink( "./update.php" );
|
||||
file_put_contents( "./update.php", $content );
|
||||
}
|
||||
|
||||
|
||||
//echo var_dump( $response );
|
||||
|
|
|
@ -305,6 +305,9 @@ class updater {
|
|||
|
||||
//Trigger update
|
||||
$this->update();
|
||||
|
||||
//Delete File
|
||||
unlink( __FILE__ );
|
||||
}
|
||||
|
||||
function check_protocol() {
|
||||
|
|
Loading…
Reference in a new issue