Initial work on making the update function functionable

This commit is contained in:
johnnyq 2021-11-20 16:36:55 -05:00
parent cfd7333a1b
commit 1551ea7c9b
2 changed files with 49 additions and 1 deletions

View File

@ -846,6 +846,12 @@ if(isset($_GET['download_database'])){
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Downloaded', log_description = 'Database', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
}
if(isset($_GET['update'])){
//Stuff will go here..
//also check to make sure someone has admin before running this function
}
if(isset($_POST['add_client'])){
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));

View File

@ -2,15 +2,57 @@
<?php include("settings-nav.php"); ?>
<?php
//fetch the latest code changes but don't apply them
exec("git fetch");
$latest_version = exec("gitrev-parse origin/master");
$current_version = exec("git rev-parse HEAD");
if($current_version == $latest_version){
$update_message = "No Updates available";
}else{
$update_message = "New Updates are Available [$latest_version]";
}
$git_log = shell_exec("git log master..origin/master --pretty=format:'<tr><td>%h</td><td>%ar</td><td>%s</td></tr>'");
?>
<div class="card card-dark">
<div class="card-header">
<h3 class="card-title"><i class="fa fa-fw fa-wrench"></i> Update</h3>
</div>
<div class="card-body">
<center>
<h2><small class="text-secondary">Current Version</small><br>afkjgjfshgkfjg763g43g</h2>
<h2><small class="text-secondary">Current Version</small><br><?php echo $current_version; ?></h2>
<?php if(!empty($git_log)){ ?>
<a class="btn btn-primary btn-lg my-4" href="post.php?update"><i class="fa fa-fw fa-4x fa-wrench"></i><br>Update<br>NOW</a>
<?php
}
?>
</center>
<?php
if(!empty($git_log)){
?>
<table class="table ">
<thead>
<tr>
<th>Commit</th>
<th>When</th>
<th>Changes</th>
</tr>
</thead>
<tbody>
<?php
echo $git_log;
?>
</tbody>
</table>
<?php
}
?>
</div>
</div>