<?php
error_reporting(E_ALL | E_STRICT);
ini_set("track_errors", "On");
$rg_sql_debug = 100;
$test_normal = TRUE;
$INC = dirname(__FILE__) . '/../inc';
require_once(dirname(__FILE__) . '/config.php');
require_once($INC . '/init.inc.php');
require_once($INC . '/log.inc.php');
require_once($INC . '/sql.inc.php');
rg_log_set_file('sql-fork.log');
require_once('common.php');
$sql = 'SELECT 1';
$r = rg_sql_query($db, $sql);
if ($r === FALSE) {
rg_log('Cannot run first query!');
exit(1);
}
rg_log('Forking...');
$pid = pcntl_fork();
if ($pid == 0) {
// child
rg_log_set_sid(rg_id(6));
rg_log('We are the child!');
$r = rg_sql_query($db, $sql);
if ($r === FALSE) {
rg_log('Cannot run query in child!');
exit(1);
}
exit(0);
} else if ($pid === -1) {
rg_log('Error forking!');
} else {
// server
sleep(1);
rg_log('We are the server!');
$r = rg_sql_query($db, $sql);
if ($r === FALSE) {
rg_log('Cannot run query after forking!');
exit(1);
}
}
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