xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
<root> / admin / update.php (acb1a812b070fa976b2f6c9b0229c8bbd35a86d1) (1,316B) (mode 100644) [raw]
<?php
// This must be executed at every update
error_reporting(E_ALL);
ini_set("track_errors", "On");

require_once("/etc/rocketgit/config.php");

$INC = dirname(__FILE__) . "/../inc";
require_once($INC . "/util.inc.php");
require_once($INC . "/log.inc.php");
require_once($INC . "/state.inc.php");
require_once($INC . "/sql.inc.php");
require_once($INC . "/db/struct.inc.php");

rg_log_set_file("/var/log/rocketgit/update.log");

$db = rg_sql_open($rg_sql);
if ($db === FALSE) {
	echo "Internal error (" . rg_sql_error() . ")!\n";
	exit(1);
}

// Get current schema version
$old_schema_ver = rg_state_get($db, "schema_version");
if (empty($old_schema_ver))
	$old_schema_ver = 1;

if (rg_sql_begin($db) !== TRUE) {
	echo "RocketGit: Cannot start transaction (" . rg_sql_error() . ")!\n";
	exit(1);
}

$ignore_errors = FALSE;
$drop_tables = FALSE;
$r = rg_sql_struct_run($db, $ignore_errors, $drop_tables, $old_schema_ver);
if ($r !== TRUE) {
	echo "rocketgir: Cannot update schema (" . rg_sql_error() . ")!\n";
	exit(1);
}

if (rg_state_set("schema_version", $rg_sql_schema_version) !== TRUE) {
	echo "rocketgir: Cannot set schema_version"
		. " (" . rg_state_error() . ")!\n";
	exit(1);
}

if (rg_sql_commit($db) !== TRUE) {
	echo "RocketGit: Cannot commit transaction (" . rg_sql_error() . ")!\n";
	exit(1);
}

?>
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master