Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Improve state handling: do not check for an old value; verify if table exists before doing a select | 17d8eb4b4592dd96e62a8da74d87d3d3b26aeb86 | Catalin(ux) M. BOIE | 2017-03-26 09:37:01 |
Impoved debug for cache | 4d6349f7143d61583e6d2d9612c89b55af4eea97 | Catalin(ux) M. BOIE | 2017-03-26 09:36:08 |
I cannot be sure if the data is stored only in Germany. And we do backups in Romania. | 1610c997dbda53c0a21e301b51832d9285ecbcf2 | Catalin(ux) M. BOIE | 2017-03-26 08:24:46 |
Removed a not used variable | 4d2bab105c6f7748ca53d9a8301a2da320153d53 | Catalin(ux) M. BOIE | 2017-03-21 20:15:29 |
tests: ignore some dirs | 7260fc44f8d0197b917bc13a0ac19eb8c58d4534 | Catalin(ux) M. BOIE | 2017-03-21 20:01:03 |
Link to anon push doc | 42dbfdc9ad5fad0157388f239f790f2e8f4de7c2 | Catalin(ux) M. BOIE | 2017-03-21 20:00:45 |
comparison: add red/green for css/js sizes and for pagespeed | cbcda26a9d20c115eb0931ab2af69f3c2315ab7d | Catalin(ux) M. BOIE | 2017-03-21 19:44:47 |
Trim the hints for cloning the tree | 59bc91f5229abf96f453d872a58a2c96cf18198c | Catalin(ux) M. BOIE | 2017-03-21 19:35:58 |
Do the right thing (no error) when an empty tree is present | 7c138f486a81d09df44e811714d7bdeb92d7c01d | Catalin(ux) M. BOIE | 2017-03-21 19:34:03 |
Do not use UA when building anti-CSRF token. Think about plugins which change the UA at every request | 7346fceeff8bea1eaa500dd3ce1677deb84f8b77 | Catalin(ux) M. BOIE | 2017-03-21 16:36:46 |
Do not create a namespace anymore if the user has the rights to push | 13f8037ba76b57ae919758609c523dcbb6588745 | Catalin(ux) M. BOIE | 2017-03-19 19:44:07 |
Docker improvements | c3c0f8ff3f5a2f9acfeea2e9bbf271cfeae4a8bd | Catalin(ux) M. BOIE | 2017-03-19 19:43:25 |
Small changes regarding more debugging in several places | 03407e5f7562ac997612c56fd20fe067162ea8de | Catalin(ux) M. BOIE | 2017-03-19 19:42:58 |
Some improvements for comparison | e3a06443fba2c22009f0bde4ea9c3f201a9803cb | Catalin(ux) M. BOIE | 2017-03-19 19:41:53 |
Functional tests improvements | 6b82e5a1eaf800a15e42840bc9c889e32a7532f0 | Catalin(ux) M. BOIE | 2017-03-19 19:40:21 |
Do not report security violations generated by the functional tests | 6028674aa0153d4bc1c46999516f87a6019df6d2 | Catalin(ux) M. BOIE | 2017-03-19 19:38:23 |
Admin init form: pass next to user to be able to be cached by browsers | c3d9974e92a03a3ec4d093188842330bb7a0cad0 | Catalin(ux) M. BOIE | 2017-03-17 23:41:10 |
SELinux: Allow php-fpm to create log files | 94962a7b15e91acfa609663185ceab365a89ac98 | Catalin(ux) M. BOIE | 2017-03-17 23:39:01 |
Allow anonymous push when using git:// or ssh:// | 46d947874f12b7ac7f1ac3fa552f703c498082b2 | Catalin(ux) M. BOIE | 2017-03-02 22:17:48 |
tests: now we keep the state | c75b10325c24e32b699f22a13c9374e80fe45a2b | Catalin(ux) M. BOIE | 2017-03-02 22:05:43 |
File | Lines added | Lines deleted |
---|---|---|
inc/state.inc.php | 37 | 17 |
File inc/state.inc.php changed (mode: 100644) (index 54bfaab..e35035c) | |||
... | ... | function rg_state_get($db, $var) | |
41 | 41 | break; | break; |
42 | 42 | } | } |
43 | 43 | ||
44 | // Not found in cache, try the database | ||
45 | $params = array("var" => $var); | ||
46 | $sql = "SELECT value FROM state WHERE var = @@var@@ LIMIT 1"; | ||
47 | $res = rg_sql_query_params($db, $sql, $params); | ||
44 | // It may be possible the database was not created | ||
45 | // We return an empty string | ||
46 | $k = '__internal' . '::' . 'STATE_TABLE_EXISTS'; | ||
47 | $r = rg_cache_get($k); | ||
48 | if ($r === FALSE) { | ||
49 | // Let's see if the 'state' table is present | ||
50 | $r = rg_sql_rel_exists($db, 'state'); | ||
51 | if (($r === FALSE) || ($r === 0)) { | ||
52 | $ret = FALSE; | ||
53 | break; | ||
54 | } | ||
55 | rg_cache_set($k, 1, RG_SOCKET_NO_WAIT); | ||
56 | } | ||
57 | |||
58 | if ($r === 2) { // state table was loaded | ||
59 | // but the var is not there | ||
60 | $ret = ''; | ||
61 | break; | ||
62 | } | ||
63 | |||
64 | // We have to go in the database... | ||
65 | $sql = 'SELECT * FROM state'; | ||
66 | $res = rg_sql_query($db, $sql); | ||
48 | 67 | if ($res === FALSE) { | if ($res === FALSE) { |
49 | 68 | rg_state_set_error(rg_sql_error()); | rg_state_set_error(rg_sql_error()); |
50 | 69 | break; | break; |
... | ... | function rg_state_get($db, $var) | |
52 | 71 | ||
53 | 72 | $rows = rg_sql_num_rows($res); | $rows = rg_sql_num_rows($res); |
54 | 73 | if ($rows == 0) { | if ($rows == 0) { |
55 | $ret = ""; | ||
74 | $ret = ''; | ||
56 | 75 | } else { | } else { |
57 | $row = rg_sql_fetch_array($res); | ||
58 | $ret = $row['value']; | ||
59 | rg_cache_set("state::" . $var, $ret, RG_SOCKET_NO_WAIT); | ||
76 | $rows = array(); | ||
77 | while (($row = rg_sql_fetch_array($res))) { | ||
78 | $v = $row['var']; | ||
79 | $rows[$v] = $row['value']; | ||
80 | } | ||
81 | rg_cache_set('state', $rows, RG_SOCKET_NO_WAIT); | ||
82 | rg_cache_set($k, 2, RG_SOCKET_NO_WAIT); | ||
83 | |||
84 | if (isset($rows[$var])) | ||
85 | $ret = $rows[$var]; | ||
86 | else | ||
87 | $ret = ''; | ||
60 | 88 | } | } |
61 | 89 | rg_sql_free_result($res); | rg_sql_free_result($res); |
62 | |||
63 | 90 | break; | break; |
64 | 91 | } | } |
65 | 92 | ||
... | ... | function rg_state_set($db, $var, $value) | |
94 | 121 | ||
95 | 122 | $ret = FALSE; | $ret = FALSE; |
96 | 123 | while (1) { | while (1) { |
97 | $params = array("var" => $var, "value" => $value); | ||
98 | $old = rg_state_get($db, $var); | ||
99 | if ($old === FALSE) | ||
100 | break; | ||
101 | |||
102 | if (strcmp($old, $value) == 0) | ||
103 | return TRUE; | ||
104 | |||
124 | $params = array('var' => $var, 'value' => $value); | ||
105 | 125 | $sql = 'UPDATE state SET value = @@value@@' | $sql = 'UPDATE state SET value = @@value@@' |
106 | 126 | . ' WHERE var = @@var@@'; | . ' WHERE var = @@var@@'; |
107 | 127 | $res = rg_sql_query_params($db, $sql, $params); | $res = rg_sql_query_params($db, $sql, $params); |