2021-10-30 19:02:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Changelog_model extends MO_Model
|
|
|
|
{
|
2021-11-14 11:02:22 +01:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function new_version($version)
|
|
|
|
{
|
|
|
|
$time = time();
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$sql = "INSERT INTO changelog_versions VALUES(default, '$version', '$time')";
|
|
|
|
$this->db->query($sql);
|
|
|
|
$this->_create_sql($sql);
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function new_commit($text)
|
|
|
|
{
|
|
|
|
$time = time();
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$sql = "SELECT id FROM changelog_versions ORDER BY id DESC LIMIT 1";
|
|
|
|
$q = $this->db->query($sql);
|
|
|
|
$res = $q->row_array();
|
|
|
|
$versionid = $res['id'];
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$sql = "INSERT INTO changelog_commits VALUES(default, '$versionid', '$text', '$time')";
|
|
|
|
$this->db->query($sql);
|
|
|
|
$this->_create_sql($sql);
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function get_versions()
|
|
|
|
{
|
|
|
|
$sql = "SELECT * FROM changelog_versions ORDER BY timestamp DESC";
|
|
|
|
$q = $this->db->query($sql);
|
2021-10-30 19:02:07 +02:00
|
|
|
|
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
return $q->result_array();
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function get_commits()
|
|
|
|
{
|
|
|
|
$sql = "SELECT * FROM changelog_commits ORDER BY timestamp DESC";
|
|
|
|
$q = $this->db->query($sql);
|
2021-10-30 19:02:07 +02:00
|
|
|
|
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
return $q->result_array();
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//nowhitesp
|