<?php
error_reporting(E_ALL | E_STRICT);
ini_set("track_errors", "On");
// override the default
$rg_event_socket = "event.sock";
$INC = dirname(__FILE__) . "/../inc";
require_once(dirname(__FILE__) . "/config.php");
require_once($INC . "/init.inc.php");
require_once($INC . "/events.inc.php");
require_once($INC . "/sql.inc.php");
require_once($INC . "/struct.inc.php");
require_once($INC . "/fixes.inc.php");
rg_log_set_file("event.log");
require_once("common.php");
$rg_sql_debug = 1;
$sql = "DELETE FROM events";
$res = rg_sql_query($db, $sql);
rg_sql_free_result($res);
/*
* This function will generate an array of sub-events
*/
function notif_new_repo($db, $ev)
{
rg_log("notif_new_repo: ev=" . rg_array2string($ev));
$ret = array();
// Action 1
$ret[] = array_merge($ev, array("category" => 2, "prio" => 1));
// Action 2
$ret[] = array_merge($ev, array("category" => 3, "prio" => 1));
return $ret;
}
function func2and3($db, $ev)
{
rg_log_ml("ev=" . print_r($ev, TRUE));
return array();
}
// Register an event function
$functions = array();
$functions[1] = "notif_new_repo";
$functions[2] = "func2and3";
$functions[3] = "func2and3";
$r = rg_event_register_functions($functions);
if ($r !== TRUE) {
rg_log("Cannot register functions!");
exit(1);
}
// defaults
$event = array(
"prio" => 1,
"category" => 1,
'ri' => array('repo_id' => 200)
);
$r = rg_event_add($db, $event);
if ($r !== TRUE) {
rg_log("Cannot add event (" . rg_event_error() . ")!");
exit(1);
}
rg_event_signal_daemon('', 0);
$notify_list = array();
$r = rg_event_process_queue($db, $notify_list);
if ($r === FALSE) {
rg_log("Cannot process queue (" . rg_event_error() . ")!");
exit(1);
}
rg_sql_close($db);
rg_log("OK!");
?>
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