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.
Commit 481d2e0c17ee8ce3b255b6f672e1d5f6a75484b5

Lots of things. Fixes err- generation when I know I will test error code
Author: Catalin(ux) M. BOIE
Author date (UTC): 2015-04-18 08:03
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2015-04-18 08:03
Parent(s): 02e554c59c837b94e1a7c8bdfcf2256d68201ff5
Signing key:
Tree: 4594d457d5e707c576cccd2275774d3916d5fb4e
File Lines added Lines deleted
TODO 4 3
duilder.conf 1 1
inc/bug.inc.php 1 1
inc/plan.inc.php 2 1
inc/sql.inc.php 18 0
inc/user/keys/keys.php 1 4
inc/util.inc.php 9 5
root/themes/default/admin/plans/menu.html 1 1
root/themes/default/admin/repos/menu.html 1 1
root/themes/default/admin/users/menu.html 1 1
root/themes/default/index.html 1 1
root/themes/default/main.css 13 10
scripts/cachec.php 2 2
File TODO changed (mode: 100644) (index 7191bb5..d83e4d4)
1 1 == Where I stopped last time == == Where I stopped last time ==
2 2 [ ] Add "Spread the word!" on website. [ ] Add "Spread the word!" on website.
3 3
4 [ ] Security: validate sparas!
5 [ ] Menus - change color for selected items, not the background color.
6 4 [ ] Daca creez repo, nu-mi creaza dir-ul (de fapt, nu marcheaza in cache ca l-a [ ] Daca creez repo, nu-mi creaza dir-ul (de fapt, nu marcheaza in cache ca l-a
7 5 creat din cauza event-ului care nu poate sa se conecteze la cache: creat din cauza event-ului care nu poate sa se conecteze la cache:
8 6 broken pipe. Foarte ciudat. De ce nu ar putea trimite? broken pipe. Foarte ciudat. De ce nu ar putea trimite?
9 7 Probabil socket-ul nu mai e deschis pentru ca cache-ul s-a restartat? Probabil socket-ul nu mai e deschis pentru ca cache-ul s-a restartat?
8 Unde se intimpla asta?!
9 [ ] Remove any err- files at first install.
10 Se pare ca trebuie sa testez daca exista tabela 'state' in cron.php.
11 Poate nu numai aici. Si sa stochez informatia asta in cache.
10 12 [ ] I can do a select before write to be sure socket is open. [ ] I can do a select before write to be sure socket is open.
11 13 If I get an error signal from select, reopen the socket. If I get an error signal from select, reopen the socket.
12 [ ] Check search.
13 14 [ ] Run unit testing. [ ] Run unit testing.
14 15 [ ] SPF? mail-ul ajunge in spam! [ ] SPF? mail-ul ajunge in spam!
15 16 [ ] Upload kvm image to downloads.rocketgit.com. Sign it? sha256 it? [ ] Upload kvm image to downloads.rocketgit.com. Sign it? sha256 it?
File duilder.conf changed (mode: 100644) (index 6fcce08..594f89e)
1 1 PRJ="rocketgit" PRJ="rocketgit"
2 VER="0.26"
2 VER="0.27"
3 3 REV="1" REV="1"
4 4 EXCLUDE=".exclude" EXCLUDE=".exclude"
5 5 EXPORT_PATH="/data/www/umbrella/kernel/us/rocketgit" EXPORT_PATH="/data/www/umbrella/kernel/us/rocketgit"
File inc/bug.inc.php changed (mode: 100644) (index 5e8fba6..2ce9a07)
... ... function rg_bug_search_load($db, $repo_id, $uid, $name)
741 741 } }
742 742 $ret = $_data; $ret = $_data;
743 743 $ret['uid'] = $row['uid']; $ret['uid'] = $row['uid'];
744 $ret['name'] = $row['name']; // TODO: escape?!
744 $ret['name'] = $row['name'];
745 745 $ret['for_all_users'] = $row['for_all_users']; $ret['for_all_users'] = $row['for_all_users'];
746 746 $ret['standard'] = 0; $ret['standard'] = 0;
747 747 } else { } else {
File inc/plan.inc.php changed (mode: 100644) (index 6358354..dd9b1e9)
... ... function rg_plan_list_high_level($db, $rg)
268 268
269 269 $list = rg_plan_list($db); $list = rg_plan_list($db);
270 270 if ($list === FALSE) { if ($list === FALSE) {
271 $rg['errmsg'] = rg_plan_error(); // TODO: really? no array append?!
271 $rg['errmsg'] = rg_plan_error();
272 // TODO: really? no array append?!
272 273 return rg_template("admin/plans/list_err.html", $rg); return rg_template("admin/plans/list_err.html", $rg);
273 274 } }
274 275
File inc/sql.inc.php changed (mode: 100644) (index 95b424a..d2baec9)
... ... function rg_sql_rollback($h)
337 337 return TRUE; return TRUE;
338 338 } }
339 339
340 /*
341 * Test if a table exists
342 * Returns FALSE on error, 0 if does not exists, 1 if exists
343 */
344 function rg_sql_table_exists($db, $table)
345 {
346 $sql = "SELECT 1 FROM pg_class"
347 . " WHERE relname = '" . $table . "'";
348 $res = rg_sql_query($db, $sql);
349 if ($res === FALSE)
350 return FALSE;
351
352 $rows = rg_sql_num_rows($res);
353 rg_sql_free_result($res);
354
355 return $rows;
356 }
357
340 358 ?> ?>
File inc/user/keys/keys.php changed (mode: 100644) (index b7df8ac..473ab98)
... ... $del_errmsg = array();
7 7 $_keys = ""; $_keys = "";
8 8
9 9 $key = rg_var_str("key"); $key = rg_var_str("key");
10 // TODO: should we accept UTF-8 chars?
10 // TODO: should we accept UTF-8 chars (for comments)?
11 11 $key = preg_replace("|[^/A-Za-z0-9 @/+_\.\=,-]|", "", $key); $key = preg_replace("|[^/A-Za-z0-9 @/+_\.\=,-]|", "", $key);
12 12 $key_id = rg_var_uint("key_id"); $key_id = rg_var_uint("key_id");
13 13 $key_delete_ids = rg_var_str("key_delete_ids"); $key_delete_ids = rg_var_str("key_delete_ids");
14 14
15 // menu
16 $_url = rg_re_url($sparas);
17
18 15 $rg['HTML:status'] = ""; $rg['HTML:status'] = "";
19 16
20 17 if (rg_var_uint("add") == 1) { if (rg_var_uint("add") == 1) {
File inc/util.inc.php changed (mode: 100644) (index 9d87bf6..ce9ab9b)
... ... function rg_error_handler($no, $str, $file, $line)
1114 1114 if ($no == 0) if ($no == 0)
1115 1115 return; return;
1116 1116
1117 // call was prepended with '@'
1118 if (error_reporting() == 0)
1119 return;
1120
1117 1121 $msg = "PHP ERROR: $file:$line: $str (errno=$no)"; $msg = "PHP ERROR: $file:$line: $str (errno=$no)";
1118 1122 $key = md5($msg); $key = md5($msg);
1119 1123 rg_error_core($msg); rg_error_core($msg);
 
... ... function rg_socket_recv_wait($socket, $wait, $timeout)
1253 1257 $ret_buf = ""; $ret_buf = "";
1254 1258 while (1) { while (1) {
1255 1259 $reads = array($socket); $writes = array(); $ex = array(); $reads = array($socket); $writes = array(); $ex = array();
1256 $r = socket_select($reads, $writes, $ex, $tv_sec, $tv_usec);
1260 $r = @socket_select($reads, $writes, $ex, $tv_sec, $tv_usec);
1257 1261 if ($r === FALSE) { if ($r === FALSE) {
1258 1262 rg_log("Cannot select(" . socket_strerror(socket_last_error()) . ")!"); rg_log("Cannot select(" . socket_strerror(socket_last_error()) . ")!");
1259 1263 break; break;
 
... ... function rg_socket_recv_wait($socket, $wait, $timeout)
1269 1273 break; break;
1270 1274 } }
1271 1275
1272 $r = socket_recv($socket, $buf, 32 * 4096, 0);
1276 $r = @socket_recv($socket, $buf, 32 * 4096, 0);
1273 1277 if ($r === FALSE) { if ($r === FALSE) {
1274 1278 rg_log("Cannot receive(" . socket_strerror(socket_last_error()) . ")!"); rg_log("Cannot receive(" . socket_strerror(socket_last_error()) . ")!");
1275 1279 break; break;
 
... ... function rg_socket_send($socket, $buf)
1299 1303 $len = strlen($buf); $len = strlen($buf);
1300 1304 $off = 0; $off = 0;
1301 1305 while (1) { while (1) {
1302 $r = socket_send($socket, substr($buf, $off), $len - $off, 0);
1306 $r = @socket_send($socket, substr($buf, $off), $len - $off, 0);
1303 1307 if ($r === FALSE) { if ($r === FALSE) {
1304 1308 rg_log("Could not send (" . socket_strerror(socket_last_error()) . ")!"); rg_log("Could not send (" . socket_strerror(socket_last_error()) . ")!");
1305 1309 break; break;
 
... ... function rg_socket($path, $buf, $timeout, $tries)
1333 1337 if (isset($rg_socket_cache[$path])) { if (isset($rg_socket_cache[$path])) {
1334 1338 $socket = $rg_socket_cache[$path]; $socket = $rg_socket_cache[$path];
1335 1339 } else { } else {
1336 $socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
1340 $socket = @socket_create(AF_UNIX, SOCK_STREAM, 0);
1337 1341 if ($socket === FALSE) { if ($socket === FALSE) {
1338 1342 rg_log("Could not create socket (" . socket_strerror(socket_last_error()) . ")!"); rg_log("Could not create socket (" . socket_strerror(socket_last_error()) . ")!");
1339 1343 break; break;
1340 1344 } }
1341 1345
1342 1346 while ($tries > 0) { while ($tries > 0) {
1343 $r = socket_connect($socket, $path);
1347 $r = @socket_connect($socket, $path);
1344 1348 if ($r === FALSE) { if ($r === FALSE) {
1345 1349 $tries--; $tries--;
1346 1350 usleep(50 * 1000); usleep(50 * 1000);
File root/themes/default/admin/plans/menu.html changed (mode: 100644) (index 000adef..8a5a811)
1 <div class="menu menu2">
1 <div class="menu menu3">
2 2 <ul> <ul>
3 3 <li@@if(@@menu::sub2::list@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/plans/list">List</a></li> <li@@if(@@menu::sub2::list@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/plans/list">List</a></li>
4 4 <li@@if(@@menu::sub2::add@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/plans/add">Add</a></li> <li@@if(@@menu::sub2::add@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/plans/add">Add</a></li>
File root/themes/default/admin/repos/menu.html changed (mode: 100644) (index 4dc3284..18fbfb4)
1 <div class="menu menu2">
1 <div class="menu menu3">
2 2 <ul> <ul>
3 3 <li@@if(@@menu::sub2::list@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/repos/list">List</a></li> <li@@if(@@menu::sub2::list@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/repos/list">List</a></li>
4 4 <li@@if(@@menu::sub2::add@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/repos/add">Add</a></li> <li@@if(@@menu::sub2::add@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/repos/add">Add</a></li>
File root/themes/default/admin/users/menu.html changed (mode: 100644) (index b44bbe8..a10e38c)
1 <div class="menu menu2">
1 <div class="menu menu3">
2 2 <ul> <ul>
3 3 <li@@if(@@menu::sub2::list@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/users/list">List</a></li> <li@@if(@@menu::sub2::list@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/users/list">List</a></li>
4 4 <li@@if(@@menu::sub2::add@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/users/add">Add</a></li> <li@@if(@@menu::sub2::add@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/users/add">Add</a></li>
File root/themes/default/index.html changed (mode: 100644) (index ed76666..1a7cfdf)
42 42 <div id="menus"> <div id="menus">
43 43 <div class="menu"> <div class="menu">
44 44 <ul> <ul>
45 @@if(@@login_ui::uid@@ != 0){{<li@@if(@@menu::settings@@ == 1){{ class="selected"}}{{}}><a href="/op/settings">Settings</a></li>}}{{}}
46 45 <li@@if(@@menu::repo@@ == 1){{ class="selected"}}{{}}><a href="/op/repo">Repositories</a></li> <li@@if(@@menu::repo@@ == 1){{ class="selected"}}{{}}><a href="/op/repo">Repositories</a></li>
46 @@if(@@login_ui::uid@@ != 0){{<li@@if(@@menu::settings@@ == 1){{ class="selected"}}{{}}><a href="/op/settings">Settings</a></li>}}{{}}
47 47 @@if(@@login_ui::is_admin@@ == 1){{<li@@if(@@menu::admin@@ == 1){{ class="selected"}}{{}}><a href="/op/admin">Admin</a></li>}}{{}} @@if(@@login_ui::is_admin@@ == 1){{<li@@if(@@menu::admin@@ == 1){{ class="selected"}}{{}}><a href="/op/admin">Admin</a></li>}}{{}}
48 48 </ul> </ul>
49 49 </div> </div>
File root/themes/default/main.css changed (mode: 100644) (index fa3aa3d..12e3e61)
... ... form input[type="submit"] {
109 109 } }
110 110
111 111 .menu { .menu {
112 background-color: #AAA;
113 overflow: hidden;
112 background-color: #999;
114 113 padding: 3px 0px; padding: 3px 0px;
115 114 } }
116 115 .menu ul { list-style-type: none; } .menu ul { list-style-type: none; }
117 116 .menu ul li { .menu ul li {
118 display: inline;
119 padding: 5px 0px;
117 display: table-cell;
118 padding: 2px 0px;
120 119 } }
121 120 .menu ul li a { .menu ul li a {
122 121 text-decoration: none; text-decoration: none;
123 122 color: #FFF; color: #FFF;
124 123 font-size: 13pt; font-size: 13pt;
125 124 font-weight: bold; font-weight: bold;
126 padding: 5px 15px;
125 padding: 2px 15px;
127 126 } }
128 127 .menu ul li a:hover { color: red; } .menu ul li a:hover { color: red; }
129 .menu ul li.selected { background-color: #BBB; }
130 .menu ul li.selected a:hover { color: #CCC; }
128 .menu ul li.selected a { border-bottom: 2px solid #f00; }
129 .menu ul li.selected a:hover { color: red; }
130
131 .menu2 { background-color: #AAA; }
132 .menu2 ul li.selected a { border-bottom: 2px solid #f00; }
133 .menu2 ul li.selected a:hover { color: red; }
131 134
132 .menu2 { background-color: #BBB; }
133 .menu2 ul li.selected { background-color: #CCC; }
134 .menu2 ul li.selected a:hover { color: #FFF; }
135 .menu3 { background-color: #BBB; }
136 .menu3 ul li.selected a { border-bottom: 2px solid #f00; }
137 .menu3 ul li.selected a:hover { color: red; }
135 138
136 139 .junk {} .junk {}
137 140
File scripts/cachec.php changed (mode: 100644) (index 55d0ccf..40d77f3)
... ... rg_log_set_sid("000000"); // to spread the logs
30 30
31 31 rg_log("Start..."); rg_log("Start...");
32 32
33 $master = socket_create(AF_UNIX, SOCK_STREAM, 0);
33 $master = @socket_create(AF_UNIX, SOCK_STREAM, 0);
34 34 if ($master === FALSE) { if ($master === FALSE) {
35 35 rg_internal_error("Cannot create events socket!"); rg_internal_error("Cannot create events socket!");
36 36 exit(1); exit(1);
37 37 } }
38 38
39 $ret = socket_connect($master, $rg_cache_socket);
39 $ret = @socket_connect($master, $rg_cache_socket);
40 40 if ($ret === FALSE) { if ($ret === FALSE) {
41 41 echo "Cannot connect: " . socket_strerror(socket_last_error()) . "!\n"; echo "Cannot connect: " . socket_strerror(socket_last_error()) . "!\n";
42 42 exit(1); 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