Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Cosmetic | 02376344f7d7d321d824ab7978de2ad49c007167 | Catalin(ux) M. BOIE | 2021-05-23 12:57:06 |
Added FIDO2 support for SSH | 04186abe13896ad4f4ea7126691d0a2b1798de1a | Catalin(ux) M. BOIE | 2021-05-23 12:30:43 |
ssh: show the id of the key both on web and when connecting | ab95ccfa2819d6ac9f427209ee61c75aad8a3661 | Catalin(ux) M. BOIE | 2021-05-23 10:52:44 |
Some events are doing some queries, and we need to cover them in transaction, not only the subevents | 4768ffec303961971cc0c3732a24e858f47dd381 | Catalin(ux) M. BOIE | 2020-12-15 07:33:36 |
Added rate limit for ssh and git connections | b667130e6c5721a3d30193863a5defd8bbff50f1 | Catalin(ux) M. BOIE | 2020-11-30 10:49:27 |
cosmetic | abe44edadda9da7c639b7bd8c9e13e6058555669 | Catalin(ux) M. BOIE | 2020-11-30 10:21:01 |
gpg functions and test | ecb9e05c99a2b73edfba5014329e362d8c6e9246 | Catalin(ux) M. BOIE | 2020-11-09 07:38:11 |
Stats page is not rendered for bots. | 29ca3f62ac460b64eb0a10fbb8bdfdf4a1767dc5 | Catalin(ux) M. BOIE | 2020-10-13 05:48:43 |
Added rate limit options | 60e939a52577a01603f9f386ffaf1a9712f99ab6 | Catalin(ux) M. BOIE | 2020-10-07 05:02:25 |
Improved bots list and clean old entries | 9da0a014040753734beabfecb298b8956fc25fe3 | Catalin(ux) M. BOIE | 2020-10-05 06:34:43 |
builder: use secrets only if available | 4fe47afc60435508ad90f62c51d489ac3c20b4d0 | Catalin(ux) M. BOIE | 2020-08-28 07:29:14 |
worker: use secrets only if available | 5371e918e294a46cc38c765371a1caf7a3083eef | Catalin(ux) M. BOIE | 2020-08-28 07:28:12 |
builder: do not break meta variable | 1d8207b1a782ab039406dbd087cdc9bb5ea0b898 | Catalin(ux) M. BOIE | 2020-08-28 07:27:48 |
Whitespace | 86086337c5323b073f517bc59c18aba0808fb4f3 | Catalin(ux) M. BOIE | 2020-08-24 07:22:13 |
Bump version to 0.73 | 7cac4d7a31116ac9ad86e0babeb0c1aace5dd852 | Catalin(ux) M. BOIE | 2020-08-23 15:32:03 |
duilder update | f691d84aa0aa70ef60a7487f247ed1a9ab1e3ab1 | Catalin(ux) M. BOIE | 2020-08-23 15:31:38 |
Bot prevention should not be active for edit operation | 371c60a486ea989fafb66266cab71ea9f7db0269 | Catalin(ux) M. BOIE | 2020-08-23 15:02:13 |
TODO update | 32591f3b1cf054bd70411592e5a82f5898d7da2f | Catalin(ux) M. BOIE | 2020-08-23 15:01:51 |
Show also by which protocol a user is connecting | d35b5b12103f9a72a3e8788e7c48532b9c1e5b89 | Catalin(ux) M. BOIE | 2020-08-23 15:01:30 |
Fixed a small locking issue (unlock without lock) | 0d1e7915545de251eea7f3bce468647fc2df1bf9 | Catalin(ux) M. BOIE | 2020-08-23 15:00:58 |
File History.txt changed (mode: 100644) (index a05c9b5..3f88d5f) | |||
24 | 24 | 2020-04-10 - Fedora has chosen GitLab EE as the Git Forge | 2020-04-10 - Fedora has chosen GitLab EE as the Git Forge |
25 | 25 | 2020-06-10 - RocketGit 0.72 released and installed on production (07:22 UTC). | 2020-06-10 - RocketGit 0.72 released and installed on production (07:22 UTC). |
26 | 26 | 2020-06-10 - RocketGit project was accepted by ReadTheDocs.io ad program. Thanks! | 2020-06-10 - RocketGit project was accepted by ReadTheDocs.io ad program. Thanks! |
27 | 2020-08-24 - RocketGit 0.73 released and installed on production (07:12 UTC, also switch to Fedora 32). |
File TODO changed (mode: 100644) (index 3d09bb1..b71bd61) | |||
16 | 16 | [ ] | [ ] |
17 | 17 | ||
18 | 18 | == Now == | == Now == |
19 | [ ] pkg: we need to store how many bytes were sent to the client for accounting purposes. | ||
20 | [ ] pkg: we need an api key to identify the user. | ||
21 | [ ] rpmdeb.com: 15$ for 5GiB storage + 15GiB bandwidth, 50$ 20+70, 100$ 50+150, 300$ 150+500. | ||
22 | [ ] I need to check the logs to see if cache is really refreshed when update_distro_info is called. | ||
23 | [ ] Do we need escaping for the link to the repo package? | ||
24 | [ ] A bot must not index pkg repos pages (https://rg.embedromix.ro:9003/user/catab/ci1/pkg)! | ||
25 | [ ] More changes from 'master' to 'main'. | ||
26 | [ ] head_link is not encoded properly (/ -> %2f)! | ||
27 | [ ] When clicking rpm URLs, set correct Content-Type. | ||
28 | [ ] rocketgit-*-*-ver.noarch.rpm should not be associated with a repo_id! | ||
29 | And should not be stored in meta. Or in a separate meta. How to distinguish between | ||
30 | them? Different folder? Yes, 'dotrepo'! | ||
31 | [ ] In /user/catab/ci1/pkg, I need to show the versions of the packages. | ||
32 | Maybe show older versions? | ||
33 | [ ] Do not build jobs (web hooks) for unconfirmed e-mails. | ||
34 | [ ] What to do with private repos mapping to global repo? | ||
35 | Can happen? | ||
36 | [ ] Decide what to do with environments. What to choose? | ||
37 | I think I should use the enabled ones. | ||
38 | Because the admin adding a new worker, with new envs, | ||
39 | agrees to add them automatically. | ||
40 | [ ] Analyze triggering of subbrepo regenerate | ||
41 | rg_wh_build_send_one | ||
42 | || | ||
43 | rg_pkg_subrepo_event_regenerate | ||
44 | || | ||
45 | rg_pkg_event_generate_dotrepo_rpm | ||
46 | pushing triggers the build and adds callback event_callbacks[]=pkg_generate_dotrepo_rpm_callback | ||
47 | worker sets status[pkg_subrepo_dirty] | ||
48 | builder receives job[status][pkg_subrepo_dirty] | ||
49 | rg_builder_done | ||
50 | adds event wh_build_job_done ev[status][pkg_subrepo_dirty] | ||
51 | calls rg_wh_build_job_done | ||
52 | process event_callbacks | ||
53 | rg_pkg_event_generate_dotrepo_rpm_callback | ||
54 | update distro_info | ||
55 | add ev:pkg_subrepo_regenerate | ||
56 | rg_pkg_subrepo_event_regenerate [RECURSIVE] | ||
57 | |||
58 | Another flow: | ||
59 | rg_pkg_subrepo_event_edit [only for previous generated dotrepos] [this is triggered because the name changed] | ||
60 | sets ev[force_regenerate_dotrepo] | ||
61 | ev:pkg_generate_dotrepo_rpm [pkg_repo_uid, env] | ||
62 | rg_pkg_event_generate_dotrepo_rpm | ||
63 | rg_pkg_prepare_ev_for_dotrepo | ||
64 | for every pkg_subrepo_id | ||
65 | if (!force_regenerate_dotrepo && sri[distro_info][dotrepo]) | ||
66 | continue | ||
67 | sets callback rg_pkg_event_generate_dotrepo_rpm_callback | ||
68 | rg_builder_add | ||
69 | |||
70 | And we want to call ev:pkg_subrepo_regenerate. Where? | ||
71 | But, what about just editing a repo? | ||
72 | |||
73 | [ ] Use case ci3: no user repo, only mappinng to global. | ||
74 | [ ] When a pkg (sub)repo name changes, we need to remove old files. | ||
75 | [ ] build_jobs: add another column with the type of build? 'vm', 'docker' etc.? | ||
76 | [ ] Add in Admin report how many e-mails are confirmed. | ||
77 | [ ] We have graphics for worker. It would be nice to show also the start/end | ||
78 | of the jobs, including the id. | ||
79 | [ ] Trigger a single build for global repos, not for every subrepo, like it is now. | ||
80 | [ ] For public repos, do the pkg repo mapping to global. For private ones, do not. | ||
81 | [ ] Add triggered_by to events for debug/status info.. | ||
82 | [ ] We can stream the build process by ssh, now that we have the channel... | ||
83 | [ ] If build job return error, do not update distro_info! | ||
84 | [ ] Problems pushing into a repo (ci1) | ||
85 | So, when I push, I expect to send a build job also containing dotrepo instructions. | ||
86 | Now it is not happening because the dotrepo info is not added. | ||
87 | It is added by: | ||
88 | - rg_pkg_subrepo_event_regenerate | ||
89 | - rg_pkg_event_generate_dotrepo_rpm | ||
90 | None are called when building a package! | ||
91 | |||
92 | [ ] In 'pkg_subrepo_event_regenerate' we have a time race: we do the build and we schedule the | ||
93 | 'generate_dotrepo'. 'generate_dotrepo' may happen first. | ||
94 | We should do it on a callback? | ||
95 | [ ] Now, when pushing as a normal user, I am calling createrepo, | ||
96 | but we should also create the dotrepo if not available. | ||
97 | rg_pkg_subrepo_event_regenerate | ||
98 | $ev['pkg_subrepos'][$pkg_subrepo_id] = $sri; | ||
99 | rg_builder_add | ||
100 | trigger event pkg_generate_dotrepo_rpm | ||
101 | |||
102 | rg_pkg_subrepo_event_edit | ||
103 | rg_pkg_subrepo_info | ||
104 | foreach ($di as $env => $info) | ||
105 | continue if dotrepo was never generated | ||
106 | trigger event pkg_generate_dotrepo_rpm | ||
107 | |||
108 | [ ] DELETE from events, should be in the same transaction, right? Seems it is not! | ||
109 | [ ] 'distros' -> 'envs'? | ||
110 | [ ] When we edit a pkg repo, we trigger the rebuild of all dotrepos for all enabled distros. | ||
111 | We should not do it! We should do it only when first package is built! We should, see below. | ||
112 | Now, subrepo add/edit triggers 'pkg_generate_dotrepo_rpm'. I THINK IT SHOULD NOT. What about the name?! | ||
113 | I think it should be triggered for all already built dotrepo envs. | ||
114 | Now, rgfs triggers 'pkg_subrepo_event_regenerate' to rebuild pkg repo. | ||
115 | It may build a pkg for a distro we do not have a dotrepo done. | ||
116 | So, we need to trigger a build of a dotrepo. | ||
117 | We need to pass a custom distro list. Maybe we will pass a distro list to override the internal one. | ||
118 | Call trace: | ||
119 | rgfs[has env] -> | ||
120 | -> rg_pkg_subrepo_event_regenerate -> | ||
121 | -> pkg_subrepo may need rebuilding (global repo may be empty - first package added) -> | ||
122 | -> TODO: if (pkg_subrepo.distro_info[env][dotrepo] == 0) => trigger dotrepo creation -> | ||
123 | TODO, we do NOT need to force regeneration. | ||
124 | We already pass the 'env', so, use it! | ||
125 | pkg_subrepo edit -> | ||
126 | -> event 'rg_pkg_subrepo_event_edit' -> | ||
127 | -> TODO: for (all already generated dotrepo) trigger 'pkg_generate_dotrepo_rpm' | ||
128 | TODO: we need to force the regeneration of existing dotrepos. | ||
129 | TODO: remove old name? | ||
130 | |||
131 | IT IS possible that pkg_generate_dotrepo_rpm is already looking for distro_info | ||
132 | and we do not have to do it in rg_pkg_subrepo_event_edit? I am checking... | ||
133 | It uses rg_distros_enabled. | ||
134 | Should we pass a parameter to signal the forcing? | ||
135 | |||
136 | TODO: rg_pkg_subrepo_event_edit - regenerate all dotrepo for all already-generated-dotrepo envs. | ||
137 | Seems now pkg_generate_dotrepo_rpm is called, but is not clear what 'env'! | ||
138 | [ ] Switch for rg_distros to a table (distro,major,arch) to be able to store if | ||
139 | a dotrepo exists? No, because this info is per subrepo! | ||
140 | Do not forget that dotrepo is for rpms only! | ||
141 | There is some value to allow a user to restrict the (sub)repo | ||
142 | to a subset of distros? | ||
143 | We can do it also in the json. | ||
144 | What about a user repo? I think this is triggered by an event. Check. | ||
145 | We should trigger also for the global repos, to always have them. | ||
146 | Where should I trigger and what function? | ||
147 | There are two orthogonal things: distro-major-arch and pkg_subrepos. | ||
148 | When we enable a distro-major-arch, we need to trigger the build of dotrepo, only for global. | ||
149 | We should not trigger for all user pkg repos - are too many. | ||
150 | When we add a pkg_repo, we need to trigger dotrepo for all distro-major-arch. | ||
151 | Can't we wait till the first package is built? | ||
152 | WHERE IS THE IMPACT? Where do we show the list of dotrepo links? | ||
153 | Per repo ("Packages" menu). Maybe it would be wise to filter there first the list | ||
154 | based on info whether a package is present in that repo? | ||
155 | Seems it is the only page where I do this, so, no need for now | ||
156 | to build dotrepo if we do not have at least one package. | ||
157 | If we will have a dotrepo page where we list all global repos, | ||
158 | we can still check if we have a dotrepo for that repo. | ||
159 | I think I should do not worry about this now. | ||
160 | Let's filter the dotrepo page first, and then we will see from there. | ||
161 | [ ] distros: should a user restrict more what distros should be active? Per user/repo? | ||
162 | I think this is already done from webhook. | ||
163 | [ ] pkg repo: what about private repositories? We should not expose the packages! | ||
164 | [ ] When we enable an architecture, should we trigger a rebuild of the dotrepo packages? | ||
165 | Maybe we should just wait for the first package. | ||
166 | But, I think the dotrepo is still not built. | ||
167 | Maybe we should add an event to check that. | ||
168 | [ ] I need to report top 20 from the 'elap' time pov. | ||
169 | [ ] Add to pkg meta, when createrepo took place. Worker? | ||
170 | [ ] 'ui' is ambigous; migrate to 'page_ui', 'login_ui', 'repo_ui' etc. | ||
171 | [ ] rgfs configuration is hardcoded! We need an entry in Admin's 'Settings'. | ||
172 | [ ] worker: we prefix packages with 'job_username' which is incorrect! | ||
173 | It should be repo_username! | ||
174 | [ ] Move "Packages" settings to 'Admin' section. Now is Settings (of Admin). | ||
175 | [ ] We should not allow any uid to edit pkg subrepos! Check also pkg repos. | ||
176 | [ ] pkg.list should be removed! Should we use full paths to not copy it? | ||
177 | [ ] pkg repo link for public user pkg repo seems to not contain /username/! Should it? | ||
178 | https://rg.embedromix.ro:9003/user/catab/ci1/pkg (not logged in) | ||
179 | Problem: we are showing links to dotrepo which do not exist! | ||
180 | We must know if a dotrepo was built. | ||
181 | [ ] We should not pass to the worker pkg_repos/subrepos/maps which are not needed (from a security pov). | ||
182 | Now, we are doing filtering in the worker. | ||
183 | We need to prepare a list of pkg_repos in rg_pkg_event_generate_rpm | ||
184 | which should trigger the rebuilding of the repos. | ||
185 | [ ] When we call rg_pkg_event_generate_dotrepo_rpm, what about the old files | ||
186 | (using old name of the pkg_repo)? | ||
19 | 187 | [ ] | [ ] |
20 | 188 | ||
21 | == BEFORE NEXT RELEASE == | ||
189 | == hook update | ||
190 | 15:57:16.484 3c908e Start a=rg_ssh_host=[ssh.rocketgit.com] rg_ssh_port=[22] rg_git_host=[git.rocketgit.com] rg_git_port=[9418] rg_version=[0.73-1] login_uid=[16353] login_url=[/user/binocuser] repo_id=[1238] ip=[84.39.112.106] namespace=[] repo_path=[/var/lib/rocketgit/repos/by_id/00/00/3F/E1/00003FE1/repos/by_id/1238.git] repo_name=[binoc-central] repo_uid=[16353] repo_clone_url_http=[https://rocketgit.com/user/binocuser/binoc-central] log_sid=[3c908e] | ||
191 | 15:57:16.487 3c908e _SERVER: GIT_DIR=[.] GIT_EXEC_PATH=[/usr/libexec/git-core] HOME=[/home/rocketgit] PATH=[/usr/libexec/git-core:/usr/bin:/bin] PGAPPNAME=[rg-web-3c908e] PWD=[/usr/share/rocketgit/root] ROCKETGIT_HOST=[rocketgit.com] ROCKETGIT_IP=[84.39.112.106] ROCKETGIT_ITIME=[1602086232.0622] ROCKETGIT_LOGIN_UID=[16353] ROCKETGIT_LOGIN_URL=[/user/binocuser] ROCKETGIT_LOG_SID=[3c908e] ROCKETGIT_REPO_CLONE_URL=[https://rocketgit.com/user/binocuser/binoc-central] ROCKETGIT_REPO_ID=[1238] ROCKETGIT_REPO_NAME=[binoc-central] ROCKETGIT_REPO_PATH=[/var/lib/rocketgit/repos/by_id/00/00/3F/E1/00003FE1/repos/by_id/1238.git] ROCKETGIT_REPO_UID=[16353] ROCKETGIT_SHOW_INFO=[0] SHLVL=[0] USER=[rocketgit] _=[/usr/libexec/git-core/git-receive-pack] PHP_SELF=[hooks/update] SCRIPT_NAME=[hooks/update] SCRIPT_FILENAME=[hooks/update] PATH_TRANSLATED=[hooks/update] DOCUMENT_ROOT=[] REQUEST_TIME_FLOAT=[1602086236.409] REQUEST_TIME=[1602086236] argv=[0=[hooks/update] 1=[refs/namespaces/rg_a7b60b3a/refs/heads/RELEASE] 2=[c3c0daa5a0a3766f68e7fa6b6af051c9f3a0a2c7] 3=[0000000000000000000000000000000000000000]] argc=[4] | ||
192 | 15:57:16.488 3c908e refname=refs/namespaces/rg_a7b60b3a/refs/heads/RELEASE old_rev=c3c0daa5a0a3766f68e7fa6b6af051c9f3a0a2c7 new_rev=0000000000000000000000000000000000000000 | ||
193 | 15:57:16.488 3c908e git_type: obj=c3c0daa5a0a3766f68e7fa6b6af051c9f3a0a2c7 | ||
194 | 15:57:16.488 3c908e exec2 [git -c gc.auto=0 cat-file -t 'c3c0daa5a0a3766f68e7fa6b6af051c9f3a0a2c7'] | ||
195 | 15:57:17.491 3c908e new_rev_type=commit | ||
196 | 15:57:17.507 3c908e Internal error: Unknown refname type provided [refs/namespaces/rg_a7b60b3a/refs/heads/RELEASE] | ||
197 | 15:57:17.543 3c908e FATAL: Unknown refname type provided [refs/namespaces/rg_a7b60b3a/refs/heads/RELEASE] | ||
198 | |||
199 | == web | ||
200 | /usr/libexec/git-core/git-receive-pack --stateless-rpc '/var/lib/rocketgit/repos/by_id/00/00/3F/E1/00003FE1/repos/by_id/1238.git' | ||
201 | |||
202 | == post-receive | ||
203 | 15:58:19.145 3c908e Start namespace= repo_path=/var/lib/rocketgit/repos/by_id/00/00/3F/E1/00003FE1/repos/by_id/1238.git | ||
204 | 15:58:19.148 3c908e _SERVER: GIT_DIR=[.] GIT_EXEC_PATH=[/usr/libexec/git-core] GIT_PUSH_OPTION_COUNT=[0] HOME=[/home/rocketgit] PATH=[/usr/libexec/git-core:/usr/bin:/bin] PGAPPNAME=[rg-web-3c908e] PWD=[/usr/share/rocketgit/root] ROCKETGIT_HOST=[rocketgit.com] ROCKETGIT_IP=[84.39.112.106] ROCKETGIT_ITIME=[1602086232.0622] ROCKETGIT_LOGIN_UID=[16353] ROCKETGIT_LOGIN_URL=[/user/binocuser] ROCKETGIT_LOG_SID=[3c908e] ROCKETGIT_REPO_CLONE_URL=[https://rocketgit.com/user/binocuser/binoc-central] ROCKETGIT_REPO_ID=[1238] ROCKETGIT_REPO_NAME=[binoc-central] ROCKETGIT_REPO_PATH=[/var/lib/rocketgit/repos/by_id/00/00/3F/E1/00003FE1/repos/by_id/1238.git] ROCKETGIT_REPO_UID=[16353] ROCKETGIT_SHOW_INFO=[0] SHLVL=[0] USER=[rocketgit] _=[/usr/libexec/git-core/git-receive-pack] PHP_SELF=[hooks/post-receive] SCRIPT_NAME=[hooks/post-receive] SCRIPT_FILENAME=[hooks/post-receive] PATH_TRANSLATED=[hooks/post-receive] DOCUMENT_ROOT=[] REQUEST_TIME_FLOAT=[1602086299.0729] REQUEST_TIME=[1602086299] argv=[0=[hooks/post-receive]] argc=[1] | ||
205 | 15:58:19.148 3c908e refname=refs/heads/RELEASE old_rev=c3c0daa5a0a3766f68e7fa6b6af051c9f3a0a2c7 new_rev=41e4c9cd1ec25fa66c7f7af137fd094e35d19646. | ||
206 | 15:58:19.148 3c908e refname=refs/heads/nav-shellservice-work old_rev=0000000000000000000000000000000000000000 new_rev=16344c5da3b5347ea2c73049614f5e08032d0917. | ||
207 | 15:58:19.148 3c908e refname=refs/heads/origin/RELEASE old_rev=0000000000000000000000000000000000000000 new_rev=41e4c9cd1ec25fa66c7f7af137fd094e35d19646. | ||
208 | 15:58:19.148 3c908e refname=refs/heads/origin/TRUNK old_rev=0000000000000000000000000000000000000000 new_rev=41e4c9cd1ec25fa66c7f7af137fd094e35d19646. | ||
209 | 15:58:19.148 3c908e refname=refs/heads/upstream/HEAD old_rev=0000000000000000000000000000000000000000 new_rev=41e4c9cd1ec25fa66c7f7af137fd094e35d19646. | ||
210 | 15:58:19.148 3c908e refname=refs/heads/upstream/RELEASE old_rev=0000000000000000000000000000000000000000 new_rev=41e4c9cd1ec25fa66c7f7af137fd094e35d19646. | ||
211 | 15:58:19.148 3c908e refname=refs/heads/upstream/TRUNK old_rev=0000000000000000000000000000000000000000 new_rev=41e4c9cd1ec25fa66c7f7af137fd094e35d19646. | ||
212 | 15:58:19.148 3c908e refname=refs/heads/upstream/nav-shellservice-work old_rev=0000000000000000000000000000000000000000 new_rev=41e4c9cd1ec25fa66c7f7af137fd094e35d19646. | ||
213 | 15:58:19.150 3c908e Profiling: time_ms runs mem | ||
214 | 15:58:19.150 3c908e del_tree 2 11 0 | ||
215 | 15:58:19.150 3c908e post-receive 5 1 0 | ||
216 | 15:58:19.150 3c908e peak: 4.00 MiB | ||
217 | |||
218 | Seems we are cloning the namespace, before knowing if the user can push! | ||
219 | |||
220 | == FOR OTHER RELEASE == | ||
221 | [ ] fido2: a user/org/admin must be able to disable 'no touch' or 'no pin' keys. | ||
222 | By not setting "no-touch" or by setting "verify-required". | ||
223 | [ ] ssh: admin must be able to disale completely !fido2 keys. | ||
224 | [ ] Make sk options dependent on ssh version? How to get it? Env? | ||
225 | [ ] keys: add hint about resident keys. | ||
226 | [ ] When fetching/pushing it would be nice to show by what protocol and with what key/user/ip etc. | ||
227 | [ ] fido2: admin may enforce attestation. User must use 'write-attestation' | ||
228 | option and upload the conntent. | ||
229 | [ ] totp: show how much time the connection is still active. | ||
230 | [ ] Fid a solution to prevet mining without requiring a credit card as GitLab. | ||
231 | [ ] Document '-O no-touch-required' and '-O verify-required'. | ||
232 | [ ] Pushing ci1 should map to priv1/stab (25/9). It builds rpms but the repo is not shown. | ||
233 | Probaly because is private. Check logs. | ||
234 | [ ] conn: split bytes into in/out. | ||
235 | [ ] Get rid of $rg_distros. | ||
236 | [ ] Store also the number of bytes deleivered in 'conns'. It will be used | ||
237 | for charging. Done. Graphics are ok because of the -1? | ||
238 | [ ] Pay attention to history (switching from public to private) when recording | ||
239 | bandwidth and other stuff. | ||
240 | [ ] feature: auto-update container images. | ||
241 | [ ] containers: scan for security. | ||
242 | [ ] Autodetect that AuthorizedKeysCommand is in plae (ssh was restarted) | ||
243 | and switch automatically, without Admin configuration. | ||
244 | [ ] Add worker_id to meta to be able to add a link to it in pkg page? | ||
245 | [ ] Add posibility to export shell variables for API by ssh. | ||
246 | [ ] build_jobs: We must switch from 'rgw' to the real branch name when we clone a repo. | ||
247 | [ ] How do we give rights for a private repo? | ||
248 | Maybe when a user downloads the private pkg repo to already have an | ||
249 | api key inside? | ||
250 | [ ] From time to time send an e-mail just to see that the e-mail is still active? | ||
251 | [ ] When we delete a worker, we should schedule the deletion of stats for it. Any other info? | ||
252 | [ ] Allow user to receive notifications by e-mail about the build. | ||
253 | [ ] Compare: "Usable on slow links". | ||
254 | [ ] Allow a regex for selecting the distro in the webhooks. | ||
255 | [ ] Allow users to call rg_notify with a channel name, defined in webhooks (streaming build log). | ||
256 | [ ] When rg_notify sais DONE, just destroy the VM - do not wait for shutdown! | ||
257 | [ ] When pushing, show the user if the job will trigger some pipelines! | ||
258 | [ ] Show what workers are available per distro (in Admin section)? | ||
259 | [ ] pkg-repo - show how many downloads... | ||
260 | Show how many downloads of the dotrepo file. I could look into stats (maybe build them by cron) | ||
261 | or increment at every download. | ||
262 | [ ] We should deal with PostgreSQL restart. | ||
263 | If we are not in a transaction, just repeat the operation. | ||
264 | If we are in a transaction, probably we will have to redo all queries, from the beginning. | ||
265 | This may need some thinking, but I think is doable. | ||
266 | [ ] Why do I need 'rg_distros'? | ||
267 | - I have to know for what distros to build packages. | ||
268 | - I have to show this list when a user selects the environment for builder. | ||
269 | Problems: | ||
270 | - We restrict a strange distro exported by a user worker. | ||
271 | Solutions: | ||
272 | - Keep a list per user? And join it with the global one? | ||
273 | But, without information about rpm/deb type, I cannot use it anyway. | ||
274 | Us, not, but the user may deal with that. | ||
275 | So, probably how it is now it is ok. I have to test. | ||
276 | [ ] I need to figure a way to trigger the recomputing of (sub)repo disk_used_mb. | ||
277 | Somehow, I may need to instruct rg_wh_build_job_done to add another event. | ||
278 | I also need to add 'pkg_repo_mb' filed to 'users' table and populate it. | ||
279 | [ ] rgfs must stop at first error. | ||
280 | [ ] Report disk sized and the number of files for pkg repo. | ||
281 | [ ] wh: Add a header when doing the request and test it in index.php. | ||
282 | If it present, it is clear that the request is local and drop it! | ||
283 | This is to not test for aspecial id. | ||
284 | [ ] Put "chage" back! | ||
285 | [ ] events: if a prio X event fails, and another one with prio X + n follows, | ||
286 | but depends on the one with prio X, we have a problem. We should | ||
287 | not allow the event to continue. Some dependency enforcing. | ||
288 | [ ] pkg: We should not trigger the rebuild if important info did not changed. | ||
289 | [ ] pkg repo: How do I show the list of pkg repos for a git repo? | ||
290 | - Global repo should be visible in all pkg repo lists? Probably not. Hm. | ||
291 | How will the users will discover the Global repo? Put it in the footer? | ||
292 | In Settings/Packages/Repositories: | ||
293 | - We need instructions to install the repo (links to different | ||
294 | distros). | ||
295 | We should check all distro repos if there is a folder with the same name | ||
296 | as the username and look at the metadata. | ||
297 | We should just signal if a package is available and link to the | ||
298 | 'install repo' page. We should list all available distros? | ||
299 | [ ] Populate 'distro' state variable in 'Admin' section and by the workers. | ||
300 | [ ] repo_history is not indexed by anything. And, why we need the uid there?! | ||
301 | It is indexed by itime. Should it be also by repo_id? | ||
302 | [ ] I hope worker does not connect to the database! | ||
303 | We do not want a compomised worker to be able to dump the db! | ||
304 | [ ] builder: signal if the user wants to reuse the old image. Charge for keeping it! | ||
305 | [ ] | ||
306 | |||
307 | [ ] packages: | ||
308 | - Switch to events to delete repos/subrepos/mappings. | ||
309 | Why? Because we also need to clean the files stored in fs. | ||
310 | - Default mapping should be in Global/testing? | ||
311 | - We need to re-trigger the rebuilding of the pkg sub-repos when we update pkg repo. | ||
312 | Why? Because of the name changed? | ||
313 | - I need to separate the two steps: the building and the repo re-building. | ||
314 | The build should only trigger the rebuild of the repos. | ||
315 | But, we have the machine started, we could also do the repo re-build. | ||
316 | They will be completely different steps. Because a user can install | ||
317 | from rocketgit pkg repo, and the user can execute things as root. | ||
318 | We should allow random repository installation. | ||
319 | - Allow a comment in the commit message to generate some tagging of the | ||
320 | packages to be seen as a CVE/security/sec-severity etc. | ||
321 | - Seems I do not respect the uid of the pusher when we build pkg repo stuff. | ||
322 | When I show the pkg repos for a user, I need to take pkg_map in consideration! Also, the existing pkg files (from rgfs). | ||
323 | I think that by rgfs is ok because pkg_map was already was taken in consideration. | ||
324 | Also, should we filter by distribution? | ||
325 | - Building global repos must never be sent to an untrusted worker for | ||
326 | security issues (leaking rgfs_key). | ||
327 | - We still need to validate the path in rgfs. | ||
328 | |||
329 | [ ] worker: if machine does not start in an amount of time, we should destroy | ||
330 | it and try again. After some tries, abort and inform the admin. | ||
331 | [ ] wh: list last build? Only the repo name? status? more entries? | ||
332 | [ ] pkg repo: are UTF-8 working in package names? | ||
333 | [ ] Rate-limit: we can offer a "try after x seconds" header. | ||
334 | [ ] Create a docker repository, add Clair for scanning. | ||
335 | [ ] artifacts: https://fedoramagazine.org/latex-typesetting-part-3-formatting/ | ||
336 | [ ] rg_tmp_path - clean old entries. | ||
337 | [ ] Artifacts should not be stored in branch name folder (example 'master') | ||
338 | but in the hash folder! Right? | ||
339 | [ ] Allow rate-limiting of the outgoing mails. | ||
340 | [ ] events: instead of returning FALSE, return an array which can signal the postponing of the task. | ||
341 | For example, we may not have the gpg key ready when a repo rebuild is triggered. | ||
342 | Also, we may signal that we should not retry a task. | ||
343 | [ ] css: parent: "display-flex: flex-flow: columns", childs: "flex-grow: 1" or "flex-shrink: 0" | ||
344 | Pay attention on settings / Login tokens: we have hints as main content! | ||
345 | [ ] "prio" in different areas, is not clear which are first (bigger or smaller). | ||
346 | Correct: bigger = last checked. | ||
347 | [ ] css: Merge 'form_error' and 'mess error' divs. | ||
348 | [ ] Size occupied by repos. | ||
349 | [ ] Generate event for repo add? Maybe to add gpg key? | ||
350 | Or generate key at first use? | ||
351 | In user history we should mark the adding of the pkg repo. | ||
352 | [ ] Update session only after the page is sent to the client. | ||
353 | [ ] stats: add a functional test for bots. | ||
354 | [ ] stats: show type of the requests with different colors. | ||
355 | [ ] Add a possibility to mark a repository as "disabled by admin". | ||
356 | [ ] Add a possibility to prevent others to publish the same git tree. | ||
357 | We can just mark that repo as "special" and we block others to publish | ||
358 | the same repository. We need to define "same": some hash chains | ||
359 | or some hash for some files. | ||
360 | [ ] when we build, we ignore that we may did that build, for same treeish id. | ||
361 | Think fast-forwards in 'releases' branches. We should reuse them. | ||
362 | [ ] wh: we should fail the build if we cannot generate packages. | ||
363 | [ ] If build fails, the rocketgit-j-jobid remains. Should be deleted? | ||
364 | [ ] wh: seems I index everything with $jid, but I do not take the environment | ||
365 | in consideration! | ||
366 | [ ] db: when we get an error in connecting, do not complain immediately. | ||
367 | Try again. | ||
368 | [ ] report1: what users logged in yesterday. | ||
369 | [ ] wh: when using a regex, show what repos/branches are matching? | ||
370 | [ ] wh: show what projects are covered by every webhook. | ||
371 | [ ] rpm: ok, we have the .src.rpm. We need to build locally the .rpm | ||
372 | and create the repo. | ||
373 | [ ] artifacts: even if we have a single rpm file specified, we need to deal | ||
374 | with it. Seems that now we only deal with directories. | ||
375 | [ ] artifacts: seems we ignore 'map' if it does not end in '/', but we should | ||
376 | not! | ||
377 | [ ] rg_state_get must test for error! | ||
22 | 378 | [ ] css: flex + space-between must go! <p> has a margin-top. | [ ] css: flex + space-between must go! <p> has a margin-top. |
23 | 379 | [ ] We need to move key update usage after the operation, to get better speed. | [ ] We need to move key update usage after the operation, to get better speed. |
24 | 380 | [ ] Trim init/push hints if the repo is not empty? | [ ] Trim init/push hints if the repo is not empty? |
41 | 397 | [ ] artifacts: remove and expiration support. | [ ] artifacts: remove and expiration support. |
42 | 398 | [ ] "Please login first" message must go. We need to redirect to the login page. | [ ] "Please login first" message must go. We need to redirect to the login page. |
43 | 399 | [ ] https://phpqa.io/ (PHP Quality Assurance) | [ ] https://phpqa.io/ (PHP Quality Assurance) |
44 | [ ] wh: show what projects are covered by every webhook. | ||
45 | 400 | [ ] doc: Secrets to Webhook tutorial. | [ ] doc: Secrets to Webhook tutorial. |
46 | 401 | [ ] builder: under lock, build a source -> artifacts table to easy the lookup. | [ ] builder: under lock, build a source -> artifacts table to easy the lookup. |
47 | 402 | [ ] artifacts: document './' and dirs which must end in '/'. | [ ] artifacts: document './' and dirs which must end in '/'. |
62 | 417 | [ ] worker: cache last image to not re-download/build everything from the start. | [ ] worker: cache last image to not re-download/build everything from the start. |
63 | 418 | [ ] Secrets: Allow secrets also per user/group and allow them to be lended | [ ] Secrets: Allow secrets also per user/group and allow them to be lended |
64 | 419 | to the projects. | to the projects. |
65 | [ ] artifacts: allow user to specify an expiration time. | ||
66 | 420 | [ ] Send an alarm to admin if disk space is low? Other cases? | [ ] Send an alarm to admin if disk space is low? Other cases? |
67 | [ ] Compute separately the artifacts disk size and repo disk size. | ||
68 | 421 | [ ] artifacts: allow folder download. | [ ] artifacts: allow folder download. |
69 | 422 | [ ] artifacts: allow them to be used on wiki. | [ ] artifacts: allow them to be used on wiki. |
70 | 423 | [ ] rg_conn_*: when we shutdown a connection, we should not send anymore! | [ ] rg_conn_*: when we shutdown a connection, we should not send anymore! |
71 | 424 | [ ] report1: show elap for all type of objects. | [ ] report1: show elap for all type of objects. |
72 | [ ] report1: shot top 10 biggest repositories (and the users). | ||
73 | 425 | [ ] worker: after worker restart, the jobs are not reloaded from fs. | [ ] worker: after worker restart, the jobs are not reloaded from fs. |
74 | 426 | [ ] Temporary artifacts seems to not be cleaned! | [ ] Temporary artifacts seems to not be cleaned! |
75 | 427 | [ ] Allow hooks to be defined directly in the repository. | [ ] Allow hooks to be defined directly in the repository. |
77 | 429 | [ ] There are other tables with last_ip which is not populated at login. | [ ] There are other tables with last_ip which is not populated at login. |
78 | 430 | [ ] When adding a build webhook, "Create repository" trigger event does | [ ] When adding a build webhook, "Create repository" trigger event does |
79 | 431 | not make sense. | not make sense. |
80 | [ ] Remove all " size=\"" stuff, now that we stratch the content. | ||
432 | [ ] Remove all " size=\"" stuff, now that we stretch the content. | ||
81 | 433 | [ ] https://www.w3schools.com/Css/tryit.asp?filename=trycss_table_responsive | [ ] https://www.w3schools.com/Css/tryit.asp?filename=trycss_table_responsive |
82 | 434 | to have a horizontal scrollbar for wide tables? | to have a horizontal scrollbar for wide tables? |
83 | 435 | [ ] artifacts: flag to prevent recursion? | [ ] artifacts: flag to prevent recursion? |
84 | [ ] packages: scn .spec file and deban folder to figure out what packages to | ||
436 | [ ] packages: scan .spec file and debian folder to figure out what packages to | ||
85 | 437 | install. | install. |
86 | 438 | [ ] Use rg_url_segments on source/tree. Get rid of / -> ,! | [ ] Use rg_url_segments on source/tree. Get rid of / -> ,! |
87 | [ ] Somehow, I need to log (conns) also the downloads. | ||
439 | [ ] Somehow, I need to log (conns) also the artifacts downloads. | ||
88 | 440 | [ ] When we download a file, we may want to instruct nginx to not compress | [ ] When we download a file, we may want to instruct nginx to not compress |
89 | 441 | the content. | the content. |
90 | [ ] When we defining rights, how can we distinguish between a logged in user | ||
442 | [ ] When we define rights, how can we distinguish between a logged in user | ||
91 | 443 | and one that is not logged in? | and one that is not logged in? |
92 | 444 | We want to allow bug adding only to logged in users (and maybe | We want to allow bug adding only to logged in users (and maybe |
93 | 445 | confirmed?). | confirmed?). |
... | ... | to add a worker? Also, no hint is presented. | |
1000 | 1352 | Maybe because I do not know the pushed refs? | Maybe because I do not know the pushed refs? |
1001 | 1353 | [ ] Now, also the web part can do the db update. | [ ] Now, also the web part can do the db update. |
1002 | 1354 | [ ] rg_repo_fetch_push_helper: if git repo is not created, delay the fetch/push? | [ ] rg_repo_fetch_push_helper: if git repo is not created, delay the fetch/push? |
1003 | [ ] target_ui => owner_ui? | ||
1004 | 1355 | [ ] Consolidate "welcome to rocketgit" messages! | [ ] Consolidate "welcome to rocketgit" messages! |
1005 | 1356 | [ ] when creating a vm, pass 'rng' device | [ ] when creating a vm, pass 'rng' device |
1006 | 1357 | [ ] Allow user to upload GPG keys ids and use them as an authentication | [ ] Allow user to upload GPG keys ids and use them as an authentication |
File compare.csv changed (mode: 100644) (index 878b8e5..2a697d6) | |||
1 | 1 | "[Legal]","RocketGit","Gitlab CE","GitHub","gitolite","Pagure.io","Gogs.io","Phabricator" | "[Legal]","RocketGit","Gitlab CE","GitHub","gitolite","Pagure.io","Gogs.io","Phabricator" |
2 | "License {Proprietary are bad. The ones allowing code to be made proprietary are not so good.}","Affero GPLv3+/#good","MIT/#agood","Proprietary/#bad","GPLv2/#good","GPLv2 or later/#good","MIT/#agood","Apache 2.0/#agood" | ||
2 | "License {Proprietary is bad. The ones allowing code to be made proprietary are not so good.}","Affero GPLv3+/#good","MIT/#agood","Proprietary/#bad","GPLv2/#good","GPLv2 or later/#good","MIT/#agood","Apache 2.0/#agood" | ||
3 | 3 | "Business model","Support and sponsors/#good","Open core/#bad","Monthly fee/#bad","n/a","n/a","n/a","?" | "Business model","Support and sponsors/#good","Open core/#bad","Monthly fee/#bad","n/a","n/a","n/a","?" |
4 | 4 | "Developers keep copyright when contributing {This is about contributing to the Git hosting project, not about projects hosted inside. Signing/agreeing a Contributor Licence Agreement (CLA) is very bad for free software.}","Yes","Yes?","n/a/#bad","Yes","Yes","Yes?","?" | "Developers keep copyright when contributing {This is about contributing to the Git hosting project, not about projects hosted inside. Signing/agreeing a Contributor Licence Agreement (CLA) is very bad for free software.}","Yes","Yes?","n/a/#bad","Yes","Yes","Yes?","?" |
5 | 5 | "GNU Ethical Repository Criteria Evaluations ([[link https://www.gnu.org/software/repo-criteria.html]])","A (-A4, +A+0, +A+1, +A+2, +A+5)/#good","C/#bad","F/#bad","?","A?/#good","?","?" | "GNU Ethical Repository Criteria Evaluations ([[link https://www.gnu.org/software/repo-criteria.html]])","A (-A4, +A+0, +A+1, +A+2, +A+5)/#good","C/#bad","F/#bad","?","A?/#good","?","?" |
54 | 54 | "Language","PHP","Ruby+Perl","Ruby","Perl","Python","Go","PHP" | "Language","PHP","Ruby+Perl","Ruby","Perl","Python","Go","PHP" |
55 | 55 | "Number of code lines {JavaScript not included}","38k","360k","?","?","80k","520k","?" | "Number of code lines {JavaScript not included}","38k","360k","?","?","80k","520k","?" |
56 | 56 | "Cache","Custom","Redis","memcache","n/a","Redis","Custom/Redis/memcache","?" | "Cache","Custom","Redis","memcache","n/a","Redis","Custom/Redis/memcache","?" |
57 | "Database","PostgreSQL","MySQL/PostgresSQL","MySQL","?","MySQL/MariaDB/PostgreSQL/SQLite","PostgreSQL/MySQL/SQLite","MySQL" | ||
57 | "Database","PostgreSQL","MySQL/PostgresSQL","MySQL","n/a","MySQL/MariaDB/PostgreSQL/SQLite","PostgreSQL/MySQL/SQLite","MySQL" | ||
58 | 58 | "Webserver","nginx/apache","apache/nginx","?","n/a","n/a","apache/nginx/lighttpd","apache/nginx" | "Webserver","nginx/apache","apache/nginx","?","n/a","n/a","apache/nginx/lighttpd","apache/nginx" |
59 | "Size of the rpm package","500KiB/#good","287MiB/#bad","?","170KiB/#good","?","?","?" | ||
59 | "Size of the rpm package","500KiB/#good","287MiB/#bad","n/a","170KiB/#good","?","?","?" | ||
60 | 60 | "Page speed: Mobile {Home page was tested}","100/#good","14/#bad","60/#bad","n/a","69/#bad","28/#bad","98/#good" | "Page speed: Mobile {Home page was tested}","100/#good","14/#bad","60/#bad","n/a","69/#bad","28/#bad","98/#good" |
61 | 61 | "Page speed: Desktop {Home page was tested}","100/#good","56/#bad","97/#good","n/a","86/#agood","82/#agood","99/#good" | "Page speed: Desktop {Home page was tested}","100/#good","56/#bad","97/#good","n/a","86/#agood","82/#agood","99/#good" |
62 | 62 | "CSS size","9KiB/#good","415KiB/#bad","770KiB/#bad","n/a","130KiB/#good","520KiB/#bad","95KiB/#good" | "CSS size","9KiB/#good","415KiB/#bad","770KiB/#bad","n/a","130KiB/#good","520KiB/#bad","95KiB/#good" |
65 | 65 | ,,,,,,, | ,,,,,,, |
66 | 66 | "[Notes]",,,,,,, | "[Notes]",,,,,,, |
67 | 67 | "*","1) It has a not standard package manager; upgrading distro does not update the git software (pip, gem etc.). Or is a big archive including packages already found in the distribution.",,,,,, | "*","1) It has a not standard package manager; upgrading distro does not update the git software (pip, gem etc.). Or is a big archive including packages already found in the distribution.",,,,,, |
68 | "*","2) Seems is not really secure: if key is leaking, the attacker can push?",,,,,, | ||
68 | "*","2) Seems is not really secure: if key is leaked, the attacker can push?",,,,,, |
File inc/admin.inc.php changed (mode: 100644) (index 053b9cb..1c1aaeb) | |||
1 | 1 | <?php | <?php |
2 | $INC = isset($INC) ? $INC : dirname(__FILE__); | ||
3 | require_once($INC . "/user.inc.php"); | ||
4 | require_once($INC . "/repo.inc.php"); | ||
5 | require_once($INC . "/workers.inc.php"); | ||
2 | require_once(__DIR__ . '/user.inc.php'); | ||
3 | require_once(__DIR__ . '/repo.inc.php'); | ||
4 | require_once(__DIR__ . '/workers.inc.php'); | ||
6 | 5 | ||
7 | 6 | /* | /* |
8 | 7 | * Event functions | * Event functions |
... | ... | function rg_admin_report1($db, $rg) | |
854 | 853 | $body .= 'Number of conns entries: ' . $conns['count'] . "\n"; | $body .= 'Number of conns entries: ' . $conns['count'] . "\n"; |
855 | 854 | unset($conns['count']); | unset($conns['count']); |
856 | 855 | ||
857 | $body .= 'Average elap: ' . $conns['avg_elap'] . 'ms' . "\n"; | ||
856 | $body .= 'Average elap: ' . $conns['avg_elap'] . 'ms' . "\n\n"; | ||
858 | 857 | unset($conns['avg_elap']); | unset($conns['avg_elap']); |
859 | 858 | ||
860 | 859 | //rg_log_ml('DEBUG: conns: ' . print_r($conns, TRUE)); | //rg_log_ml('DEBUG: conns: ' . print_r($conns, TRUE)); |
... | ... | function rg_admin_report1($db, $rg) | |
863 | 862 | foreach ($i as $k => $v) { | foreach ($i as $k => $v) { |
864 | 863 | if (strcmp($t, 'repo_id') == 0) { | if (strcmp($t, 'repo_id') == 0) { |
865 | 864 | $q = explode('/', $k); | $q = explode('/', $k); |
866 | $k = rg_repo_nice($db, $q[1]) . ' (user ' . rg_user_nice($db, $q[0]) . ')'; | ||
865 | $k = rg_repo_nice($db, $q[1]) . ' (' . rg_user_nice($db, $q[0]) . ')'; | ||
867 | 866 | } else if (strcmp($t, 'uid') == 0) { | } else if (strcmp($t, 'uid') == 0) { |
868 | 867 | $k = rg_user_nice($db, $k) . ' (' . $k . ')'; | $k = rg_user_nice($db, $k) . ' (' . $k . ')'; |
869 | 868 | } | } |
File inc/admin/admin.php changed (mode: 100644) (index d0e61dd..2879403) | |||
1 | 1 | <?php | <?php |
2 | 2 | rg_log("FILE: /inc/admin/admin"); | rg_log("FILE: /inc/admin/admin"); |
3 | 3 | ||
4 | $_admin = ""; | ||
4 | $_admin = ''; | ||
5 | 5 | ||
6 | 6 | if ($rg['login_ui']['is_admin'] != 1) { | if ($rg['login_ui']['is_admin'] != 1) { |
7 | 7 | $_admin .= rg_template("access_denied.html", $rg, TRUE /* xss */); | $_admin .= rg_template("access_denied.html", $rg, TRUE /* xss */); |
... | ... | case 'settings': | |
21 | 21 | break; | break; |
22 | 22 | ||
23 | 23 | case 'plans': | case 'plans': |
24 | include($INC . "/admin/plans/plans.php"); | ||
24 | include(__DIR__ . '/plans/plans.php'); | ||
25 | 25 | $_admin_body = $_admin_plans; | $_admin_body = $_admin_plans; |
26 | 26 | break; | break; |
27 | 27 | ||
28 | 28 | case 'users': // users | case 'users': // users |
29 | include($INC . "/admin/users/users.php"); | ||
29 | include(__DIR__ . '/users/users.php'); | ||
30 | 30 | $_admin_body = $_admin_users; | $_admin_body = $_admin_users; |
31 | 31 | break; | break; |
32 | 32 | ||
33 | 33 | case 'repos': | case 'repos': |
34 | include($INC . "/admin/repos/repos.php"); | ||
34 | include(__DIR__ . '/repos/repos.php'); | ||
35 | 35 | $_admin_body = $_admin_repos; | $_admin_body = $_admin_repos; |
36 | 36 | break; | break; |
37 | 37 | ||
... | ... | case 'workers': | |
44 | 44 | break; | break; |
45 | 45 | ||
46 | 46 | case 'mails': | case 'mails': |
47 | include($INC . '/admin/mails/mails.php'); | ||
47 | include(__DIR__ . '/mails/mails.php'); | ||
48 | 48 | $_admin_body = $_admin_mails; | $_admin_body = $_admin_mails; |
49 | 49 | break; | break; |
50 | 50 | ||
... | ... | default: | |
54 | 54 | } | } |
55 | 55 | $rg['url'] = $rg['url_up']; | $rg['url'] = $rg['url_up']; |
56 | 56 | ||
57 | $_admin .= rg_template("admin/menu.html", $rg, TRUE /* xss */); | ||
57 | $_admin .= rg_template("admin/menu.html", $rg, TRUE /*xss*/); | ||
58 | 58 | $_admin .= '<div class="generic_body">' . "\n"; | $_admin .= '<div class="generic_body">' . "\n"; |
59 | 59 | $_admin .= $_admin_body; | $_admin .= $_admin_body; |
60 | 60 | $_admin .= '</div>' . "\n"; | $_admin .= '</div>' . "\n"; |
File inc/admin/mails/mails.php changed (mode: 100644) (index 4daed6b..d92078d) | |||
1 | 1 | <?php | <?php |
2 | rg_log('FILE: /inc/admin/mails/mails'); | ||
3 | |||
4 | 2 | $_admin_mails = ''; | $_admin_mails = ''; |
5 | 3 | ||
6 | 4 | $_op = empty($paras) ? 'users' : array_shift($paras); | $_op = empty($paras) ? 'users' : array_shift($paras); |
File inc/admin/plans/plans.php changed (mode: 100644) (index 3a75234..58ece96) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/admin/plans/plans"); | ||
3 | |||
4 | $_admin_plans = ""; | ||
2 | $_admin_plans = ''; | ||
5 | 3 | ||
6 | 4 | $_op = empty($paras) ? "list" : array_shift($paras); | $_op = empty($paras) ? "list" : array_shift($paras); |
7 | 5 | rg_log("DEBUG: _op=$_op sparas=" . rg_array2string($paras)); | rg_log("DEBUG: _op=$_op sparas=" . rg_array2string($paras)); |
File inc/admin/repos/repos.php changed (mode: 100644) (index b9f83f1..bb12f71) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /admin/repos"); | ||
3 | |||
4 | $_admin_repos = ""; | ||
2 | $_admin_repos = ''; | ||
5 | 3 | ||
6 | 4 | $_op = empty($paras) ? "list" : array_shift($paras); | $_op = empty($paras) ? "list" : array_shift($paras); |
7 | 5 |
File inc/admin/users/users.php changed (mode: 100644) (index 45cf33a..7e27640) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/admin/users/users"); | ||
3 | |||
4 | $_admin_users = ""; | ||
2 | $_admin_users = ''; | ||
5 | 3 | ||
6 | 4 | $_op = empty($paras) ? "list" : array_shift($paras); | $_op = empty($paras) ? "list" : array_shift($paras); |
7 | 5 | $target = empty($paras) ? "" : array_shift($paras); | $target = empty($paras) ? "" : array_shift($paras); |
File inc/api.inc.php changed (mode: 100644) (index 60fac49..f3317d6) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/user.inc.php"); | ||
6 | require_once($INC . "/repo.inc.php"); | ||
7 | require_once($INC . "/bug.inc.php"); | ||
8 | require_once($INC . "/keys.inc.php"); | ||
9 | require_once($INC . "/prof.inc.php"); | ||
10 | require_once($INC . "/watch.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/user.inc.php'); | ||
6 | require_once(__DIR__ . '/repo.inc.php'); | ||
7 | require_once(__DIR__ . '/bug.inc.php'); | ||
8 | require_once(__DIR__ . '/keys.inc.php'); | ||
9 | require_once(__DIR__ . '/prof.inc.php'); | ||
10 | require_once(__DIR__ . '/watch.inc.php'); | ||
11 | 11 | ||
12 | 12 | /* | /* |
13 | 13 | * Main entry point | * Main entry point |
File inc/apikeys.inc.php changed (mode: 100644) (index a1b1fc9..c32c871) | |||
1 | 1 | <?php | <?php |
2 | 2 | // This files deals with keys used to call the API (over HTTPS) | // This files deals with keys used to call the API (over HTTPS) |
3 | require_once($INC . '/sql.inc.php'); | ||
4 | require_once($INC . '/state.inc.php'); | ||
5 | require_once($INC . '/prof.inc.php'); | ||
6 | require_once($INC . '/events.inc.php'); | ||
7 | require_once($INC . '/cache.inc.php'); | ||
3 | require_once(__DIR__ . '/sql.inc.php'); | ||
4 | require_once(__DIR__ . '/state.inc.php'); | ||
5 | require_once(__DIR__ . '/prof.inc.php'); | ||
6 | require_once(__DIR__ . '/events.inc.php'); | ||
7 | require_once(__DIR__ . '/cache.inc.php'); | ||
8 | 8 | ||
9 | 9 | $rg_ak_error = ''; | $rg_ak_error = ''; |
10 | 10 |
File inc/bug.inc.php changed (mode: 100644) (index 167696b..5aebf52) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/user.inc.php"); | ||
6 | require_once($INC . "/repo.inc.php"); | ||
7 | require_once($INC . "/prof.inc.php"); | ||
8 | require_once($INC . "/mail.inc.php"); | ||
9 | require_once($INC . "/events.inc.php"); | ||
10 | require_once($INC . "/watch.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/user.inc.php'); | ||
6 | require_once(__DIR__ . '/repo.inc.php'); | ||
7 | require_once(__DIR__ . '/prof.inc.php'); | ||
8 | require_once(__DIR__ . '/mail.inc.php'); | ||
9 | require_once(__DIR__ . '/events.inc.php'); | ||
10 | require_once(__DIR__ . '/watch.inc.php'); | ||
11 | 11 | ||
12 | 12 | $rg_bug_error = ""; | $rg_bug_error = ""; |
13 | 13 |
File inc/builder.inc.php changed (mode: 100644) (index a511694..865fa79) | |||
1 | 1 | <?php | <?php |
2 | $INC = isset($INC) ? $INC : dirname(__FILE__); | ||
3 | require_once($INC . '/repo.inc.php'); | ||
4 | require_once($INC . '/user.inc.php'); | ||
2 | require_once(__DIR__ . '/repo.inc.php'); | ||
3 | require_once(__DIR__ . '/user.inc.php'); | ||
5 | 4 | ||
6 | 5 | /* | /* |
7 | 6 | * Function to load job list | * Function to load job list |
... | ... | function rg_builder_add($db, $repo_id, $d) | |
68 | 67 | . ', @@request@@, @@done@@, @@status@@)'; | . ', @@request@@, @@done@@, @@status@@)'; |
69 | 68 | $res = rg_sql_query_params($db, $sql, $params); | $res = rg_sql_query_params($db, $sql, $params); |
70 | 69 | if ($res === FALSE) { | if ($res === FALSE) { |
71 | $ret['errmsg'] = 'cannot add job'; | ||
70 | $ret['errmsg'] = 'cannot add job in db: ' . rg_sql_error(); | ||
72 | 71 | break; | break; |
73 | 72 | } | } |
74 | 73 | rg_sql_free_result($res); | rg_sql_free_result($res); |
File inc/cache.inc.php changed (mode: 100644) (index c2b31cb..e2e4d75) | |||
2 | 2 | // | // |
3 | 3 | // memcache alike daemon | // memcache alike daemon |
4 | 4 | // | // |
5 | require_once($INC . "/util.inc.php"); | ||
6 | require_once($INC . "/prof.inc.php"); | ||
5 | require_once(__DIR__ . '/util.inc.php'); | ||
6 | require_once(__DIR__ . '/prof.inc.php'); | ||
7 | 7 | ||
8 | 8 | // Client side can disable the cache for various reasons (unit testing etc.) | // Client side can disable the cache for various reasons (unit testing etc.) |
9 | 9 | if (!isset($rg_cache_enable)) | if (!isset($rg_cache_enable)) |
... | ... | function rg_cache_send($cmd, $para, $flags) | |
374 | 374 | if ($rg_cache_enable === FALSE) | if ($rg_cache_enable === FALSE) |
375 | 375 | return FALSE; | return FALSE; |
376 | 376 | ||
377 | if ($rg_cache_recheck > time()) | ||
377 | if ($rg_cache_recheck > time()) { | ||
378 | if ($rg_cache_debug) | ||
379 | rg_log('recheck is still paused'); | ||
378 | 380 | return FALSE; | return FALSE; |
381 | } | ||
379 | 382 | ||
380 | 383 | $rg_cache_count++; | $rg_cache_count++; |
381 | 384 | ||
... | ... | function rg_cache_send($cmd, $para, $flags) | |
389 | 392 | $ret = rg_socket($rg_cache_socket, $xcmd . "\n", | $ret = rg_socket($rg_cache_socket, $xcmd . "\n", |
390 | 393 | $rg_cache_timeout, $rg_cache_tries, $flags); | $rg_cache_timeout, $rg_cache_tries, $flags); |
391 | 394 | if ($ret === FALSE) { | if ($ret === FALSE) { |
395 | if ($rg_cache_debug) | ||
396 | rg_log('Disabling cache check for 5s'); | ||
392 | 397 | $rg_cache_recheck = time() + 5; | $rg_cache_recheck = time() + 5; |
393 | 398 | return FALSE; | return FALSE; |
394 | 399 | } | } |
File inc/conn.inc.php changed (mode: 100644) (index aab86e8..0a75cda) | |||
1 | 1 | <?php | <?php |
2 | $INC = isset($INC) ? $INC : dirname(__FILE__); | ||
2 | // TODO: use 'shutdown_read'. | ||
3 | 3 | ||
4 | 4 | $rg_conns = array(); | $rg_conns = array(); |
5 | 5 | $rg_events = array('r' => array(), 'w' => array()); | $rg_events = array('r' => array(), 'w' => array()); |
... | ... | function rg_conn_prepare($s) | |
14 | 14 | ||
15 | 15 | /* | /* |
16 | 16 | * Shutts down a connection | * Shutts down a connection |
17 | * 0 = read, 1 = write, 2 = read+write | ||
17 | 18 | */ | */ |
18 | 19 | function rg_conn_shutdown($key, $what) | function rg_conn_shutdown($key, $what) |
19 | 20 | { | { |
... | ... | function rg_conn_destroy($key) | |
40 | 41 | if (!isset($rg_conns[$key])) | if (!isset($rg_conns[$key])) |
41 | 42 | rg_internal_error('key not defined!'); | rg_internal_error('key not defined!'); |
42 | 43 | ||
44 | rg_log($key . ': bytes_recv=' . $rg_conns[$key]['bytes_recv'] | ||
45 | . ' bytes_sent=' . $rg_conns[$key]['bytes_sent']); | ||
46 | |||
43 | 47 | if ($rg_conns[$key]['exit_on_close']) | if ($rg_conns[$key]['exit_on_close']) |
44 | 48 | exit(1); | exit(1); |
45 | 49 | ||
... | ... | function rg_conn_new($key, $socket) | |
78 | 82 | 'func_error' => 'rg_conn_func_error', | 'func_error' => 'rg_conn_func_error', |
79 | 83 | 'func_close' => 'rg_conn_func_close', | 'func_close' => 'rg_conn_func_close', |
80 | 84 | 'ip' => $ip, | 'ip' => $ip, |
81 | 'port' => $port | ||
85 | 'port' => $port, | ||
86 | 'shutdown_read' => 0, | ||
87 | 'shutdown_write' => 0, | ||
88 | 'bytes_sent' => 0, | ||
89 | 'bytes_recv' => 0 | ||
82 | 90 | ); | ); |
83 | 91 | ||
84 | 92 | $rg_events['r'][$key] = $socket; | $rg_events['r'][$key] = $socket; |
85 | 93 | socket_set_nonblock($socket); | socket_set_nonblock($socket); |
86 | 94 | ||
87 | 95 | if (strcmp($key, 'master') != 0) | if (strcmp($key, 'master') != 0) |
88 | rg_log($key . ': new connection from ' . $ip . '/' . $port); | ||
96 | rg_log($key . ': new connection from ' . $ip . '/' . $port . '.'); | ||
89 | 97 | } | } |
90 | 98 | ||
91 | 99 | /* | /* |
File inc/dispatch/dispatch.php changed (mode: 100644) (index 668ff16..394cbaf) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/dispatch/dispatch"); | ||
3 | |||
4 | 2 | $rg['menu'][$_op] = 1; | $rg['menu'][$_op] = 1; |
5 | 3 | ||
6 | 4 | $rg['url_up'] = $rg['url']; | $rg['url_up'] = $rg['url']; |
7 | 5 | $rg['url'] .= '/' . rawurlencode($_op); | $rg['url'] .= '/' . rawurlencode($_op); |
8 | 6 | switch ($_op) { | switch ($_op) { |
9 | 7 | case 'login': | case 'login': |
10 | include($INC . "/login/login.php"); | ||
8 | include(__DIR__ . '/../login/login.php'); | ||
11 | 9 | $body .= $_login; | $body .= $_login; |
12 | 10 | break; | break; |
13 | 11 | ||
... | ... | case 'logout': | |
34 | 32 | break; | break; |
35 | 33 | ||
36 | 34 | case 'repo': | case 'repo': |
37 | include($INC . "/repo/repo.php"); | ||
35 | include(__DIR__ . '/../repo/repo.php'); | ||
38 | 36 | $body .= $_repo; | $body .= $_repo; |
39 | 37 | break; | break; |
40 | 38 | ||
41 | 39 | case 'repopage': | case 'repopage': |
42 | include($INC . "/repo/repo_page.php"); | ||
40 | include(__DIR__ . '/../repo/repo_page.php'); | ||
43 | 41 | $body .= $_repo; | $body .= $_repo; |
44 | 42 | break; | break; |
45 | 43 | ||
46 | 44 | case 'admin': | case 'admin': |
47 | include($INC . "/admin/admin.php"); | ||
45 | include(__DIR__ . '/../admin/admin.php'); | ||
48 | 46 | $body .= $_admin; | $body .= $_admin; |
49 | 47 | break; | break; |
50 | 48 | ||
51 | 49 | case 'forgot_link': // forgot pass link | case 'forgot_link': // forgot pass link |
52 | include($INC . "/user/forgot.php"); | ||
50 | include(__DIR__ . '/../user/forgot.php'); | ||
53 | 51 | $body .= $_forgot; | $body .= $_forgot; |
54 | 52 | break; | break; |
55 | 53 | ||
56 | 54 | case 'forgot_send': // forgot pass - send mail | case 'forgot_send': // forgot pass - send mail |
57 | include($INC . "/user/forgot_send.php"); | ||
55 | include(__DIR__ . '/../user/forgot_send.php'); | ||
58 | 56 | $body .= $_forgot; | $body .= $_forgot; |
59 | 57 | break; | break; |
60 | 58 | ||
... | ... | case 'create_account': | |
65 | 63 | break; | break; |
66 | 64 | ||
67 | 65 | case 'confirm': | case 'confirm': |
68 | include($INC . "/user/confirm.php"); | ||
66 | include(__DIR__ . '/../user/confirm.php'); | ||
69 | 67 | $body .= $_confirm; | $body .= $_confirm; |
70 | 68 | break; | break; |
71 | 69 | ||
72 | 70 | case 'suggestion': | case 'suggestion': |
73 | include($INC . "/feedback/suggestion.php"); | ||
71 | include(__DIR__ . '/../feedback/suggestion.php'); | ||
74 | 72 | $body .= $_suggestion; | $body .= $_suggestion; |
75 | 73 | break; | break; |
76 | 74 | ||
77 | 75 | case 'settings': | case 'settings': |
78 | include($INC . "/user/settings.php"); | ||
76 | include(__DIR__ . '/../user/settings.php'); | ||
79 | 77 | $body .= $_settings; | $body .= $_settings; |
80 | 78 | break; | break; |
81 | 79 | ||
... | ... | case 'discover': | |
114 | 112 | break; | break; |
115 | 113 | ||
116 | 114 | case 'stats': | case 'stats': |
117 | include($INC . "/stats/stats.php"); | ||
115 | include(__DIR__ . '/../stats/stats.php'); | ||
118 | 116 | break; | break; |
119 | 117 | ||
120 | 118 | case 'doc': | case 'doc': |
... | ... | default: // can be the main page or user page or repo page | |
171 | 169 | if (!empty($user)) { | if (!empty($user)) { |
172 | 170 | rg_log("DEBUG: user=[$user] repo=[$repo]"); | rg_log("DEBUG: user=[$user] repo=[$repo]"); |
173 | 171 | if (empty($repo)) { | if (empty($repo)) { |
174 | include($INC . "/user/home-page.php"); | ||
172 | include(__DIR__ . '/../user/home-page.php'); | ||
175 | 173 | $body .= $_home; | $body .= $_home; |
176 | 174 | } else { | } else { |
177 | 175 | // TODO: destroy repo-page | // TODO: destroy repo-page |
178 | 176 | // TODO: repo-page: use $paras | // TODO: repo-page: use $paras |
179 | include($INC . "/user/repo-page.php"); | ||
177 | include(__DIR__ . '/../user/repo-page.php'); | ||
180 | 178 | $body .= $_repo_page; | $body .= $_repo_page; |
181 | 179 | } | } |
182 | 180 | } | } |
File inc/events.inc.php changed (mode: 100644) (index 0aceb6a..9b6e6fc) | |||
4 | 4 | // not wait to happen in the browser: e-mails, keyring regeneration etc. | // not wait to happen in the browser: e-mails, keyring regeneration etc. |
5 | 5 | // prio - lower = more important | // prio - lower = more important |
6 | 6 | // | // |
7 | require_once($INC . "/util.inc.php"); | ||
8 | require_once($INC . "/log.inc.php"); | ||
9 | require_once($INC . "/sql.inc.php"); | ||
10 | require_once($INC . "/state.inc.php"); | ||
11 | require_once($INC . "/prof.inc.php"); | ||
7 | require_once(__DIR__ . '/util2.inc.php'); | ||
8 | require_once(__DIR__ . '/log.inc.php'); | ||
9 | require_once(__DIR__ . '/sql.inc.php'); | ||
10 | require_once(__DIR__ . '/prof.inc.php'); | ||
12 | 11 | ||
13 | 12 | if (!isset($rg_event_socket)) | if (!isset($rg_event_socket)) |
14 | 13 | $rg_event_socket = "/var/lib/rocketgit/sockets/event.sock"; | $rg_event_socket = "/var/lib/rocketgit/sockets/event.sock"; |
... | ... | function rg_event_process($db, $ev_id, $event) | |
136 | 135 | ||
137 | 136 | $ret = FALSE; | $ret = FALSE; |
138 | 137 | $rollback = FALSE; | $rollback = FALSE; |
139 | while (1) { | ||
138 | do { | ||
140 | 139 | $category = $event['category']; | $category = $event['category']; |
141 | 140 | unset($event['category']); | unset($event['category']); |
142 | 141 | ||
... | ... | function rg_event_process($db, $ev_id, $event) | |
184 | 183 | $rollback = FALSE; | $rollback = FALSE; |
185 | 184 | ||
186 | 185 | $ret = TRUE; | $ret = TRUE; |
187 | break; | ||
188 | } | ||
186 | } while (0); | ||
189 | 187 | if ($rollback) | if ($rollback) |
190 | 188 | rg_sql_rollback($db); | rg_sql_rollback($db); |
191 | 189 | ||
... | ... | function rg_event_process_queue($db, &$notify_list) | |
255 | 253 | $params = array('id' => $row['id']); | $params = array('id' => $row['id']); |
256 | 254 | ||
257 | 255 | $sql = "UPDATE events SET fail = 1 WHERE id = @@id@@"; | $sql = "UPDATE events SET fail = 1 WHERE id = @@id@@"; |
258 | while (1) { | ||
256 | do { | ||
259 | 257 | $ev = rg_unserialize($row['data']); | $ev = rg_unserialize($row['data']); |
260 | 258 | if ($ev === FALSE) | if ($ev === FALSE) |
261 | 259 | break; | break; |
... | ... | function rg_event_process_queue($db, &$notify_list) | |
265 | 263 | ||
266 | 264 | $r = rg_event_process($db, $row['id'], $ev); | $r = rg_event_process($db, $row['id'], $ev); |
267 | 265 | if ($r !== TRUE) { | if ($r !== TRUE) { |
266 | // When we are in debug, we want faster retries. | ||
268 | 267 | if ($ev['debug'] == 1) | if ($ev['debug'] == 1) |
269 | 268 | break; | break; |
270 | 269 | ||
... | ... | function rg_event_process_queue($db, &$notify_list) | |
279 | 278 | rg_event_notify($notify_list, $ev['notification'], ""); | rg_event_notify($notify_list, $ev['notification'], ""); |
280 | 279 | ||
281 | 280 | $sql = "DELETE FROM events WHERE id = @@id@@"; | $sql = "DELETE FROM events WHERE id = @@id@@"; |
282 | break; | ||
283 | } | ||
281 | } while (0); | ||
284 | 282 | ||
285 | 283 | $res2 = rg_sql_query_params($db, $sql, $params); | $res2 = rg_sql_query_params($db, $sql, $params); |
286 | 284 | if ($res2 === FALSE) { | if ($res2 === FALSE) { |
File inc/feedback/suggestion.php changed (mode: 100644) (index 97a133e..ea08caf) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /feedback/suggestion"); | ||
3 | |||
4 | $_suggestion = ""; | ||
2 | $_suggestion = ''; | ||
5 | 3 | ||
6 | 4 | $errmsg = array(); | $errmsg = array(); |
7 | 5 |
File inc/fixes.inc.php changed (mode: 100644) (index 5a300e0..7ebf4c0) | |||
4 | 4 | // If the structure of authorized_keys may change, we must add a fix to | // If the structure of authorized_keys may change, we must add a fix to |
5 | 5 | // regenerate the keys. | // regenerate the keys. |
6 | 6 | // | // |
7 | include_once($INC . "/sql.inc.php"); | ||
8 | include_once($INC . "/state.inc.php"); | ||
9 | include_once($INC . "/util.inc.php"); | ||
10 | include_once($INC . "/user.inc.php"); | ||
11 | include_once($INC . "/repo.inc.php"); | ||
12 | include_once($INC . "/keys.inc.php"); | ||
7 | include_once(__DIR__ . '/sql.inc.php'); | ||
8 | include_once(__DIR__ . '/state.inc.php'); | ||
9 | include_once(__DIR__ . '/util2.inc.php'); | ||
10 | include_once(__DIR__ . '/user.inc.php'); | ||
11 | include_once(__DIR__ . '/repo.inc.php'); | ||
12 | include_once(__DIR__ . '/keys.inc.php'); | ||
13 | include_once(__DIR__ . '/user/pkg_subrepo.inc.php'); | ||
13 | 14 | ||
14 | 15 | $rg_fixes = array(); | $rg_fixes = array(); |
15 | 16 | $rg_fixes[1] = array( | $rg_fixes[1] = array( |
... | ... | function rg_fixes_update($db) | |
908 | 909 | } | } |
909 | 910 | ||
910 | 911 | // If we cannot lock, return error | // If we cannot lock, return error |
911 | if (rg_lock("fixes.lock") === FALSE) | ||
912 | if (rg_lock("fixes.lock", 0) === FALSE) | ||
912 | 913 | break; | break; |
913 | 914 | ||
914 | 915 | $r = rg_fixes_run($db, $old); | $r = rg_fixes_run($db, $old); |
File inc/git.inc.php changed (mode: 100644) (index 0272b3a..5a05fbd) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/prof.inc.php"); | ||
5 | require_once($INC . "/events.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/prof.inc.php'); | ||
5 | require_once(__DIR__ . '/events.inc.php'); | ||
6 | 6 | ||
7 | 7 | $rg_git_patch_limit_default = 5000; | $rg_git_patch_limit_default = 5000; |
8 | 8 | ||
9 | $rg_git_debug = 0; | ||
9 | if (!isset($rg_git_debug)) | ||
10 | $rg_git_debug = 0; | ||
10 | 11 | ||
11 | 12 | $rg_git_zero = "0000000000000000000000000000000000000000"; | $rg_git_zero = "0000000000000000000000000000000000000000"; |
12 | 13 | $rg_git_empty = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"; | $rg_git_empty = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"; |
... | ... | function rg_git_from_to($from, $to) | |
228 | 229 | global $rg_git_empty; | global $rg_git_empty; |
229 | 230 | ||
230 | 231 | if (empty($from) && empty($to)) { | if (empty($from) && empty($to)) { |
231 | rg_log('from/to empty'); | ||
232 | rg_log('DEBUG: from/to empty'); | ||
232 | 233 | $from_to = ''; | $from_to = ''; |
233 | 234 | } else if (empty($from)) { | } else if (empty($from)) { |
234 | rg_log('from empty'); | ||
235 | rg_log('DEBUG: from empty'); | ||
235 | 236 | $from_to = $to; | $from_to = $to; |
236 | 237 | } else if (strcmp($from, $rg_git_zero) == 0) { | } else if (strcmp($from, $rg_git_zero) == 0) { |
237 | rg_log('from zero'); | ||
238 | rg_log('DEBUG: from zero'); | ||
238 | 239 | $from_to = $rg_git_empty . '..' . $to; | $from_to = $rg_git_empty . '..' . $to; |
239 | 240 | } else if (empty($to)) { | } else if (empty($to)) { |
240 | rg_log('to empty'); | ||
241 | rg_log('DEBUG: to empty'); | ||
241 | 242 | $from_to = $from; | $from_to = $from; |
242 | 243 | } else { | } else { |
243 | 244 | $from_to = $from . '..' . $to; | $from_to = $from . '..' . $to; |
... | ... | function rg_git_log($repo_path, $max, $from, $to, $also_patch, $patch_limit) | |
1564 | 1565 | ||
1565 | 1566 | rg_prof_start('git_log'); | rg_prof_start('git_log'); |
1566 | 1567 | rg_log_enter('git_log: repo_path=' . $repo_path . ' from=' . $from | rg_log_enter('git_log: repo_path=' . $repo_path . ' from=' . $from |
1567 | . ' to=' . $to .' max=' . $max); | ||
1568 | . ' to=' . $to .' max=' . $max . ' also_patch=' . ($also_patch ? 'Y' : 'N')); | ||
1568 | 1569 | ||
1569 | 1570 | $ret = FALSE; | $ret = FALSE; |
1570 | 1571 | while (1) { | while (1) { |
1571 | 1572 | $good_files = array(); // = all | $good_files = array(); // = all |
1572 | 1573 | $stat = rg_git_log_simple($repo_path, $max, $from, $to, | $stat = rg_git_log_simple($repo_path, $max, $from, $to, |
1573 | 1574 | FALSE /*also_patch*/, $good_files, $patch_limit); | FALSE /*also_patch*/, $good_files, $patch_limit); |
1574 | if ($stat === FALSE) | ||
1575 | if ($stat === FALSE) { | ||
1576 | rg_log('DEBUG: git_log_simple returned FALSE'); | ||
1575 | 1577 | break; | break; |
1578 | } | ||
1576 | 1579 | ||
1577 | 1580 | // First, if 'also_path' is FALSE, we just call simple version | // First, if 'also_path' is FALSE, we just call simple version |
1578 | 1581 | // because we do not show a diff which should be filtered. | // because we do not show a diff which should be filtered. |
... | ... | function rg_git_log($repo_path, $max, $from, $to, $also_patch, $patch_limit) | |
1628 | 1631 | ||
1629 | 1632 | /* | /* |
1630 | 1633 | // TODO: now, seems ok, but we need a functinal test | // TODO: now, seems ok, but we need a functinal test |
1631 | // with more combinations: | ||
1634 | // with more combinations (B = Big, G = good): | ||
1632 | 1635 | // We have: GGBBBBG | // We have: GGBBBBG |
1633 | 1636 | // We need B...G...B and others | // We need B...G...B and others |
1634 | 1637 | */ | */ |
File inc/init.inc.php changed (mode: 100644) (index 54cc667..0467c9f) | |||
1 | 1 | <?php | <?php |
2 | 2 | // This is the first file that is included by all scripts. | // This is the first file that is included by all scripts. |
3 | 3 | ||
4 | require_once($INC . "/ver.php"); | ||
4 | require_once(__DIR__ . '/ver.php'); | ||
5 | 5 | ||
6 | 6 | $_dt = ini_get('date.timezone'); | $_dt = ini_get('date.timezone'); |
7 | 7 | if (empty($_dt)) | if (empty($_dt)) |
File inc/keys.inc.php changed (mode: 100644) (index 1229097..f0e1e78) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/sql.inc.php"); | ||
3 | require_once($INC . "/state.inc.php"); | ||
4 | require_once($INC . "/prof.inc.php"); | ||
5 | require_once($INC . "/mail.inc.php"); | ||
6 | require_once($INC . "/events.inc.php"); | ||
7 | require_once($INC . "/cache.inc.php"); | ||
2 | require_once(__DIR__ . '/sql.inc.php'); | ||
3 | require_once(__DIR__ . '/state.inc.php'); | ||
4 | require_once(__DIR__ . '/prof.inc.php'); | ||
5 | require_once(__DIR__ . '/mail.inc.php'); | ||
6 | require_once(__DIR__ . '/events.inc.php'); | ||
7 | require_once(__DIR__ . '/cache.inc.php'); | ||
8 | 8 | ||
9 | 9 | if (!isset($rg_max_ssh_keys)) | if (!isset($rg_max_ssh_keys)) |
10 | 10 | $rg_max_ssh_keys = 10; | $rg_max_ssh_keys = 10; |
File inc/ldap.inc.php changed (mode: 100644) (index b67e57d..a4d3122) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . '/sql.inc.php'); | ||
3 | require_once($INC . '/state.inc.php'); | ||
4 | require_once($INC . '/prof.inc.php'); | ||
5 | require_once($INC . '/cache.inc.php'); | ||
6 | require_once($INC . '/plan.inc.php'); | ||
7 | require_once($INC . '/ldap_core.inc.php'); | ||
8 | require_once($INC . '/ldap_sync.inc.php'); | ||
2 | require_once(__DIR__ . '/sql.inc.php'); | ||
3 | require_once(__DIR__ . '/state.inc.php'); | ||
4 | require_once(__DIR__ . '/prof.inc.php'); | ||
5 | require_once(__DIR__ . '/cache.inc.php'); | ||
6 | require_once(__DIR__ . '/plan.inc.php'); | ||
7 | require_once(__DIR__ . '/ldap_core.inc.php'); | ||
8 | require_once(__DIR__ . '/ldap_sync.inc.php'); | ||
9 | 9 | ||
10 | 10 | ||
11 | 11 | $rg_ldap_error = ''; | $rg_ldap_error = ''; |
File inc/ldap_core.inc.php changed (mode: 100644) (index ba34d06..4f32857) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/sql.inc.php"); | ||
3 | require_once($INC . "/state.inc.php"); | ||
4 | require_once($INC . "/prof.inc.php"); | ||
2 | require_once(__DIR__ . '/sql.inc.php'); | ||
3 | require_once(__DIR__ . '/state.inc.php'); | ||
4 | require_once(__DIR__ . '/prof.inc.php'); | ||
5 | 5 | ||
6 | 6 | $rg_ldap_core_error = ''; | $rg_ldap_core_error = ''; |
7 | 7 |
File inc/ldap_sync.inc.php changed (mode: 100644) (index 3c220f4..4c12b7d) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/sql.inc.php"); | ||
3 | require_once($INC . "/state.inc.php"); | ||
4 | require_once($INC . "/prof.inc.php"); | ||
5 | require_once($INC . "/ldap_core.inc.php"); | ||
2 | require_once(__DIR__ . '/sql.inc.php'); | ||
3 | require_once(__DIR__ . '/state.inc.php'); | ||
4 | require_once(__DIR__ . '/prof.inc.php'); | ||
5 | require_once(__DIR__ . '/ldap_core.inc.php'); | ||
6 | 6 | ||
7 | 7 | /* | /* |
8 | 8 | * Get data from cache | * Get data from cache |
File inc/log.inc.php changed (mode: 100644) (index d43100e..40465f3) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/cache.inc.php"); | ||
2 | require_once(__DIR__ . '/util.inc.php'); | ||
3 | require_once(__DIR__ . '/cache.inc.php'); | ||
4 | 4 | ||
5 | 5 | if (!isset($rg_log_dir)) | if (!isset($rg_log_dir)) |
6 | 6 | $rg_log_dir = "/var/log/rocketgit"; | $rg_log_dir = "/var/log/rocketgit"; |
... | ... | function rg_log_enter($a) | |
232 | 232 | $rg_log_level++; | $rg_log_level++; |
233 | 233 | } | } |
234 | 234 | ||
235 | function rg_log_ml_enter($a) | ||
235 | function rg_log_enter_ml($a) | ||
236 | 236 | { | { |
237 | 237 | global $rg_log_level; | global $rg_log_level; |
238 | 238 |
File inc/login/login.php changed (mode: 100644) (index d7ab5d6..c373394) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/login/login"); | ||
3 | |||
4 | 2 | $user = trim(rg_var_str('user')); | $user = trim(rg_var_str('user')); |
5 | 3 | $pass = trim(rg_var_str('pass')); | $pass = trim(rg_var_str('pass')); |
6 | 4 | $login_token = trim(rg_var_str('login_token')); | $login_token = trim(rg_var_str('login_token')); |
File inc/mail.inc.php changed (mode: 100644) (index 797f5a7..bdac111) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/prof.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/util.inc.php"); | ||
2 | require_once(__DIR__ . '/prof.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/util2.inc.php'); | ||
5 | 5 | ||
6 | 6 | ||
7 | 7 | $rg_mail_error = ""; | $rg_mail_error = ""; |
File inc/mr.inc.php changed (mode: 100644) (index 51482c8..915c636) | |||
1 | 1 | <?php | <?php |
2 | 2 | // Merge requests | // Merge requests |
3 | 3 | ||
4 | require_once($INC . "/util.inc.php"); | ||
5 | require_once($INC . "/sql.inc.php"); | ||
6 | require_once($INC . '/user.inc.php'); | ||
7 | require_once($INC . "/events.inc.php"); | ||
4 | require_once(__DIR__ . '/util2.inc.php'); | ||
5 | require_once(__DIR__ . '/sql.inc.php'); | ||
6 | require_once(__DIR__ . '/user.inc.php'); | ||
7 | require_once(__DIR__ . '/events.inc.php'); | ||
8 | 8 | ||
9 | 9 | $rg_mr_env_q = getenv("ROCKETGIT_MR_QUEUE"); | $rg_mr_env_q = getenv("ROCKETGIT_MR_QUEUE"); |
10 | 10 | if (empty($rg_mr_env_q)) | if (empty($rg_mr_env_q)) |
... | ... | function rg_mr_high_level($db, &$rg, $paras) | |
533 | 533 | ||
534 | 534 | $rg['HTML:commit_labels'] = ''; | $rg['HTML:commit_labels'] = ''; |
535 | 535 | $mri['HTML:body'] .= | $mri['HTML:body'] .= |
536 | rg_git_log2listing($_log, $rg, TRUE); | ||
536 | rg_git_log2listing($_log, $rg, TRUE /*commit_table*/); | ||
537 | 537 | ||
538 | 538 | if ($mri['can_merge_without_conflicts'] == 1) | if ($mri['can_merge_without_conflicts'] == 1) |
539 | 539 | $rg['rg_form_token'] = rg_token_get($db, $rg, 'mr_merge'); | $rg['rg_form_token'] = rg_token_get($db, $rg, 'mr_merge'); |
File inc/plan.inc.php changed (mode: 100644) (index b2cea78..585e964) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/events.inc.php"); | ||
6 | require_once($INC . "/cache.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/events.inc.php'); | ||
6 | require_once(__DIR__ . '/cache.inc.php'); | ||
7 | 7 | ||
8 | 8 | $rg_plan_error = ""; | $rg_plan_error = ""; |
9 | 9 | ||
... | ... | function rg_plan_list_high_level($db, $rg) | |
281 | 281 | $list = rg_plan_list($db); | $list = rg_plan_list($db); |
282 | 282 | if ($list === FALSE) { | if ($list === FALSE) { |
283 | 283 | $rg['errmsg'] = rg_plan_error(); | $rg['errmsg'] = rg_plan_error(); |
284 | // TODO: really? no array append?! | ||
285 | return rg_template('admin/plans/list_err.html', | ||
284 | $ret .= rg_template('admin/plans/list_err.html', | ||
286 | 285 | $rg, TRUE /*xss*/); | $rg, TRUE /*xss*/); |
287 | 286 | } else { | } else { |
288 | 287 | $rg['rg_form_token'] = rg_token_get($db, $rg, 'plan_list'); | $rg['rg_form_token'] = rg_token_get($db, $rg, 'plan_list'); |
File inc/repo.inc.php changed (mode: 100644) (index 8ddc4a8..d33b8f3) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/user.inc.php"); | ||
6 | require_once($INC . "/git.inc.php"); | ||
7 | require_once($INC . "/rights.inc.php"); | ||
8 | require_once($INC . "/prof.inc.php"); | ||
9 | require_once($INC . "/mail.inc.php"); | ||
10 | require_once($INC . "/events.inc.php"); | ||
11 | require_once($INC . "/webhooks.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/user.inc.php'); | ||
6 | require_once(__DIR__ . '/git.inc.php'); | ||
7 | require_once(__DIR__ . '/rights.inc.php'); | ||
8 | require_once(__DIR__ . '/prof.inc.php'); | ||
9 | require_once(__DIR__ . '/mail.inc.php'); | ||
10 | require_once(__DIR__ . '/events.inc.php'); | ||
11 | require_once(__DIR__ . '/webhooks.inc.php'); | ||
12 | 12 | ||
13 | 13 | $rg_repo_refs_rights = array( | $rg_repo_refs_rights = array( |
14 | 14 | "F" => "Fetch", | "F" => "Fetch", |
File inc/repo/repo.php changed (mode: 100644) (index 0143519..d714b52) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/repo/repo"); | ||
3 | |||
4 | 2 | // This page is shown when user press main menu "My repositories" | // This page is shown when user press main menu "My repositories" |
5 | 3 | ||
6 | 4 | $_repo = ''; | $_repo = ''; |
File inc/rights.inc.php changed (mode: 100644) (index 681ff0f..93e6173) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/user.inc.php"); | ||
6 | require_once($INC . "/git.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/user.inc.php'); | ||
6 | require_once(__DIR__ . '/git.inc.php'); | ||
7 | 7 | ||
8 | 8 | $rg_rights = array(); | $rg_rights = array(); |
9 | 9 | $rg_rights_default = array(); | $rg_rights_default = array(); |
File inc/sess.inc.php changed (mode: 100644) (index 00d60b0..2135023) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/log.inc.php"); | ||
3 | require_once($INC . "/sql.inc.php"); | ||
4 | require_once($INC . "/token.inc.php"); | ||
5 | require_once($INC . "/prof.inc.php"); | ||
2 | require_once(__DIR__ . '/log.inc.php'); | ||
3 | require_once(__DIR__ . '/sql.inc.php'); | ||
4 | require_once(__DIR__ . '/token.inc.php'); | ||
5 | require_once(__DIR__ . '/prof.inc.php'); | ||
6 | 6 | ||
7 | 7 | /* | /* |
8 | 8 | * Add a session | * Add a session |
File inc/sql.inc.php changed (mode: 100644) (index 0df57c1..3f47828) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/log.inc.php"); | ||
3 | require_once($INC . "/prof.inc.php"); | ||
2 | require_once(__DIR__ . '/log.inc.php'); | ||
3 | require_once(__DIR__ . '/prof.inc.php'); | ||
4 | 4 | ||
5 | 5 | // Some constants for sql error codes | // Some constants for sql error codes |
6 | 6 | define('RG_SQL_UNIQUE_VIOLATION', '23505'); | define('RG_SQL_UNIQUE_VIOLATION', '23505'); |
7 | define('RG_SQL_UNDEFINED_TABLE', '42P01'); | ||
7 | 8 | ||
8 | 9 | if (!function_exists("pg_connect")) | if (!function_exists("pg_connect")) |
9 | 10 | die("FATAL: php PostgreSQL is not installed!"); | die("FATAL: php PostgreSQL is not installed!"); |
... | ... | function rg_sql_query0($db, $sql, $r, $start_ts, $ignore, &$ignore_kicked) | |
190 | 191 | break; | break; |
191 | 192 | } | } |
192 | 193 | if (($state !== NULL) && (strcmp($state, '00000') !== 0)) { | if (($state !== NULL) && (strcmp($state, '00000') !== 0)) { |
194 | if ($rg_sql_debug > 0) | ||
195 | rg_log('DB: state=' . $state); | ||
196 | |||
193 | 197 | foreach ($ignore as $code) { | foreach ($ignore as $code) { |
194 | 198 | if (strcmp($code, $state) == 0) { | if (strcmp($code, $state) == 0) { |
195 | 199 | $ignore_kicked = TRUE; | $ignore_kicked = TRUE; |
... | ... | function rg_sql_query0($db, $sql, $r, $start_ts, $ignore, &$ignore_kicked) | |
209 | 213 | ||
210 | 214 | $diff = sprintf("%u", (microtime(TRUE) - $start_ts) * 1000); | $diff = sprintf("%u", (microtime(TRUE) - $start_ts) * 1000); |
211 | 215 | $rows = rg_sql_num_rows($res); | $rows = rg_sql_num_rows($res); |
212 | if ($rows == 0) | ||
213 | $arows = rg_sql_affected_rows($res); | ||
214 | else | ||
215 | $arows = 0; | ||
216 | $arows = rg_sql_affected_rows($res); | ||
216 | 217 | ||
217 | 218 | if ($rg_sql_debug > 0) | if ($rg_sql_debug > 0) |
218 | 219 | rg_log("DB: Took " . $diff . "ms, $rows row(s), $arows affected"); | rg_log("DB: Took " . $diff . "ms, $rows row(s), $arows affected"); |
... | ... | function rg_sql_query_params_ignore($h, $sql, $params, $ignore, &$ignore_kicked) | |
284 | 285 | if ($rg_sql_debug > 0) | if ($rg_sql_debug > 0) |
285 | 286 | rg_log_enter('sql_query_params: sql=[' . $sql . ']' | rg_log_enter('sql_query_params: sql=[' . $sql . ']' |
286 | 287 | . ' params=[' . rg_array2string($params) . ']' | . ' params=[' . rg_array2string($params) . ']' |
287 | . ' ignore=' . implode(',', $ignore)); | ||
288 | . (empty($ignore) ? '' : ' ignore=' . implode(',', $ignore))); | ||
288 | 289 | ||
289 | 290 | $ret = FALSE; | $ret = FALSE; |
290 | 291 | while (1) { | while (1) { |
File inc/ssh.inc.php changed (mode: 100644) (index 1d9ef66..41479d2) | |||
2 | 2 | // | // |
3 | 3 | // Description: This file deals with commands accepted by ssh | // Description: This file deals with commands accepted by ssh |
4 | 4 | // | // |
5 | require_once($INC . '/sql.inc.php'); | ||
6 | require_once($INC . '/state.inc.php'); | ||
7 | require_once($INC . '/prof.inc.php'); | ||
8 | require_once($INC . '/repo.inc.php'); | ||
9 | require_once($INC . '/totp.inc.php'); | ||
10 | require_once($INC . '/api.inc.php'); | ||
11 | require_once($INC . '/stats.inc.php'); | ||
5 | require_once(__DIR__ . '/sql.inc.php'); | ||
6 | require_once(__DIR__ . '/state.inc.php'); | ||
7 | require_once(__DIR__ . '/prof.inc.php'); | ||
8 | require_once(__DIR__ . '/repo.inc.php'); | ||
9 | require_once(__DIR__ . '/totp.inc.php'); | ||
10 | require_once(__DIR__ . '/api.inc.php'); | ||
11 | require_once(__DIR__ . '/stats.inc.php'); | ||
12 | 12 | ||
13 | 13 | $rg_ssh_error = ''; | $rg_ssh_error = ''; |
14 | 14 | function rg_ssh_set_error($str) | function rg_ssh_set_error($str) |
File inc/state.inc.php changed (mode: 100644) (index 7ec4254..f2a1c54) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/sql.inc.php"); | ||
3 | require_once($INC . "/cache.inc.php"); | ||
4 | require_once($INC . "/prof.inc.php"); | ||
2 | require_once(__DIR__ . '/sql.inc.php'); | ||
3 | require_once(__DIR__ . '/cache.inc.php'); | ||
4 | require_once(__DIR__ . '/prof.inc.php'); | ||
5 | 5 | ||
6 | 6 | $rg_state_error = ""; | $rg_state_error = ""; |
7 | 7 |
File inc/stats.inc.php changed (mode: 100644) (index 11c653d..50d8c0c) | |||
... | ... | function rg_stats_conns_set($para, $value) | |
157 | 157 | { | { |
158 | 158 | global $rg_stats_conns_paras; | global $rg_stats_conns_paras; |
159 | 159 | ||
160 | rg_log('DEBUG: stats_conns_set ' . $para . '=[' . $value . ']'); | ||
160 | //rg_log('DEBUG: stats_conns_set ' . $para . '=[' . $value . ']'); | ||
161 | 161 | $rg_stats_conns_paras[$para] = $value; | $rg_stats_conns_paras[$para] = $value; |
162 | 162 | } | } |
163 | 163 |
File inc/struct.inc.php changed (mode: 100644) (index b6dcc89..6de69af) | |||
1 | 1 | <?php | <?php |
2 | include_once($INC . "/sql.inc.php"); | ||
3 | include_once($INC . "/state.inc.php"); | ||
4 | include_once($INC . "/util.inc.php"); | ||
2 | include_once(__DIR__ . '/sql.inc.php'); | ||
3 | include_once(__DIR__ . '/util2.inc.php'); | ||
5 | 4 | ||
6 | 5 | define("RG_DROP_TABLES", 1); | define("RG_DROP_TABLES", 1); |
7 | 6 | define("RG_IGNORE_ERRORS", 1 << 1); | define("RG_IGNORE_ERRORS", 1 << 1); |
File inc/token.inc.php changed (mode: 100644) (index d9cbe98..fbfbaab) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/cache.inc.php"); | ||
6 | require_once($INC . "/prof.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/cache.inc.php'); | ||
6 | require_once(__DIR__ . '/prof.inc.php'); | ||
7 | 7 | ||
8 | 8 | $rg_token_error = ""; | $rg_token_error = ""; |
9 | 9 |
File inc/totp.inc.php changed (mode: 100644) (index 00dfbcf..d8f347a) | |||
1 | 1 | <?php | <?php |
2 | $INC = isset($INC) ? $INC : dirname(__FILE__); | ||
3 | require_once($INC . "/util.inc.php"); | ||
4 | require_once($INC . "/log.inc.php"); | ||
5 | require_once($INC . "/sql.inc.php"); | ||
6 | require_once($INC . "/events.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/events.inc.php'); | ||
7 | 6 | ||
8 | 7 | $rg_totp_error = ''; | $rg_totp_error = ''; |
9 | 8 |
File inc/user.inc.php changed (mode: 100644) (index 642dff9..f3f9098) | |||
1 | 1 | <?php | <?php |
2 | $INC = isset($INC) ? $INC : dirname(__FILE__); | ||
3 | require_once($INC . "/util.inc.php"); | ||
4 | require_once($INC . "/log.inc.php"); | ||
5 | require_once($INC . "/sql.inc.php"); | ||
6 | require_once($INC . "/sess.inc.php"); | ||
7 | require_once($INC . "/rights.inc.php"); | ||
8 | require_once($INC . "/events.inc.php"); | ||
9 | require_once($INC . "/cache.inc.php"); | ||
10 | require_once($INC . "/mail.inc.php"); | ||
11 | require_once($INC . "/plan.inc.php"); | ||
12 | require_once($INC . "/totp.inc.php"); | ||
13 | require_once($INC . '/stats.inc.php'); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/sess.inc.php'); | ||
6 | require_once(__DIR__ . '/rights.inc.php'); | ||
7 | require_once(__DIR__ . '/events.inc.php'); | ||
8 | require_once(__DIR__ . '/cache.inc.php'); | ||
9 | require_once(__DIR__ . '/mail.inc.php'); | ||
10 | require_once(__DIR__ . '/plan.inc.php'); | ||
11 | require_once(__DIR__ . '/totp.inc.php'); | ||
12 | require_once(__DIR__ . '/stats.inc.php'); | ||
14 | 13 | ||
15 | 14 | $rg_user_rights = array( | $rg_user_rights = array( |
16 | 15 | "C" => "Create repository", | "C" => "Create repository", |
... | ... | function rg_user_http_git($db, $rg, $paras) | |
2396 | 2395 | } | } |
2397 | 2396 | ||
2398 | 2397 | $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; | $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; |
2399 | // TODO: not clear if passing here login_ui is correct | ||
2398 | // TODO: not clear if passing here login_ui is correct I think it is. | ||
2400 | 2399 | $helper_flags = ''; | $helper_flags = ''; |
2401 | 2400 | $r = rg_repo_fetch_push_helper($db, $host, $rg['ip'], | $r = rg_repo_fetch_push_helper($db, $host, $rg['ip'], |
2402 | 2401 | $rg['login_ui'], $prefix, $user, $repo, $service, | $rg['login_ui'], $prefix, $user, $repo, $service, |
File inc/user/confirm.php changed (mode: 100644) (index defba4b..cd5aa05) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/confirm"); | ||
3 | |||
4 | 2 | $token = empty($paras) ? "" : array_shift($paras); | $token = empty($paras) ? "" : array_shift($paras); |
5 | 3 | ||
6 | 4 | $_confirm = ""; | $_confirm = ""; |
File inc/user/forgot.php changed (mode: 100644) (index c58d45b..c5d0b2e) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/forgot"); | ||
3 | |||
4 | 2 | $forgot_token = rg_var_str("forgot_token"); | $forgot_token = rg_var_str("forgot_token"); |
5 | 3 | if (empty($forgot_token)) { | if (empty($forgot_token)) { |
6 | 4 | $forgot_token = empty($paras) ? "" : array_shift($paras); | $forgot_token = empty($paras) ? "" : array_shift($paras); |
File inc/user/forgot_send.php changed (mode: 100644) (index f5884e4..d49768e) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/forgot_send"); | ||
3 | |||
4 | 2 | $email = rg_var_email('email'); | $email = rg_var_email('email'); |
5 | 3 | ||
6 | 4 | $_forgot = ""; | $_forgot = ""; |
File inc/user/home-page.php changed (mode: 100644) (index 8f05d4e..81ae897) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/home-page"); | ||
3 | |||
4 | 2 | $_home = ''; | $_home = ''; |
5 | 3 | ||
6 | 4 | $rg['page_ui'] = rg_user_info($db, 0, $user, ""); | $rg['page_ui'] = rg_user_info($db, 0, $user, ""); |
... | ... | if ($rg['page_ui']['uid'] == $rg['login_ui']['uid']) { | |
39 | 37 | } | } |
40 | 38 | ||
41 | 39 | $_home .= rg_template_table('hints/list', $hints, $rg); | $_home .= rg_template_table('hints/list', $hints, $rg); |
42 | ?> | ||
40 |
File inc/user/keys/keys.php changed (mode: 100644) (index f718e51..dd4e7f7) | |||
1 | 1 | <?php | <?php |
2 | rg_log('FILE: /inc/user/keys/keys'); | ||
3 | |||
4 | 2 | $_keys = ''; | $_keys = ''; |
5 | 3 | ||
6 | 4 | $add_errmsg = array(); | $add_errmsg = array(); |
... | ... | if ($rg_ssh_port != 0) | |
82 | 80 | $rg['HTML:hints'] = rg_template_table('hints/list', $hints, $rg); | $rg['HTML:hints'] = rg_template_table('hints/list', $hints, $rg); |
83 | 81 | ||
84 | 82 | $_keys .= rg_template('user/keys/main.html', $rg, TRUE /*xss*/); | $_keys .= rg_template('user/keys/main.html', $rg, TRUE /*xss*/); |
85 | ?> |
File inc/user/pass/pass.php changed (mode: 100644) (index 294f98d..75ced4b) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/pass/pass"); | ||
3 | |||
4 | 2 | $errmsg = array(); | $errmsg = array(); |
5 | 3 | ||
6 | 4 | $_pass = ""; | $_pass = ""; |
File inc/user/repo-page.php changed (mode: 100644) (index 78134e4..d4fd3cb) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/repo-page"); | ||
3 | |||
4 | $_repo_page = ""; | ||
2 | $_repo_page = ''; | ||
5 | 3 | ||
6 | 4 | if (rg_user_ok($user) !== TRUE) { | if (rg_user_ok($user) !== TRUE) { |
7 | 5 | $_repo_page .= rg_warning("Invalid user!"); | $_repo_page .= rg_warning("Invalid user!"); |
... | ... | function rg_repo_page_source($db, &$rg, &$paras) | |
262 | 260 | foreach ($list as $a) { | foreach ($list as $a) { |
263 | 261 | rg_log('DEBUG: a=[' . rg_array2string($a) . ']'); | rg_log('DEBUG: a=[' . rg_array2string($a) . ']'); |
264 | 262 | $type_ref = rg_git_parse_ref($a); | $type_ref = rg_git_parse_ref($a); |
263 | rg_log('DEBUG: type_ref: ' . rg_array2string($type_ref)); | ||
265 | 264 | if (rg_git_ref_valid($existing_refs, | if (rg_git_ref_valid($existing_refs, |
266 | 265 | $type_ref['ref_type'], $type_ref['ref_val']) === TRUE) { | $type_ref['ref_type'], $type_ref['ref_val']) === TRUE) { |
267 | 266 | $ref = $type_ref['ref_path']; | $ref = $type_ref['ref_path']; |
... | ... | function rg_repo_page_source($db, &$rg, &$paras) | |
269 | 268 | break; | break; |
270 | 269 | } | } |
271 | 270 | } | } |
272 | rg_log('DEBUG: paras XXX: ' . rg_array2string($paras)); | ||
273 | 271 | if ($ok) { | if ($ok) { |
274 | 272 | rg_log('DEBUG: ref=[' . $ref . ']'); | rg_log('DEBUG: ref=[' . $ref . ']'); |
275 | 273 | $rg = array_merge($rg, $type_ref); | $rg = array_merge($rg, $type_ref); |
... | ... | function rg_repo_page_source($db, &$rg, &$paras) | |
280 | 278 | ||
281 | 279 | rg_add_clone_hints($db, $rg, $ref); | rg_add_clone_hints($db, $rg, $ref); |
282 | 280 | ||
283 | $ret .= rg_template('repo/source.html', | ||
284 | $rg, TRUE /*xss*/); | ||
281 | $ret .= rg_template('repo/source.html', $rg, TRUE /*xss*/); | ||
285 | 282 | } | } |
286 | 283 | ||
287 | 284 | rg_log('DEBUG: _subsubop=[' . $_subsubop . ']'); | rg_log('DEBUG: _subsubop=[' . $_subsubop . ']'); |
... | ... | function rg_repo_page_source($db, &$rg, &$paras) | |
356 | 353 | $first = ''; | $first = ''; |
357 | 354 | $second = $commit; | $second = $commit; |
358 | 355 | } | } |
356 | rg_log('first=' . $first . ', second=' . $second); | ||
359 | 357 | ||
360 | 358 | $rg['HTML:commit_labels'] = rg_repo_commit_labels_html( | $rg['HTML:commit_labels'] = rg_repo_commit_labels_html( |
361 | 359 | $db, $rg['ri']['repo_id'], $commit); | $db, $rg['ri']['repo_id'], $commit); |
... | ... | function rg_repo_page_source($db, &$rg, &$paras) | |
363 | 361 | $patch_limit = rg_git_patch_limit($db); | $patch_limit = rg_git_patch_limit($db); |
364 | 362 | $log = rg_git_log($rg['repo_path'], 1, $first, $second, | $log = rg_git_log($rg['repo_path'], 1, $first, $second, |
365 | 363 | TRUE /*also_patch*/, $patch_limit); | TRUE /*also_patch*/, $patch_limit); |
366 | $ret .= rg_git_log2listing($log, $rg, FALSE); | ||
364 | $ret .= rg_git_log2listing($log, $rg, FALSE /*commit_table*/); | ||
367 | 365 | } | } |
368 | 366 | ||
369 | 367 | break; | break; |
... | ... | if (strcmp($_subop, "history") == 0) { | |
389 | 387 | } else if (strcmp($_subop, "source") == 0) { | } else if (strcmp($_subop, "source") == 0) { |
390 | 388 | $_repo_body .= rg_repo_page_source($db, $rg, $paras); | $_repo_body .= rg_repo_page_source($db, $rg, $paras); |
391 | 389 | } else if (strcmp($_subop, "bug") == 0) { | } else if (strcmp($_subop, "bug") == 0) { |
392 | include($INC . "/user/repo/bug/main.php"); | ||
390 | include(__DIR__ . '/repo/bug/main.php'); | ||
393 | 391 | $_repo_body .= $bug_body; | $_repo_body .= $bug_body; |
394 | 392 | } else if (strcmp($_subop, 'artifacts') == 0) { | } else if (strcmp($_subop, 'artifacts') == 0) { |
395 | include($INC . "/user/repo/artifacts/main.php"); | ||
393 | include(__DIR__ . '/repo/artifacts/main.php'); | ||
396 | 394 | $_repo_body .= $artifacts_body; | $_repo_body .= $artifacts_body; |
397 | 395 | } else if (strcmp($_subop, "stats") == 0) { | } else if (strcmp($_subop, "stats") == 0) { |
398 | 396 | $_repo_body .= rg_repo_stats($rg); | $_repo_body .= rg_repo_stats($rg); |
File inc/user/repo/artifacts/main.php changed (mode: 100644) (index bc2a682..81040ed) | |||
1 | 1 | <?php | <?php |
2 | rg_log('FILE: /inc/user/repo/artifacts/main'); | ||
3 | include_once($INC . '/artifacts.inc.php'); | ||
2 | include_once(__DIR__ . '/../../../artifacts.inc.php'); | ||
4 | 3 | ||
5 | 4 | $_artifacts_body = ''; | $_artifacts_body = ''; |
6 | 5 | ||
... | ... | $path = implode('/', $paras); | |
34 | 33 | ||
35 | 34 | switch ($_op) { | switch ($_op) { |
36 | 35 | //case 'search': | //case 'search': |
37 | // include($INC . '/user/repo/artifacts/search.php'); | ||
36 | // include(__DIR__ . '/search.php'); | ||
38 | 37 | // $_artifacts_body .= $_artifacts_search; | // $_artifacts_body .= $_artifacts_search; |
39 | 38 | // break; | // break; |
40 | 39 |
File inc/user/repo/bug/main.php changed (mode: 100644) (index 4949e64..5987060) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/repo/bug/main"); | ||
3 | |||
4 | $_bug_body = ""; | ||
2 | $_bug_body = ''; | ||
5 | 3 | ||
6 | 4 | $rg['can_save'] = $rg['login_ui']['uid'] > 0 ? 1 : 0; | $rg['can_save'] = $rg['login_ui']['uid'] > 0 ? 1 : 0; |
7 | 5 | ||
... | ... | $rg['HTML:menu_repo_level2'] = | |
26 | 24 | ||
27 | 25 | switch ($_op) { | switch ($_op) { |
28 | 26 | case 'search': | case 'search': |
29 | include($INC . "/user/repo/bug/search/search.php"); | ||
27 | include(__DIR__ . '/search/search.php'); | ||
30 | 28 | $_bug_body .= $_bug_search; | $_bug_body .= $_bug_search; |
31 | 29 | break; | break; |
32 | 30 | ||
... | ... | default: // show - go directly to a bug | |
101 | 99 | if ($bug_id > 0) { | if ($bug_id > 0) { |
102 | 100 | $rg['bug']['url'] = $rg['ri']['url_repo'] . '/bug/' | $rg['bug']['url'] = $rg['ri']['url_repo'] . '/bug/' |
103 | 101 | . $rg['bug']['bug_id']; | . $rg['bug']['bug_id']; |
104 | include($INC . "/user/repo/bug/show/show.php"); | ||
102 | include(__DIR__ . '/show/show.php'); | ||
105 | 103 | $_bug_body .= $_bug_show; | $_bug_body .= $_bug_show; |
106 | 104 | } | } |
107 | 105 | break; | break; |
File inc/user/repo/bug/search/search.php changed (mode: 100644) (index ceb8047..7366e2f) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/repo/bug/search/search"); | ||
3 | |||
4 | $_bug_search = ""; | ||
2 | $_bug_search = ''; | ||
5 | 3 | $errmsg = array(); | $errmsg = array(); |
6 | 4 | ||
7 | 5 | $_x = array(); | $_x = array(); |
File inc/user/repo/bug/show/add_note.php changed (mode: 100644) (index 4134fde..0c4d38a) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/repo/bug/show/add_note"); | ||
3 | |||
4 | 2 | $note_add_doit = rg_var_uint("note_add_doit"); | $note_add_doit = rg_var_uint("note_add_doit"); |
5 | 3 | ||
6 | 4 | $note = ""; | $note = ""; |
File inc/user/repo/bug/show/show.php changed (mode: 100644) (index 6b55358..21d1fcd) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/repo/bug/show/show"); | ||
3 | |||
4 | 2 | // TODO: security checks | // TODO: security checks |
5 | 3 | ||
6 | 4 | $_bug_show = ''; | $_bug_show = ''; |
... | ... | if (!empty($close_reopen_error)) | |
108 | 106 | ||
109 | 107 | // 'add_note' must be unconditionally included because we must insert the form | // 'add_note' must be unconditionally included because we must insert the form |
110 | 108 | if ($rg['allow_bug_add'] == 1) { | if ($rg['allow_bug_add'] == 1) { |
111 | include($INC . "/user/repo/bug/show/add_note.php"); | ||
109 | include(__DIR__ . '/add_note.php'); | ||
112 | 110 | } else { | } else { |
113 | 111 | $rg['HTML:note_add'] = ''; | $rg['HTML:note_add'] = ''; |
114 | 112 | } | } |
File inc/user/settings.php changed (mode: 100644) (index a61ee8a..a4cbfff) | |||
1 | 1 | <?php | <?php |
2 | rg_log("FILE: /inc/user/settings"); | ||
3 | |||
4 | 2 | $_settings = ''; | $_settings = ''; |
5 | 3 | ||
6 | 4 | if ($rg['login_ui']['uid'] == 0) { | if ($rg['login_ui']['uid'] == 0) { |
... | ... | $rg['url_up'] = $rg['url']; | |
20 | 18 | $rg['url'] .= '/' . rawurlencode($_subop); | $rg['url'] .= '/' . rawurlencode($_subop); |
21 | 19 | switch ($_subop) { | switch ($_subop) { |
22 | 20 | case 'change_pass': | case 'change_pass': |
23 | include($INC . "/user/pass/pass.php"); | ||
21 | include(__DIR__ . '/pass/pass.php'); | ||
24 | 22 | $_settings_body = $_pass; | $_settings_body = $_pass; |
25 | 23 | break; | break; |
26 | 24 | ||
27 | 25 | case 'keys': | case 'keys': |
28 | include($INC . "/user/keys/keys.php"); | ||
26 | include(__DIR__ . '/keys/keys.php'); | ||
29 | 27 | $_settings_body = $_keys; | $_settings_body = $_keys; |
30 | 28 | break; | break; |
31 | 29 | ||
... | ... | default: | |
58 | 56 | $rg['url'] = $rg['url_up']; | $rg['url'] = $rg['url_up']; |
59 | 57 | ||
60 | 58 | $rg['set_menu'][$_subop] = 1; | $rg['set_menu'][$_subop] = 1; |
61 | $_settings = rg_template("user/settings/menu.html", $rg, TRUE /* xss */); | ||
59 | $_settings = rg_template('user/settings/menu.html', $rg, TRUE /*xss*/); | ||
62 | 60 | $_settings .= '<div class="generic_body">' . "\n"; | $_settings .= '<div class="generic_body">' . "\n"; |
63 | 61 | $_settings .= $_settings_body; | $_settings .= $_settings_body; |
64 | 62 | $_settings .= '</div>' . "\n"; | $_settings .= '</div>' . "\n"; |
65 | ?> |
File inc/util.inc.php changed (mode: 100644) (index a78df36..6e2c018) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/prof.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
2 | require_once(__DIR__ . '/prof.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | 4 | ||
5 | 5 | set_error_handler("rg_error_handler"); | set_error_handler("rg_error_handler"); |
6 | 6 | register_shutdown_function("rg_error_shutdown"); | register_shutdown_function("rg_error_shutdown"); |
... | ... | function rg_template_string_if(&$s, $off, &$data, &$next, $xss_protection) | |
861 | 861 | $off += 5; /* skip '@@if(' */ | $off += 5; /* skip '@@if(' */ |
862 | 862 | $pos = strpos($s, ')', $off); | $pos = strpos($s, ')', $off); |
863 | 863 | if ($pos === FALSE) { | if ($pos === FALSE) { |
864 | rg_log("no closing ')' in [" . substr($s, $off) . "]!"); | ||
864 | rg_util_set_error('no closing \')\' in [' . substr($s, $off) . ']'); | ||
865 | 865 | rg_log_exit(); | rg_log_exit(); |
866 | 866 | rg_prof_end("template_string_if"); | rg_prof_end("template_string_if"); |
867 | 867 | return ''; | return ''; |
... | ... | function rg_template_string_if(&$s, $off, &$data, &$next, $xss_protection) | |
879 | 879 | $r = rg_template_find_true_and_false($s, $off, $true_start, $true_end, | $r = rg_template_find_true_and_false($s, $off, $true_start, $true_end, |
880 | 880 | $false_start, $false_end); | $false_start, $false_end); |
881 | 881 | if ($r == -1) { | if ($r == -1) { |
882 | rg_log("no if skeleton found [" . substr($s, $off) . "]!"); | ||
882 | rg_util_set_error('no if skeleton found [' . substr($s, $off) . ']'); | ||
883 | 883 | //rg_log_exit(); | //rg_log_exit(); |
884 | 884 | rg_prof_end("template_string_if"); | rg_prof_end("template_string_if"); |
885 | 885 | return -1; | return -1; |
... | ... | function rg_template_string(&$s, $off, &$data, $xss_protection) | |
942 | 942 | $r = rg_template_string_if($s, $off, $data, $next, | $r = rg_template_string_if($s, $off, $data, $next, |
943 | 943 | $xss_protection); | $xss_protection); |
944 | 944 | if ($r == -1) { | if ($r == -1) { |
945 | $ret .= 'Cannot evaluate condition: ' . rg_util_error(); | ||
945 | $ret .= 'Cannot evaluate condition: ' . rg_xss_safe(rg_util_error()); | ||
946 | 946 | break; | break; |
947 | 947 | } | } |
948 | 948 | $ret .= $r; | $ret .= $r; |
... | ... | function rg_template_errmsg($a) | |
1148 | 1148 | if (empty($a)) | if (empty($a)) |
1149 | 1149 | return ""; | return ""; |
1150 | 1150 | ||
1151 | rg_log('errmsg: ' . rg_array2string($a)); | ||
1152 | |||
1151 | 1153 | $b = array(); | $b = array(); |
1152 | 1154 | foreach ($a as $junk => $err) | foreach ($a as $junk => $err) |
1153 | 1155 | $b[] = array("error" => $err); | $b[] = array("error" => $err); |
... | ... | function rg_gzencode($c, &$orig_len, &$comp_len) | |
2724 | 2726 | $comp_len = strlen($ret); | $comp_len = strlen($ret); |
2725 | 2727 | rg_log('COMPRESSION: orig=' . $orig_len | rg_log('COMPRESSION: orig=' . $orig_len |
2726 | 2728 | . ' comp=' . $comp_len | . ' comp=' . $comp_len |
2727 | . ' ratio=' . sprintf('%.3f', $orig_len / $comp_len)); | ||
2729 | . ' ratio=' . sprintf('%.1f', $orig_len / $comp_len)); | ||
2728 | 2730 | ||
2729 | 2731 | rg_prof_end('gzencode'); | rg_prof_end('gzencode'); |
2730 | 2732 | return $ret; | return $ret; |
... | ... | function rg_load_files($dir, $pattern, $id_field) | |
3004 | 3006 | break; | break; |
3005 | 3007 | } | } |
3006 | 3008 | ||
3007 | return $ret; | ||
3009 | return $ret; | ||
3008 | 3010 | } | } |
3009 | 3011 | ||
3010 | 3012 | /* | /* |
... | ... | function rg_dir_size_helper($dir, &$icache) | |
3021 | 3023 | break; | break; |
3022 | 3024 | } | } |
3023 | 3025 | ||
3024 | $error = FALSE; | ||
3025 | while (($f = readdir($d)) !== FALSE) { | ||
3026 | if (strcmp($f, ".") == 0) | ||
3027 | continue; | ||
3026 | $error = FALSE; | ||
3027 | while (($f = readdir($d)) !== FALSE) { | ||
3028 | if (strcmp($f, ".") == 0) | ||
3029 | continue; | ||
3028 | 3030 | ||
3029 | if (strcmp($f, "..") == 0) | ||
3030 | continue; | ||
3031 | if (strcmp($f, "..") == 0) | ||
3032 | continue; | ||
3031 | 3033 | ||
3032 | 3034 | $s = @stat($dir . '/' . $f); | $s = @stat($dir . '/' . $f); |
3033 | 3035 | if ($s === FALSE) { | if ($s === FALSE) { |
... | ... | function rg_dir_size_helper($dir, &$icache) | |
3042 | 3044 | $error = TRUE; | $error = TRUE; |
3043 | 3045 | break; | break; |
3044 | 3046 | } | } |
3045 | } else if (($s['mode'] & 0100000) == 0100000) { // regular file | ||
3047 | } else if (($s['mode'] & 0100000) == 0100000) { // regular file | ||
3046 | 3048 | $k = $s['dev'] . '-' . $s['ino']; | $k = $s['dev'] . '-' . $s['ino']; |
3047 | 3049 | if (!isset($icache[$k])) | if (!isset($icache[$k])) |
3048 | 3050 | $icache[$k] = array( | $icache[$k] = array( |
File inc/ver.php.in changed (mode: 100644) (index 848a351..d5d09a1) | |||
4 | 4 | ||
5 | 5 | $rocketgit_version = "@VER@-@REV@"; | $rocketgit_version = "@VER@-@REV@"; |
6 | 6 | ||
7 | ?> |
File inc/watch.inc.php changed (mode: 100644) (index 1ade19d..e131cc7) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/user.inc.php"); | ||
6 | require_once($INC . "/prof.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/user.inc.php'); | ||
6 | require_once(__DIR__ . '/prof.inc.php'); | ||
7 | 7 | ||
8 | 8 | $rg_watch_error = ""; | $rg_watch_error = ""; |
9 | 9 |
File inc/webhooks.inc.php changed (mode: 100644) (index 33fef07..b0e2b1a) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/prof.inc.php"); | ||
6 | require_once($INC . "/wh/http.inc.php"); | ||
7 | require_once($INC . "/wh/cloud.inc.php"); | ||
8 | require_once($INC . "/wh/lambda.inc.php"); | ||
9 | require_once($INC . "/wh/build.inc.php"); | ||
2 | require_once(__DIR__ . '/util2.inc.php'); | ||
3 | require_once(__DIR__ . '/log.inc.php'); | ||
4 | require_once(__DIR__ . '/sql.inc.php'); | ||
5 | require_once(__DIR__ . '/prof.inc.php'); | ||
6 | require_once(__DIR__ . '/wh/http.inc.php'); | ||
7 | require_once(__DIR__ . '/wh/cloud.inc.php'); | ||
8 | require_once(__DIR__ . '/wh/lambda.inc.php'); | ||
9 | require_once(__DIR__ . '/wh/build.inc.php'); | ||
10 | 10 | ||
11 | 11 | $rg_wh_functions = array( | $rg_wh_functions = array( |
12 | 12 | 'wh_send' => 'rg_wh_send', | 'wh_send' => 'rg_wh_send', |
... | ... | rg_event_register_functions($rg_wh_functions); | |
15 | 15 | ||
16 | 16 | function rg_wh_send($db, $ev) | function rg_wh_send($db, $ev) |
17 | 17 | { | { |
18 | rg_log_ml('wh_send: ev: ' . print_r($ev, TRUE)); | ||
18 | rg_log_enter('wh_send'); | ||
19 | //rg_log_ml('DEBUG: ev: ' . print_r($ev, TRUE)); | ||
19 | 20 | ||
20 | 21 | $ret = array(); | $ret = array(); |
21 | 22 | ||
... | ... | function rg_wh_send($db, $ev) | |
38 | 39 | $ret[] = $x; | $ret[] = $x; |
39 | 40 | } | } |
40 | 41 | ||
42 | rg_log_exit(); | ||
41 | 43 | return $ret; | return $ret; |
42 | 44 | } | } |
43 | 45 |
File inc/wh/amazon.inc.php changed (mode: 100644) (index 17b2d6a..0c19f40) | |||
... | ... | function rg_amazon_auth($a) | |
7 | 7 | { | { |
8 | 8 | rg_prof_start('amazon_auth'); | rg_prof_start('amazon_auth'); |
9 | 9 | rg_log_enter('amazon_auth'); | rg_log_enter('amazon_auth'); |
10 | rg_log_ml('a: ' . print_r($a, TRUE)); | ||
10 | rg_log_ml('a: ' . rg_array2string($a)); | ||
11 | 11 | ||
12 | 12 | $ret = array('ok' => 0); | $ret = array('ok' => 0); |
13 | 13 | while (1) { | while (1) { |
... | ... | function rg_amazon_auth($a) | |
52 | 52 | $ret['query_string'], TRUE); | $ret['query_string'], TRUE); |
53 | 53 | rg_log('DEBUG: a[content] is not set'); | rg_log('DEBUG: a[content] is not set'); |
54 | 54 | } | } |
55 | rg_log_ml('DEBUG: a[iheaders]: ' . print_r($a['iheaders'], TRUE)); | ||
55 | rg_log_ml('DEBUG: a[iheaders]: ' . rg_array2string($a['iheaders'])); | ||
56 | 56 | ||
57 | 57 | $iheaders_final = array(); | $iheaders_final = array(); |
58 | 58 | $iheaders_list = array(); | $iheaders_list = array(); |
... | ... | function rg_amazon_auth($a) | |
129 | 129 | function rg_amazon_curl($url, $method, $headers, $data) | function rg_amazon_curl($url, $method, $headers, $data) |
130 | 130 | { | { |
131 | 131 | rg_log_ml('amazon_curl: data: START' . "\n" | rg_log_ml('amazon_curl: data: START' . "\n" |
132 | . print_r($data, TRUE) . "\n" . 'END'); | ||
132 | . rg_array2string($data) . "\n" . 'END'); | ||
133 | 133 | ||
134 | 134 | $ret = array('ok' => 0); | $ret = array('ok' => 0); |
135 | 135 | while (1) { | while (1) { |
... | ... | function rg_amazon_curl($url, $method, $headers, $data) | |
180 | 180 | $ret['errmsg'] = curl_error($c); | $ret['errmsg'] = curl_error($c); |
181 | 181 | ||
182 | 182 | $_info = curl_getinfo($c); | $_info = curl_getinfo($c); |
183 | rg_log_ml('Debug: ' . print_r($_info, TRUE)); | ||
183 | rg_log_ml('Debug: ' . rg_array2string($_info)); | ||
184 | 184 | break; | break; |
185 | 185 | } | } |
186 | 186 | ||
187 | 187 | $_info = curl_getinfo($c); | $_info = curl_getinfo($c); |
188 | rg_log_ml('Debug: ' . print_r($_info, TRUE)); | ||
188 | rg_log_ml('Debug: ' . rg_array2string($_info)); | ||
189 | 189 | ||
190 | 190 | if (($_info['http_code'] != 200) | if (($_info['http_code'] != 200) |
191 | 191 | && ($_info['http_code'] != 301)) { | && ($_info['http_code'] != 301)) { |
... | ... | function rg_amazon_req($a) | |
209 | 209 | { | { |
210 | 210 | rg_prof_start('amazon_req'); | rg_prof_start('amazon_req'); |
211 | 211 | rg_log_enter('amazon_req'); | rg_log_enter('amazon_req'); |
212 | rg_log_ml('DEBUG: a:' . print_r($a, TRUE)); | ||
212 | rg_log_ml('DEBUG: a:' . rg_array2string($a)); | ||
213 | 213 | ||
214 | 214 | $ret = array('ok' => 0); | $ret = array('ok' => 0); |
215 | 215 | while (1) { | while (1) { |
... | ... | function rg_amazon_req($a) | |
248 | 248 | $headers[] = 'Authorization: ' . $auth['data']; | $headers[] = 'Authorization: ' . $auth['data']; |
249 | 249 | foreach ($auth['iheaders'] as $head => $val) | foreach ($auth['iheaders'] as $head => $val) |
250 | 250 | $headers[] = $head . ': ' . $val; | $headers[] = $head . ': ' . $val; |
251 | rg_log_ml('DEBUG: HEADERS:' . print_r($headers, TRUE)); | ||
251 | rg_log_ml('DEBUG: HEADERS:' . rg_array2string($headers)); | ||
252 | 252 | ||
253 | 253 | $ret = rg_amazon_curl($url, $a['method'], $headers, | $ret = rg_amazon_curl($url, $a['method'], $headers, |
254 | 254 | $a['content']); | $a['content']); |
... | ... | function rg_amazon_s3_put_object($a, $content) | |
268 | 268 | { | { |
269 | 269 | rg_prof_start('amazon_s3_put_object'); | rg_prof_start('amazon_s3_put_object'); |
270 | 270 | rg_log_enter('amazon_s3_put_object'); | rg_log_enter('amazon_s3_put_object'); |
271 | rg_log_ml('a: ' . print_r($a, TRUE)); | ||
271 | rg_log_ml('a: ' . rg_array2string($a)); | ||
272 | 272 | ||
273 | 273 | $ret = array('ok' => 0); | $ret = array('ok' => 0); |
274 | 274 | while (1) { | while (1) { |
... | ... | function rg_amazon_s3_put_object($a, $content) | |
294 | 294 | function rg_amazon_codedeploy_create($a) | function rg_amazon_codedeploy_create($a) |
295 | 295 | { | { |
296 | 296 | rg_prof_start('amazon_codedeploy_create'); | rg_prof_start('amazon_codedeploy_create'); |
297 | rg_log_ml_enter('amazon_codedeploy_create'); | ||
297 | rg_log_enter_ml('amazon_codedeploy_create'); | ||
298 | 298 | ||
299 | 299 | if (empty($a['deployment_config_name'])) | if (empty($a['deployment_config_name'])) |
300 | 300 | $a['deployment_config_name'] = 'CodeDeployDefault.OneAtATime'; | $a['deployment_config_name'] = 'CodeDeployDefault.OneAtATime'; |
... | ... | function rg_amazon_codedeploy_create($a) | |
341 | 341 | function rg_amazon_lambda_invoke($a) | function rg_amazon_lambda_invoke($a) |
342 | 342 | { | { |
343 | 343 | rg_prof_start('amazon_lambda_invoke'); | rg_prof_start('amazon_lambda_invoke'); |
344 | rg_log_ml_enter('amazon_lambda_invoke'); | ||
344 | rg_log_enter_ml('amazon_lambda_invoke'); | ||
345 | 345 | ||
346 | 346 | if (!isset($a['invocation_type'])) | if (!isset($a['invocation_type'])) |
347 | 347 | $a['invocation_type'] = 'RequestResponse'; | $a['invocation_type'] = 'RequestResponse'; |
File inc/wh/build.inc.php changed (mode: 100644) (index d9ab16e..97c4dd8) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/prof.inc.php"); | ||
6 | require_once($INC . "/events.inc.php"); | ||
7 | require_once($INC . '/builder.inc.php'); | ||
8 | require_once($INC . "/wh/core.inc.php"); | ||
9 | |||
10 | $rg_wh_build_functions = array( | ||
2 | require_once(__DIR__ . '/../events.inc.php'); | ||
3 | require_once(__DIR__ . '/../builder.inc.php'); | ||
4 | require_once(__DIR__ . '/core.inc.php'); | ||
5 | require_once(__DIR__ . '/../user/pkg_map.inc.php'); | ||
6 | require_once(__DIR__ . '/../user/packages_rpm.inc.php'); | ||
7 | |||
8 | $_f = array( | ||
11 | 9 | 'wh_build_send' => 'rg_wh_build_send', | 'wh_build_send' => 'rg_wh_build_send', |
12 | 10 | 'wh_build_send_one' => 'rg_wh_build_send_one', | 'wh_build_send_one' => 'rg_wh_build_send_one', |
13 | 11 | 'wh_build_job_done' => 'rg_wh_build_job_done' | 'wh_build_job_done' => 'rg_wh_build_job_done' |
14 | 12 | ); | ); |
15 | rg_event_register_functions($rg_wh_build_functions); | ||
13 | rg_event_register_functions($_f); | ||
16 | 14 | ||
17 | 15 | ||
18 | 16 | /* | /* |
... | ... | function rg_wh_build_job_done($db, $ev) | |
65 | 63 | function rg_wh_build_send_one($db, $ev) | function rg_wh_build_send_one($db, $ev) |
66 | 64 | { | { |
67 | 65 | rg_prof_start('wh_build_send_one'); | rg_prof_start('wh_build_send_one'); |
68 | rg_log_ml('wh_build_send_one: event: ' . print_r($ev, TRUE)); | ||
66 | //rg_log_ml('DEBUG: wh_build_send_one: event: ' . rg_array2string($ev)); | ||
69 | 67 | ||
70 | 68 | $ret = FALSE; | $ret = FALSE; |
71 | |||
72 | 69 | $last_output = ''; | $last_output = ''; |
73 | 70 | while (1) { | while (1) { |
74 | 71 | // replace ##tags## | // replace ##tags## |
... | ... | function rg_wh_build_send_one($db, $ev) | |
117 | 114 | function rg_wh_build_send($db, $ev) | function rg_wh_build_send($db, $ev) |
118 | 115 | { | { |
119 | 116 | rg_prof_start('wh_build_send'); | rg_prof_start('wh_build_send'); |
120 | rg_log_ml('wh_build_send: event: ' . print_r($ev, TRUE)); | ||
117 | rg_log_ml('wh_build_send: event: ' . rg_array2string($ev)); | ||
121 | 118 | ||
122 | 119 | $ret = array(); | $ret = array(); |
123 | 120 | ||
... | ... | function rg_wh_build_send($db, $ev) | |
138 | 135 | // If the web hook does not contain our type, skip it | // If the web hook does not contain our type, skip it |
139 | 136 | if (!strchr($wh['idata']['events'], $ev['wh_event'])) { | if (!strchr($wh['idata']['events'], $ev['wh_event'])) { |
140 | 137 | rg_log('DEBUG: ' . $ev['wh_event'] | rg_log('DEBUG: ' . $ev['wh_event'] |
141 | . ' is not present in ' | ||
142 | . $wh['idata']['events']); | ||
138 | . ' is not present in [' | ||
139 | . $wh['idata']['events'] . ']'); | ||
143 | 140 | continue; | continue; |
144 | 141 | } | } |
145 | 142 | ||
... | ... | function rg_wh_build_cosmetic_post(&$row) | |
201 | 198 | $f = rg_template('user/settings/wh/build/env_show_one.html', | $f = rg_template('user/settings/wh/build/env_show_one.html', |
202 | 199 | $rg, TRUE/*xss*/); | $rg, TRUE/*xss*/); |
203 | 200 | $list = ''; | $list = ''; |
204 | //rg_log_ml('DEBUG: envs: ' . print_r($row['idata']['envs'], TRUE)); | ||
201 | //rg_log_ml('DEBUG: envs: ' . rg_array2string($row['idata']['envs'])); | ||
205 | 202 | foreach ($row['idata']['envs'] as $env => $junk) { | foreach ($row['idata']['envs'] as $env => $junk) { |
206 | 203 | $list .= str_replace('##env##', $env, $f); | $list .= str_replace('##env##', $env, $f); |
207 | 204 | } | } |
... | ... | function rg_wh_build_fill_vars(&$rg) | |
244 | 241 | ||
245 | 242 | $a['envs'] = array(); | $a['envs'] = array(); |
246 | 243 | $envs = rg_var_str('wh::idata::envs'); | $envs = rg_var_str('wh::idata::envs'); |
247 | //rg_log_ml('envs: ' . print_r($envs, TRUE)); | ||
244 | //rg_log_ml('DEBUG: envs: ' . rg_array2string($envs)); | ||
248 | 245 | foreach ($envs as $env => $on) | foreach ($envs as $env => $on) |
249 | 246 | $a['envs'][$env] = strcasecmp($on, 'on') == 0 ? 1 : 0; | $a['envs'][$env] = strcasecmp($on, 'on') == 0 ? 1 : 0; |
250 | 247 | ||
... | ... | function rg_wh_build_fill_vars(&$rg) | |
257 | 254 | ||
258 | 255 | $rg['wh']['idata'] = $a; | $rg['wh']['idata'] = $a; |
259 | 256 | ||
260 | //rg_log_ml('DEBUG: after fill_vars: ' . print_r($a, TRUE)); | ||
257 | //rg_log_ml('DEBUG: after fill_vars: ' . rg_array2string($a)); | ||
261 | 258 | } | } |
262 | 259 | ||
263 | 260 | /* | /* |
... | ... | function rg_wh_build_validate_vars($rg, &$errmsg) | |
273 | 270 | while (1) { | while (1) { |
274 | 271 | $all_empty = TRUE; | $all_empty = TRUE; |
275 | 272 | ||
276 | //rg_log_ml('DEBUG: cmds:' . print_r($a['idata']['cmds'], TRUE)); | ||
273 | //rg_log_ml('DEBUG: cmds:' . rg_array2string($a['idata']['cmds'])); | ||
277 | 274 | if (empty($a['idata']['cmds'])) { | if (empty($a['idata']['cmds'])) { |
278 | 275 | $errmsg[] = rg_template('user/settings/wh/build/inv_cmd.txt', | $errmsg[] = rg_template('user/settings/wh/build/inv_cmd.txt', |
279 | 276 | $rg, TRUE /*xss*/); | $rg, TRUE /*xss*/); |
280 | 277 | break; | break; |
281 | 278 | } | } |
282 | 279 | ||
283 | //rg_log_ml('DEBUG: envs:' . print_r($a['idata']['envs'], TRUE)); | ||
280 | //rg_log_ml('DEBUG: envs:' . rg_array2string($a['idata']['envs'])); | ||
284 | 281 | if (empty($a['idata']['envs'])) { | if (empty($a['idata']['envs'])) { |
285 | 282 | $errmsg[] = rg_template('user/settings/wh/build/inv_env.txt', | $errmsg[] = rg_template('user/settings/wh/build/inv_env.txt', |
286 | 283 | $rg, TRUE /*xss*/); | $rg, TRUE /*xss*/); |
... | ... | function rg_wh_build_add_form_post($db, &$rg) | |
347 | 344 | $rg['HTML:envs'] = | $rg['HTML:envs'] = |
348 | 345 | rg_template_string($_s, 0 /*off*/, $rg, TRUE /*xss*/); | rg_template_string($_s, 0 /*off*/, $rg, TRUE /*xss*/); |
349 | 346 | ||
350 | //rg_log_ml('DEBUG:rg: ' . print_r($rg, TRUE)); | ||
347 | //rg_log_ml('DEBUG:rg: ' . rg_array2string($rg)); | ||
351 | 348 | ||
352 | 349 | $rg['HTML:custom_form'] = rg_template('user/settings/wh/build/form.html', | $rg['HTML:custom_form'] = rg_template('user/settings/wh/build/form.html', |
353 | 350 | $rg, TRUE /*xss*/); | $rg, TRUE /*xss*/); |
File inc/wh/cloud.inc.php changed (mode: 100644) (index 3d2eb99..32cbc4f) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/prof.inc.php"); | ||
6 | require_once($INC . "/events.inc.php"); | ||
7 | require_once($INC . "/wh/core.inc.php"); | ||
8 | require_once($INC . "/wh/amazon.inc.php"); | ||
2 | require_once(__DIR__ . '/../events.inc.php'); | ||
3 | require_once(__DIR__ . '/core.inc.php'); | ||
4 | require_once(__DIR__ . '/amazon.inc.php'); | ||
9 | 5 | ||
10 | 6 | $rg_wh_cloud_functions = array( | $rg_wh_cloud_functions = array( |
11 | 7 | 'wh_cloud_send' => 'rg_wh_cloud_send', | 'wh_cloud_send' => 'rg_wh_cloud_send', |
... | ... | rg_event_register_functions($rg_wh_cloud_functions); | |
21 | 17 | function rg_wh_cloud_send_one($db, $ev) | function rg_wh_cloud_send_one($db, $ev) |
22 | 18 | { | { |
23 | 19 | rg_prof_start('wh_cloud_send_one'); | rg_prof_start('wh_cloud_send_one'); |
24 | rg_log_ml('wh_cloud_send_one: event: ' . print_r($ev, TRUE)); | ||
20 | rg_log_ml('wh_cloud_send_one: event: ' . rg_array2string($ev)); | ||
25 | 21 | ||
26 | 22 | $ret = FALSE; | $ret = FALSE; |
27 | 23 | ||
... | ... | function rg_wh_cloud_send_one($db, $ev) | |
98 | 94 | function rg_wh_cloud_send($db, $ev) | function rg_wh_cloud_send($db, $ev) |
99 | 95 | { | { |
100 | 96 | rg_prof_start('wh_cloud_send'); | rg_prof_start('wh_cloud_send'); |
101 | rg_log_ml('wh_cloud_send: event: ' . print_r($ev, TRUE)); | ||
97 | rg_log_ml('wh_cloud_send: event: ' . rg_array2string($ev)); | ||
102 | 98 | ||
103 | 99 | $ret = array(); | $ret = array(); |
104 | 100 | ||
... | ... | function rg_wh_cloud_send($db, $ev) | |
120 | 116 | // If the web hook does not contain our type, skip it | // If the web hook does not contain our type, skip it |
121 | 117 | if (!strchr($wh['idata']['events'], $ev['wh_event'])) { | if (!strchr($wh['idata']['events'], $ev['wh_event'])) { |
122 | 118 | rg_log('DEBUG: ' . $ev['wh_event'] | rg_log('DEBUG: ' . $ev['wh_event'] |
123 | . ' is not present in ' | ||
124 | . $wh['idata']['events']); | ||
119 | . ' is not present in [' | ||
120 | . $wh['idata']['events'] . ']'); | ||
125 | 121 | continue; | continue; |
126 | 122 | } | } |
127 | 123 |
File inc/wh/core.inc.php changed (mode: 100644) (index aaffa9e..0aa85b5) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/prof.inc.php"); | ||
2 | require_once(__DIR__ . '/../util2.inc.php'); | ||
3 | require_once(__DIR__ . '/../log.inc.php'); | ||
4 | require_once(__DIR__ . '/../sql.inc.php'); | ||
5 | require_once(__DIR__ . '/../prof.inc.php'); | ||
6 | 6 | ||
7 | 7 | $rg_wh_error = ""; | $rg_wh_error = ""; |
8 | 8 | ||
... | ... | function rg_wh_list($db, $uid) | |
238 | 238 | $r = rg_cache_get($key); | $r = rg_cache_get($key); |
239 | 239 | if (($r !== FALSE) && isset($r['LIST_LOADED'])) { | if (($r !== FALSE) && isset($r['LIST_LOADED'])) { |
240 | 240 | $ret['list'] = $r['list']; | $ret['list'] = $r['list']; |
241 | //rg_log_ml('list: ' . print_r($ret['list'], TRUE)); | ||
241 | //rg_log_ml('list: ' . rg_array2string($ret['list'])); | ||
242 | 242 | $ret['ok'] = 1; | $ret['ok'] = 1; |
243 | 243 | break; | break; |
244 | 244 | } | } |
... | ... | function rg_wh_list($db, $uid) | |
254 | 254 | } | } |
255 | 255 | ||
256 | 256 | while (($row = rg_sql_fetch_array($res))) { | while (($row = rg_sql_fetch_array($res))) { |
257 | //rg_log_ml('DEBUG: wh_list: row: ' . print_r($row, TRUE)); | ||
257 | //rg_log_ml('DEBUG: wh_list: row: ' . rg_array2string($row)); | ||
258 | 258 | $id = $row['id']; | $id = $row['id']; |
259 | 259 | if (!empty($row['idata'])) { | if (!empty($row['idata'])) { |
260 | 260 | $row['idata'] = rg_unserialize($row['idata']); | $row['idata'] = rg_unserialize($row['idata']); |
... | ... | function rg_wh_validate_vars($rg, &$errmsg) | |
451 | 451 | global $rg_wh_flags; | global $rg_wh_flags; |
452 | 452 | global $rg_wh_plugins; | global $rg_wh_plugins; |
453 | 453 | ||
454 | rg_log_ml('wh_validate_vars: wh: ' . print_r($rg['wh'], TRUE)); | ||
454 | rg_log_ml('wh_validate_vars: wh: ' . rg_array2string($rg['wh'])); | ||
455 | 455 | ||
456 | 456 | $ret = FALSE; | $ret = FALSE; |
457 | 457 | while (1) { | while (1) { |
... | ... | function rg_wh_add_form($db, &$rg) | |
533 | 533 | } | } |
534 | 534 | ||
535 | 535 | rg_log_ml('DEBUG: AFTER wh_add_form: wh[idata]: ' | rg_log_ml('DEBUG: AFTER wh_add_form: wh[idata]: ' |
536 | . print_r($rg['wh']['idata'], TRUE)); | ||
536 | . rg_array2string($rg['wh']['idata'])); | ||
537 | 537 | } | } |
538 | 538 | ||
539 | 539 | /* | /* |
... | ... | function rg_wh_valid($htype) | |
630 | 630 | */ | */ |
631 | 631 | function rg_wh_replace_tags(&$ev) | function rg_wh_replace_tags(&$ev) |
632 | 632 | { | { |
633 | //rg_log_ml('wh_replace_tags: ev=' . print_r($ev, TRUE)); | ||
633 | //rg_log_ml('wh_replace_tags: ev=' . rg_array2string($ev)); | ||
634 | 634 | ||
635 | 635 | $branch = isset($ev['refname']) ? rg_repo_ref_nice($ev['refname']) : ''; | $branch = isset($ev['refname']) ? rg_repo_ref_nice($ev['refname']) : ''; |
636 | 636 | //rg_log('DEBUG: branch=' . $branch); | //rg_log('DEBUG: branch=' . $branch); |
... | ... | function rg_wh_replace_tags(&$ev) | |
663 | 663 | && (strcasecmp($ev['wh']['idata']['content_type'], 'application/json') == 0)) | && (strcasecmp($ev['wh']['idata']['content_type'], 'application/json') == 0)) |
664 | 664 | $ev['wh']['idata']['custom_body'] = @json_encode($ev['wh']['idata']['custom_body']); | $ev['wh']['idata']['custom_body'] = @json_encode($ev['wh']['idata']['custom_body']); |
665 | 665 | ||
666 | //rg_log_ml('after: ' . print_r($ev['wh']['idata'], TRUE)); | ||
666 | //rg_log_ml('after: ' . rg_array2string($ev['wh']['idata'])); | ||
667 | 667 | } | } |
668 | 668 | ||
669 | 669 | /* | /* |
... | ... | function rg_wh_call_callback($type, $subtype, $cb, &$xret, &$para1, &$para2) | |
742 | 742 | break; | break; |
743 | 743 | ||
744 | 744 | $pt = $rg_wh_plugins[$type]; | $pt = $rg_wh_plugins[$type]; |
745 | //rg_log_ml('DEBUG: pt: ' . print_r($pt, TRUE)); | ||
745 | //rg_log_ml('DEBUG: pt: ' . rg_array2string($pt)); | ||
746 | 746 | if (isset($pt['cb'][$cb])) { | if (isset($pt['cb'][$cb])) { |
747 | 747 | rg_log('DEBUG: calling type callback ' . $cb); | rg_log('DEBUG: calling type callback ' . $cb); |
748 | 748 | $xret = $pt['cb'][$cb]($para1, $para2); | $xret = $pt['cb'][$cb]($para1, $para2); |
... | ... | function rg_wh_call_callback($type, $subtype, $cb, &$xret, &$para1, &$para2) | |
752 | 752 | } | } |
753 | 753 | ||
754 | 754 | $si = rg_wh_find_subtype($type, $subtype); | $si = rg_wh_find_subtype($type, $subtype); |
755 | //rg_log_ml('DEBUG: si: ' . print_r($si, TRUE)); | ||
755 | //rg_log_ml('DEBUG: si: ' . rg_array2string($si)); | ||
756 | 756 | if ($si === FALSE) | if ($si === FALSE) |
757 | 757 | break; | break; |
758 | 758 |
File inc/wh/http.inc.php changed (mode: 100644) (index dd95842..2464f5e) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/prof.inc.php"); | ||
6 | require_once($INC . "/events.inc.php"); | ||
7 | require_once($INC . "/wh/core.inc.php"); | ||
2 | require_once(__DIR__ . '/../events.inc.php'); | ||
3 | require_once(__DIR__ . '/core.inc.php'); | ||
8 | 4 | ||
9 | 5 | $rg_wh_http_functions = array( | $rg_wh_http_functions = array( |
10 | 6 | 'wh_http_send' => 'rg_wh_http_send', | 'wh_http_send' => 'rg_wh_http_send', |
... | ... | function rg_wh_http_send_helper($db, &$ev) | |
28 | 24 | ||
29 | 25 | if ($ev['debug'] == 1) | if ($ev['debug'] == 1) |
30 | 26 | rg_log_ml('wh_http_send_one: event[wh][idata]: ' | rg_log_ml('wh_http_send_one: event[wh][idata]: ' |
31 | . print_r($ev['wh']['idata'], TRUE)); | ||
27 | . rg_array2string($ev['wh']['idata'])); | ||
32 | 28 | ||
33 | 29 | $headers = array(); | $headers = array(); |
34 | 30 | if (!empty($ev['wh']['idata']['key']) && ($ev['wh']['idata']['itype'] != 0)) | if (!empty($ev['wh']['idata']['key']) && ($ev['wh']['idata']['itype'] != 0)) |
... | ... | function rg_wh_http_send_helper($db, &$ev) | |
127 | 123 | break; | break; |
128 | 124 | } | } |
129 | 125 | ||
130 | rg_log_ml('DEBUG: Answer: ' . print_r($r, TRUE)); | ||
126 | rg_log_ml('DEBUG: Answer: ' . rg_array2string($r)); | ||
131 | 127 | $xerr .= $r; | $xerr .= $r; |
132 | 128 | ||
133 | 129 | $debug_value = 'OK'; | $debug_value = 'OK'; |
... | ... | function rg_wh_http_send($db, $ev) | |
183 | 179 | { | { |
184 | 180 | rg_prof_start('wh_http_send'); | rg_prof_start('wh_http_send'); |
185 | 181 | ||
186 | //rg_log_ml('wh_http_send: event: ' . print_r($ev, TRUE)); | ||
182 | //rg_log_ml('wh_http_send: event: ' . rg_array2string($ev)); | ||
187 | 183 | ||
188 | 184 | // First, get the list of hooks | // First, get the list of hooks |
189 | 185 | $r = rg_wh_list($db, $ev['ui']['uid']); | $r = rg_wh_list($db, $ev['ui']['uid']); |
... | ... | function rg_wh_http_send($db, $ev) | |
206 | 202 | // If the web hook does not contain our type, skip it | // If the web hook does not contain our type, skip it |
207 | 203 | if (!strchr($wh['idata']['events'], $ev['wh_event'])) { | if (!strchr($wh['idata']['events'], $ev['wh_event'])) { |
208 | 204 | rg_log('DEBUG: ' . $ev['wh_event'] | rg_log('DEBUG: ' . $ev['wh_event'] |
209 | . ' is not present in ' | ||
210 | . $wh['idata']['events']); | ||
205 | . ' is not present in [' | ||
206 | . $wh['idata']['events'] . ']'); | ||
211 | 207 | continue; | continue; |
212 | 208 | } | } |
213 | 209 | ||
... | ... | function rg_wh_http_fill_vars(&$rg) | |
352 | 348 | ||
353 | 349 | $rg['wh']['idata'] = $a; | $rg['wh']['idata'] = $a; |
354 | 350 | ||
355 | //rg_log_ml('DEBUG: AFTTER wh_http_fill_vars: ' . print_r($a, TRUE)); | ||
351 | //rg_log_ml('DEBUG: AFTTER wh_http_fill_vars: ' . rg_array2string($a)); | ||
356 | 352 | } | } |
357 | 353 | ||
358 | 354 | /* | /* |
File inc/wh/http/matrix.inc.php changed (mode: 100644) (index 3ee2091..9d2504f) | |||
... | ... | function rg_wh_matrix_fill_vars(&$rg, &$junk) | |
14 | 14 | ||
15 | 15 | function rg_wh_matrix_send($db, $ev) | function rg_wh_matrix_send($db, $ev) |
16 | 16 | { | { |
17 | rg_log_ml('DEBUG: wh_matrix_send: ev: ' . print_r($ev, TRUE)); | ||
17 | rg_log_enter('rg_wh_matrix_send'); | ||
18 | //rg_log_ml('DEBUG: wh_matrix_send: ev: ' . rg_array2string($ev)); | ||
18 | 19 | ||
19 | 20 | $ret = FALSE; | $ret = FALSE; |
20 | 21 | while (1) { | while (1) { |
... | ... | function rg_wh_matrix_send($db, $ev) | |
41 | 42 | ||
42 | 43 | rg_wh_http_send_helper($db, $ev1); | rg_wh_http_send_helper($db, $ev1); |
43 | 44 | // TODO: what to do with the error code? | // TODO: what to do with the error code? |
44 | rg_log_ml('DEBUG: helper returned: ' . print_r($ev1['wh'], TRUE)); | ||
45 | rg_log_ml('DEBUG: helper returned: ' . rg_array2string($ev1['wh'])); | ||
45 | 46 | $j = @json_decode($ev1['wh']['out']['body'], TRUE); | $j = @json_decode($ev1['wh']['out']['body'], TRUE); |
46 | rg_log_ml('DEBUG: JSON: ' . print_r($j, TRUE)); | ||
47 | rg_log_ml('DEBUG: JSON: ' . rg_array2string($j)); | ||
47 | 48 | if ($j === NULL) { | if ($j === NULL) { |
48 | 49 | rg_log('DEBUG: cannot decode json; what to do? TODO'); | rg_log('DEBUG: cannot decode json; what to do? TODO'); |
49 | 50 | break; | break; |
... | ... | function rg_wh_matrix_send($db, $ev) | |
61 | 62 | ||
62 | 63 | // join | // join |
63 | 64 | // https://matrix.org/docs/spec/client_server/r0.2.0#id157 | // https://matrix.org/docs/spec/client_server/r0.2.0#id157 |
64 | rg_log_ml('DEBUG: now, joining room: ' . print_r($ev, TRUE)); | ||
65 | rg_log_ml('DEBUG: now, joining room: ' . rg_array2string($ev)); | ||
65 | 66 | $ev2 = $ev; | $ev2 = $ev; |
66 | 67 | $ev2['wh']['idata']['url'] .= '/_matrix/client/r0/join/' | $ev2['wh']['idata']['url'] .= '/_matrix/client/r0/join/' |
67 | 68 | . rawurlencode($ev2['wh']['idata']['room']) | . rawurlencode($ev2['wh']['idata']['room']) |
... | ... | function rg_wh_matrix_send($db, $ev) | |
70 | 71 | $ev2['wh']['idata']['final'] = json_encode($b); | $ev2['wh']['idata']['final'] = json_encode($b); |
71 | 72 | ||
72 | 73 | rg_wh_http_send_helper($db, $ev2); | rg_wh_http_send_helper($db, $ev2); |
73 | rg_log_ml('DEBUG: helper returned: ' . print_r($ev2['wh']['out'], TRUE)); | ||
74 | rg_log_ml('DEBUG: helper returned: ' . rg_array2string($ev2['wh']['out'])); | ||
74 | 75 | ||
75 | 76 | ||
76 | 77 | // message | // message |
77 | 78 | // https://matrix.org/docs/spec/client_server/latest#id320 | // https://matrix.org/docs/spec/client_server/latest#id320 |
78 | rg_log_ml('DEBUG: now, sending the message ev: ' . print_r($ev, TRUE)); | ||
79 | rg_log_ml('DEBUG: now, sending the message ev: ' . rg_array2string($ev)); | ||
79 | 80 | $ev2 = $ev; | $ev2 = $ev; |
80 | 81 | $ev2['wh']['idata']['url'] .= '/_matrix/client/r0/rooms/' | $ev2['wh']['idata']['url'] .= '/_matrix/client/r0/rooms/' |
81 | 82 | . rawurlencode($ev2['wh']['idata']['room']) | . rawurlencode($ev2['wh']['idata']['room']) |
... | ... | function rg_wh_matrix_send($db, $ev) | |
87 | 88 | $ev2['wh']['idata']['final'] = json_encode($b); | $ev2['wh']['idata']['final'] = json_encode($b); |
88 | 89 | ||
89 | 90 | rg_wh_http_send_helper($db, $ev2); | rg_wh_http_send_helper($db, $ev2); |
90 | rg_log_ml('DEBUG: helper returned: ' . print_r($ev2['wh']['out'], TRUE)); | ||
91 | rg_log_ml('DEBUG: helper returned: ' . rg_array2string($ev2['wh']['out'])); | ||
91 | 92 | // TODO: what to do with the error code? | // TODO: what to do with the error code? |
92 | rg_log_ml('DEBUG: helper returned: ' . print_r($ev2['wh'], TRUE)); | ||
93 | rg_log_ml('DEBUG: helper returned: ' . rg_array2string($ev2['wh'])); | ||
93 | 94 | $j = @json_decode($ev2['wh']['out']['body'], TRUE); | $j = @json_decode($ev2['wh']['out']['body'], TRUE); |
94 | rg_log_ml('DEBUG: JSON: ' . print_r($j, TRUE)); | ||
95 | rg_log_ml('DEBUG: JSON: ' . rg_array2string($j)); | ||
95 | 96 | if ($j === NULL) { | if ($j === NULL) { |
96 | 97 | rg_log('DEBUG: cannot decode json; what to do? TODO'); | rg_log('DEBUG: cannot decode json; what to do? TODO'); |
97 | 98 | break; | break; |
... | ... | function rg_wh_matrix_send($db, $ev) | |
105 | 106 | break; | break; |
106 | 107 | } | } |
107 | 108 | ||
109 | rg_log_exit(); | ||
108 | 110 | return array(); | return array(); |
109 | 111 | } | } |
110 | 112 | ||
111 | 113 | function rg_wh_matrix_add_form_pre($db, &$rg) | function rg_wh_matrix_add_form_pre($db, &$rg) |
112 | 114 | { | { |
113 | 115 | $a = $rg['wh']['idata']; | $a = $rg['wh']['idata']; |
114 | rg_log_ml('DEBUG: wh_matrix_add_form_pre: ' . print_r($a, TRUE)); | ||
116 | rg_log_ml('DEBUG: wh_matrix_add_form_pre: ' . rg_array2string($a)); | ||
115 | 117 | ||
116 | 118 | if (!isset($rg['wh']['description'])) | if (!isset($rg['wh']['description'])) |
117 | 119 | $rg['wh']['description'] = 'Matrix.org integration'; | $rg['wh']['description'] = 'Matrix.org integration'; |
File inc/wh/lambda.inc.php changed (mode: 100644) (index ca8d3fc..ba71f85) | |||
1 | 1 | <?php | <?php |
2 | require_once($INC . "/util.inc.php"); | ||
3 | require_once($INC . "/log.inc.php"); | ||
4 | require_once($INC . "/sql.inc.php"); | ||
5 | require_once($INC . "/prof.inc.php"); | ||
6 | require_once($INC . "/events.inc.php"); | ||
7 | require_once($INC . "/wh/core.inc.php"); | ||
8 | require_once($INC . "/wh/amazon.inc.php"); | ||
2 | require_once(__DIR__ . '/../events.inc.php'); | ||
3 | require_once(__DIR__ . '/core.inc.php'); | ||
4 | require_once(__DIR__ . '/amazon.inc.php'); | ||
9 | 5 | ||
10 | 6 | $rg_wh_lambda_functions = array( | $rg_wh_lambda_functions = array( |
11 | 7 | 'wh_lambda_send' => 'rg_wh_lambda_send', | 'wh_lambda_send' => 'rg_wh_lambda_send', |
... | ... | rg_event_register_functions($rg_wh_lambda_functions); | |
20 | 16 | function rg_wh_lambda_send_one($db, $ev) | function rg_wh_lambda_send_one($db, $ev) |
21 | 17 | { | { |
22 | 18 | rg_prof_start('wh_lambda_send_one'); | rg_prof_start('wh_lambda_send_one'); |
23 | rg_log_ml('wh_lambda_send_one: event: ' . print_r($ev, TRUE)); | ||
19 | rg_log_ml('wh_lambda_send_one: event: ' . rg_array2string($ev)); | ||
24 | 20 | ||
25 | 21 | $ret = FALSE; | $ret = FALSE; |
26 | 22 | ||
... | ... | function rg_wh_lambda_send_one($db, $ev) | |
64 | 60 | function rg_wh_lambda_send($db, $ev) | function rg_wh_lambda_send($db, $ev) |
65 | 61 | { | { |
66 | 62 | rg_prof_start('wh_lambda_send'); | rg_prof_start('wh_lambda_send'); |
67 | rg_log_ml('wh_lambda_send: event: ' . print_r($ev, TRUE)); | ||
63 | rg_log_ml('wh_lambda_send: event: ' . rg_array2string($ev)); | ||
68 | 64 | ||
69 | 65 | $ret = array(); | $ret = array(); |
70 | 66 | ||
... | ... | function rg_wh_lambda_send($db, $ev) | |
85 | 81 | // If the web hook does not contain our type, skip it | // If the web hook does not contain our type, skip it |
86 | 82 | if (!strchr($wh['idata']['events'], $ev['wh_event'])) { | if (!strchr($wh['idata']['events'], $ev['wh_event'])) { |
87 | 83 | rg_log('DEBUG: ' . $ev['wh_event'] | rg_log('DEBUG: ' . $ev['wh_event'] |
88 | . ' is not present in ' | ||
89 | . $wh['idata']['events']); | ||
84 | . ' is not present in [' | ||
85 | . $wh['idata']['events'] . ']'); | ||
90 | 86 | continue; | continue; |
91 | 87 | } | } |
92 | 88 |
File inc/workers.inc.php changed (mode: 100644) (index 0d5e5a2..15f0811) | |||
1 | 1 | <?php | <?php |
2 | $INC = isset($INC) ? $INC : dirname(__FILE__); | ||
3 | require_once($INC . '/events.inc.php'); | ||
4 | require_once($INC . '/builder.inc.php'); | ||
5 | require_once($INC . '/keys.inc.php'); | ||
6 | require_once($INC . '/graph.inc.php'); | ||
2 | require_once(__DIR__ . '/events.inc.php'); | ||
3 | require_once(__DIR__ . '/builder.inc.php'); | ||
4 | require_once(__DIR__ . '/keys.inc.php'); | ||
5 | require_once(__DIR__ . '/graph.inc.php'); | ||
7 | 6 | ||
8 | 7 | $rg_worker_error = ''; | $rg_worker_error = ''; |
9 | 8 |
File root/index.php changed (mode: 100644) (index 9e40479..3f72bd8) | |||
1 | 1 | <?php | <?php |
2 | 2 | error_reporting(E_ALL); | error_reporting(E_ALL); |
3 | ini_set("track_errors", "On"); | ||
3 | ini_set('track_errors', 'On'); | ||
4 | 4 | set_time_limit(30); | set_time_limit(30); |
5 | 5 | ||
6 | 6 | $peak0 = memory_get_peak_usage(); | $peak0 = memory_get_peak_usage(); |
... | ... | $peak0 = memory_get_peak_usage(); | |
8 | 8 | $rg = array(); | $rg = array(); |
9 | 9 | $rg['start'] = microtime(TRUE); | $rg['start'] = microtime(TRUE); |
10 | 10 | ||
11 | require_once("/etc/rocketgit/config.php"); | ||
12 | $INC = dirname(__FILE__) . "/../inc"; | ||
13 | require_once($INC . "/init.inc.php"); | ||
14 | require_once($INC . "/log.inc.php"); | ||
15 | include_once($INC . "/sql.inc.php"); | ||
16 | include_once($INC . "/struct.inc.php"); | ||
17 | include_once($INC . "/user.inc.php"); | ||
18 | include_once($INC . "/repo.inc.php"); | ||
19 | include_once($INC . "/keys.inc.php"); | ||
20 | include_once($INC . "/token.inc.php"); | ||
21 | include_once($INC . "/prof.inc.php"); | ||
22 | include_once($INC . "/mr.inc.php"); | ||
23 | include_once($INC . "/bug.inc.php"); | ||
24 | include_once($INC . "/fixes.inc.php"); | ||
25 | include_once($INC . "/plan.inc.php"); | ||
26 | include_once($INC . "/admin.inc.php"); | ||
27 | include_once($INC . "/api.inc.php"); | ||
28 | include_once($INC . "/apikeys.inc.php"); | ||
29 | include_once($INC . "/demo.inc.php"); | ||
30 | include_once($INC . "/ver.php"); | ||
31 | include_once($INC . "/ldap.inc.php"); | ||
32 | include_once($INC . "/ssh.inc.php"); | ||
33 | include_once($INC . "/stats.inc.php"); | ||
34 | include_once($INC . '/ratelimit.inc.php'); | ||
35 | |||
36 | rg_prof_start("MAIN"); | ||
37 | |||
38 | rg_log_set_file($rg_log_dir . "/web.log"); | ||
11 | require_once('/etc/rocketgit/config.php'); | ||
12 | require_once(__DIR__ . '/../inc/init.inc.php'); | ||
13 | require_once(__DIR__ . '/../inc/log.inc.php'); | ||
14 | include_once(__DIR__ . '/../inc/sql.inc.php'); | ||
15 | include_once(__DIR__ . '/../inc/struct.inc.php'); | ||
16 | include_once(__DIR__ . '/../inc/user.inc.php'); | ||
17 | include_once(__DIR__ . '/../inc/repo.inc.php'); | ||
18 | include_once(__DIR__ . '/../inc/keys.inc.php'); | ||
19 | include_once(__DIR__ . '/../inc/token.inc.php'); | ||
20 | include_once(__DIR__ . '/../inc/prof.inc.php'); | ||
21 | include_once(__DIR__ . '/../inc/mr.inc.php'); | ||
22 | include_once(__DIR__ . '/../inc/bug.inc.php'); | ||
23 | include_once(__DIR__ . '/../inc/fixes.inc.php'); | ||
24 | include_once(__DIR__ . '/../inc/plan.inc.php'); | ||
25 | include_once(__DIR__ . '/../inc/admin.inc.php'); | ||
26 | include_once(__DIR__ . '/../inc/api.inc.php'); | ||
27 | include_once(__DIR__ . '/../inc/apikeys.inc.php'); | ||
28 | include_once(__DIR__ . '/../inc/demo.inc.php'); | ||
29 | include_once(__DIR__ . '/../inc/ver.php'); | ||
30 | include_once(__DIR__ . '/../inc/ldap.inc.php'); | ||
31 | include_once(__DIR__ . '/../inc/ssh.inc.php'); | ||
32 | include_once(__DIR__ . '/../inc/stats.inc.php'); | ||
33 | include_once(__DIR__ . '/../inc/ratelimit.inc.php'); | ||
34 | include_once(__DIR__ . '/../inc/user/packages.inc.php'); | ||
35 | |||
36 | rg_prof_start('MAIN'); | ||
37 | |||
38 | rg_log_set_file($rg_log_dir . '/web.log'); | ||
39 | 39 | ||
40 | 40 | ignore_user_abort(TRUE); | ignore_user_abort(TRUE); |
41 | 41 | ||
... | ... | $rg['https'] = strcmp(rg_var_str('HTTPS'), 'on') == 0 ? 1 : 0; | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | $sparas = rg_var_str('SCRIPT_NAME'); | $sparas = rg_var_str('SCRIPT_NAME'); |
68 | rg_log('DEBUG: ' . @$_SERVER['REQUEST_METHOD'] . ' sparas=' . $sparas); | ||
68 | rg_log($rg['ip'] . ' ' . @$_SERVER['REQUEST_METHOD'] . ' ' . $sparas); | ||
69 | 69 | $rg['current_url'] = rawurlencode($sparas); | $rg['current_url'] = rawurlencode($sparas); |
70 | 70 | $rg['url'] = '/op'; | $rg['url'] = '/op'; |
71 | 71 | $paras = explode("/", trim($sparas, "/")); | $paras = explode("/", trim($sparas, "/")); |
... | ... | if ((rg_load() > 50) && rg_is_bot($rg['ua'])) { | |
92 | 92 | echo 'Too many requests. Please slow down.' . "\n"; | echo 'Too many requests. Please slow down.' . "\n"; |
93 | 93 | exit(0); | exit(0); |
94 | 94 | } | } |
95 | $rg['ip'] = isset($_SERVER['REMOTE_ADDR']) ? rg_fix_ip($_SERVER['REMOTE_ADDR']) : ''; | ||
96 | 95 | $rg['referer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; | $rg['referer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; |
97 | 96 | $req = $_REQUEST; | $req = $_REQUEST; |
98 | 97 | if (isset($req['pass']) || isset($req['init::pass']) || isset($req['init::pass2'])) | if (isset($req['pass']) || isset($req['init::pass']) || isset($req['init::pass2'])) |
... | ... | if (!empty($req)) | |
107 | 106 | rg_log("DEBUG: _REQUEST: " . rg_array2string($req)); | rg_log("DEBUG: _REQUEST: " . rg_array2string($req)); |
108 | 107 | if (!empty($_COOKIE)) | if (!empty($_COOKIE)) |
109 | 108 | rg_log("DEBUG: _COOKIE: " . rg_array2string($_COOKIE)); | rg_log("DEBUG: _COOKIE: " . rg_array2string($_COOKIE)); |
110 | rg_log($rg['ip'] . ' ver=' . $rocketgit_version); | ||
111 | 109 | ||
110 | //rg_log_ml('_SERVER: ' . print_r($_SERVER, TRUE)); | ||
111 | $_list = array('SERVER_PROTOCOL', 'HTTP_CACHE_CONTROL', | ||
112 | 'HTTP_IF_NONE_MATCH', 'HTTP_REFERER', | ||
113 | 'HTTP_ACCEPT_ENCODING', 'HTTP_USER_AGENT', 'HTTP_HOST', | ||
114 | 'CONTENT_LENGTH', 'CONTENT_TYPE', 'HTTP_RANGE'); | ||
115 | foreach ($_list as $k) { | ||
116 | if (isset($_SERVER[$k]) && !empty($_SERVER[$k])) | ||
117 | rg_log($k . ': ' . $_SERVER[$k]); | ||
118 | } | ||
112 | 119 | // Try to detect if we cloning by http(s) | // Try to detect if we cloning by http(s) |
113 | rg_log_ml('_SERVER: ' . print_r($_SERVER, TRUE)); | ||
114 | 120 | $rg['ct'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : ''; | $rg['ct'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : ''; |
115 | 121 | ||
116 | 122 | ||
... | ... | if ($lim == 0) { | |
129 | 135 | echo 'Too many requests. Please slow down.' . "\n"; | echo 'Too many requests. Please slow down.' . "\n"; |
130 | 136 | exit(0); | exit(0); |
131 | 137 | } | } |
132 | header('X-RocketGit-Limit: ' . $lim); | ||
138 | header('X-RocketGit-Limit-Left: ' . $lim); | ||
133 | 139 | ||
134 | 140 | // Sets http(s)_allow and hostname | // Sets http(s)_allow and hostname |
135 | 141 | $hostname = rg_state_get($db, 'hostname'); | $hostname = rg_state_get($db, 'hostname'); |
... | ... | if ($r === TRUE) { | |
256 | 262 | rg_stats_conns_set('type', 'http'); | rg_stats_conns_set('type', 'http'); |
257 | 263 | ||
258 | 264 | rg_user_login_by_sid($db, $rg); | rg_user_login_by_sid($db, $rg); |
259 | rg_log("After login_by_sid, login_ui=" . rg_array2string($rg['login_ui'])); | ||
265 | //rg_log('DEBUG: After login_by_sid, login_ui=' . rg_array2string($rg['login_ui'])); | ||
260 | 266 | // If user provided an old/expired sid, we generate a new one, pre-login | // If user provided an old/expired sid, we generate a new one, pre-login |
261 | 267 | if (($rg['login_ui']['uid'] == 0) && (strncmp($rg['sid'], "X", 1) != 0)) | if (($rg['login_ui']['uid'] == 0) && (strncmp($rg['sid'], "X", 1) != 0)) |
262 | 268 | $rg['sid'] = ""; | $rg['sid'] = ""; |
... | ... | if ($r === TRUE) { | |
281 | 287 | $rg['first_install_text'] = gmdate("Y-m-d", $r); | $rg['first_install_text'] = gmdate("Y-m-d", $r); |
282 | 288 | ||
283 | 289 | rg_log("Dispatching to [$_op]"); | rg_log("Dispatching to [$_op]"); |
284 | include($INC . "/dispatch/dispatch.php"); | ||
290 | include(__DIR__ . '/../inc/dispatch/dispatch.php'); | ||
285 | 291 | } | } |
286 | 292 | ||
287 | 293 | if ($rg['login_ui']['uid'] > 0) { | if ($rg['login_ui']['uid'] > 0) { |
File root/themes/default/admin/ldap/list/footer.html changed (mode: 100644) (index 0b2ff2f..cbdef89) | |||
3 | 3 | </div> | </div> |
4 | 4 | ||
5 | 5 | <p> | <p> |
6 | <input type="submit" name="button" value="Delete selected servers" /> | ||
6 | <input type="submit" name="button" value="Delete selected" /> | ||
7 | 7 | </p> | </p> |
8 | 8 | </form> | </form> |
File root/themes/default/admin/plans/list/footer.html changed (mode: 100644) (index 536d27d..cbdef89) | |||
3 | 3 | </div> | </div> |
4 | 4 | ||
5 | 5 | <p> | <p> |
6 | <input type="submit" name="button" value="Delete selected plans" /> | ||
6 | <input type="submit" name="button" value="Delete selected" /> | ||
7 | 7 | </p> | </p> |
8 | 8 | </form> | </form> |
File root/themes/default/builder/queue/footer.html changed (mode: 100644) (index 8f3c597..cbdef89) | |||
3 | 3 | </div> | </div> |
4 | 4 | ||
5 | 5 | <p> | <p> |
6 | <input type="submit" name="button" value="Delete selected jobs" /> | ||
6 | <input type="submit" name="button" value="Delete selected" /> | ||
7 | 7 | </p> | </p> |
8 | 8 | </form> | </form> |
File root/themes/default/index.html changed (mode: 100644) (index 1adb26a..4f338a1) | |||
77 | 77 | rocketgit.com site is operated by Embedromix SRL,<br /> | rocketgit.com site is operated by Embedromix SRL,<br /> |
78 | 78 | CIF 13505234, J08/979/2000, Brasov, Romania.<br /> | CIF 13505234, J08/979/2000, Brasov, Romania.<br /> |
79 | 79 | All data is stored in Germany and Romania only (AFAIK).<br /> | All data is stored in Germany and Romania only (AFAIK).<br /> |
80 | We are not selling your data. | ||
80 | <b>We are not selling any information about you.</b> | ||
81 | 81 | </div> | </div> |
82 | 82 | </div> | </div> |
83 | 83 |
File root/themes/default/internal_err.html changed (mode: 100644) (index 46aeb83..3d19b58) | |||
1 | 1 | <div class="mess warning"> | <div class="mess warning"> |
2 | 2 | An internal error occurred. Please try again later. | An internal error occurred. Please try again later. |
3 | @@if("@@errmsg@@" != ""){{Details: @@errmsg@@}} | ||
3 | 4 | </div> | </div> |
File root/themes/default/main.css changed (mode: 100644) (index 4528e0c..aaeb208) | |||
1 | 1 | * { | * { |
2 | 2 | margin: 0; | margin: 0; |
3 | 3 | padding: 0; | padding: 0; |
4 | line-height: 120%; | ||
4 | line-height: 125%; | ||
5 | 5 | word-wrap: break-word; | word-wrap: break-word; |
6 | 6 | box-sizing: border-box; | box-sizing: border-box; |
7 | 7 | } | } |
... | ... | a { | |
76 | 76 | padding: 5pt; | padding: 5pt; |
77 | 77 | white-space: pre-wrap; | white-space: pre-wrap; |
78 | 78 | } | } |
79 | .term a { | ||
80 | color: #0f0; | ||
81 | } | ||
79 | 82 | ||
80 | 83 | form { | form { |
81 | 84 | width: 100%; | width: 100%; |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
162 | 165 | background-color: #999; | background-color: #999; |
163 | 166 | display: flex; | display: flex; |
164 | 167 | flex-flow: row wrap; | flex-flow: row wrap; |
165 | margin-top: 7pt; | ||
168 | margin-top: 4pt; | ||
166 | 169 | } | } |
167 | 170 | .menu ul { | .menu ul { |
168 | 171 | list-style-type: none; | list-style-type: none; |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
249 | 252 | } | } |
250 | 253 | .footer_info { | .footer_info { |
251 | 254 | color: #000; | color: #000; |
252 | padding: 10px; | ||
255 | padding: 5pt; | ||
256 | font-size: 9pt; | ||
257 | } | ||
258 | .footer_menu { | ||
253 | 259 | font-size: 11pt; | font-size: 11pt; |
254 | vertical-align: top; | ||
255 | 260 | } | } |
256 | 261 | ||
257 | 262 | .formarea { | .formarea { |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
263 | 268 | .formarea > formarea_table { | .formarea > formarea_table { |
264 | 269 | overflow-x: scroll; | overflow-x: scroll; |
265 | 270 | } | } |
271 | .formarea_table table { | ||
272 | width: 100%; | ||
273 | } | ||
266 | 274 | .formarea:not(:first-child) { | .formarea:not(:first-child) { |
267 | 275 | margin-top: 7pt; | margin-top: 7pt; |
268 | 276 | } | } |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
272 | 280 | .formarea_small { | .formarea_small { |
273 | 281 | align-self: center; | align-self: center; |
274 | 282 | } | } |
275 | |||
276 | 283 | .formarea_title { | .formarea_title { |
277 | 284 | font-weight: bold; | font-weight: bold; |
278 | 285 | font-size: 13pt; | font-size: 13pt; |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
287 | 294 | .form_table:not(:first-child) { | .form_table:not(:first-child) { |
288 | 295 | margin-top: 7pt; | margin-top: 7pt; |
289 | 296 | } | } |
297 | .form_table p { | ||
298 | margin-top: 0; | ||
299 | } | ||
290 | 300 | ||
291 | 301 | ||
292 | 302 | .wh_plugins_list {} | .wh_plugins_list {} |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
333 | 343 | ||
334 | 344 | .cl-r { | .cl-r { |
335 | 345 | font-family: monospace; | font-family: monospace; |
336 | font-size: 9pt; | ||
337 | background-color: #f00; | ||
346 | font-size: 8pt; | ||
347 | background-color: #fcc; | ||
338 | 348 | } | } |
339 | 349 | ||
340 | 350 | .cl-g { | .cl-g { |
341 | 351 | font-family: monospace; | font-family: monospace; |
342 | font-size: 9pt; | ||
343 | background-color: #0f0; | ||
352 | font-size: 8pt; | ||
353 | background-color: #cfc; | ||
344 | 354 | } | } |
345 | 355 | ||
346 | 356 | .cl-e { | .cl-e { |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
439 | 449 | font-size: 9pt; | font-size: 9pt; |
440 | 450 | box-shadow: 0px 2px 3px #666; | box-shadow: 0px 2px 3px #666; |
441 | 451 | } | } |
442 | .hints:not(:first-child) { margin-top: 6pt } | ||
452 | .hints:not(:first-child) { margin-top: 13pt } | ||
443 | 453 | .hints ul { list-style-type: square; margin-left: 9pt; } | .hints ul { list-style-type: square; margin-left: 9pt; } |
444 | 454 | .hints ul li { } | .hints ul li { } |
445 | 455 | .hints ul li a { } | .hints ul li a { } |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
667 | 677 | .compare_bad { background-color: #f00; } | .compare_bad { background-color: #f00; } |
668 | 678 | .compare_chapter { background-color: #ddd; font-weight: bold; } | .compare_chapter { background-color: #ddd; font-weight: bold; } |
669 | 679 | .compare_info { | .compare_info { |
670 | background-color: #000; | ||
680 | background-color: #ccc; | ||
681 | border: 1px solid #aaa; | ||
671 | 682 | padding: 0 3pt; | padding: 0 3pt; |
672 | color: #fff; | ||
683 | color: #000; | ||
673 | 684 | } | } |
674 | 685 | ||
675 | 686 | .stats_svg { | .stats_svg { |
... | ... | x.buttons form input[type="submit"], x.buttons form input, x.buttons form select | |
693 | 704 | } | } |
694 | 705 | ||
695 | 706 | .commit_details { | .commit_details { |
696 | padding: 3pt; | ||
697 | 707 | background-color: #ddd; | background-color: #ddd; |
708 | border: 1px solid #aaa; | ||
709 | padding: 3pt; | ||
698 | 710 | } | } |
699 | 711 | .commit_details:not(:first-child) { | .commit_details:not(:first-child) { |
700 | 712 | margin-top: 8pt; | margin-top: 8pt; |
701 | 713 | } | } |
702 | 714 | ||
715 | summary { padding-left: 3pt } | ||
716 | |||
717 | .pkg details { | ||
718 | background-color: #eee; | ||
719 | border: 1px solid #000; | ||
720 | padding: 3pt; | ||
721 | } | ||
722 | .pkg details:not(:first-child) { | ||
723 | margin-top: 3pt; | ||
724 | } |
File root/themes/default/repo/cl/list/header.html changed (mode: 100644) (index 05331a4..d3e603f) | |||
1 | <b>Labels associated with this commit:</b><br /> | ||
2 | 1 | <table> | <table> |
3 | 2 | <thead> | <thead> |
4 | 3 | <tr> | <tr> |
File root/themes/default/repo/commits/line.html changed (mode: 100644) (index 4969118..e4cf009) | |||
10 | 10 | <b>Committer date (UTC):</b> @@vars::x_committer date@@<br /> | <b>Committer date (UTC):</b> @@vars::x_committer date@@<br /> |
11 | 11 | <b>Parent(s):</b> @@vars::parents@@<br /> | <b>Parent(s):</b> @@vars::parents@@<br /> |
12 | 12 | <b>Signing key:</b> @@vars::sign_key@@<br /> | <b>Signing key:</b> @@vars::sign_key@@<br /> |
13 | <b>Tree:</b> @@vars::tree@@<br /> | ||
13 | <b>Tree:</b> <a href="@@url_repo@@/source/tree/@@vars::tree@@">@@vars::tree@@</a><br /> | ||
14 | 14 | ||
15 | 15 | @@x_stats@@ | @@x_stats@@ |
16 | 16 |
File root/themes/default/user/forgot.html changed (mode: 100644) (index 285ae2d..054cb5a) | |||
19 | 19 | </p> | </p> |
20 | 20 | ||
21 | 21 | <fieldset> | <fieldset> |
22 | <legend>Lock login from current IP</legend> | ||
22 | <legend>Lock session on current IP</legend> | ||
23 | 23 | <input type="radio" name="lock_ip" id="lock_ip_yes" value="1" checked="checked" /> | <input type="radio" name="lock_ip" id="lock_ip_yes" value="1" checked="checked" /> |
24 | 24 | <label for="lock_ip_yes">Yes (more secure)</label> | <label for="lock_ip_yes">Yes (more secure)</label> |
25 | 25 | <br /> | <br /> |
File root/themes/default/user/home.html changed (mode: 100644) (index a63eb9c..80dc930) | |||
1 | 1 | <div class="main_title"> | <div class="main_title"> |
2 | 2 | @@page_ui::gravatar@@ | @@page_ui::gravatar@@ |
3 | Home page of user @@page_ui::username@@ (#@@page_ui::uid@@, | ||
4 | since @@page_ui::itime_nice@@) | ||
3 | Home page of user @@page_ui::username@@ (since @@page_ui::itime_nice@@) | ||
5 | 4 | <div class="buttons">@@watch_form@@ @@watch_error@@</div> | <div class="buttons">@@watch_form@@ @@watch_error@@</div> |
6 | 5 | </div> | </div> |
File root/themes/default/user/login.html changed (mode: 100644) (index 1821c16..f0bad76) | |||
24 | 24 | </p> | </p> |
25 | 25 | ||
26 | 26 | <fieldset> | <fieldset> |
27 | <legend>Lock login on current IP</legend> | ||
27 | <legend>Lock session on current IP</legend> | ||
28 | 28 | <input type="radio" name="lock_ip" id="lock_ip_yes" value="1" checked="checked" /> | <input type="radio" name="lock_ip" id="lock_ip_yes" value="1" checked="checked" /> |
29 | 29 | <label for="lock_ip_yes">Yes (more secure)</label> | <label for="lock_ip_yes">Yes (more secure)</label> |
30 | 30 | <br /> | <br /> |
File root/themes/default/user/repo/rights/list_repo/footer.html changed (mode: 100644) (index 28babdd..cbdef89) | |||
3 | 3 | </div> | </div> |
4 | 4 | ||
5 | 5 | <p> | <p> |
6 | <input type="submit" name="button" value="Delete selected rights" /> | ||
6 | <input type="submit" name="button" value="Delete selected" /> | ||
7 | 7 | </p> | </p> |
8 | 8 | </form> | </form> |
File root/themes/default/user/repo/rights/list_repo_path/footer.html changed (mode: 100644) (index 28babdd..cbdef89) | |||
3 | 3 | </div> | </div> |
4 | 4 | ||
5 | 5 | <p> | <p> |
6 | <input type="submit" name="button" value="Delete selected rights" /> | ||
6 | <input type="submit" name="button" value="Delete selected" /> | ||
7 | 7 | </p> | </p> |
8 | 8 | </form> | </form> |
File root/themes/default/user/repo/rights/list_repo_refs/footer.html changed (mode: 100644) (index 28babdd..cbdef89) | |||
3 | 3 | </div> | </div> |
4 | 4 | ||
5 | 5 | <p> | <p> |
6 | <input type="submit" name="button" value="Delete selected rights" /> | ||
6 | <input type="submit" name="button" value="Delete selected" /> | ||
7 | 7 | </p> | </p> |
8 | 8 | </form> | </form> |
File root/themes/default/user/settings/apikeys/hints.html changed (mode: 100644) (index 616c0ea..a7d50e2) | |||
1 | 1 | <br /> | <br /> |
2 | 2 | API keys are used to access RocketGit's API by HTTP(S).<br /> | API keys are used to access RocketGit's API by HTTP(S).<br /> |
3 | 3 | Check <a href="/op/doc/api">API documentation</a> for more info.<br /> | Check <a href="/op/doc/api">API documentation</a> for more info.<br /> |
4 | <b>Count</b> shows how many times the API key has been used.<br /> | ||
4 | 5 | Example: | Example: |
5 | 6 | <div class="term">$ curl --header 'Authorization: @@login_ui::username@@ put_here_the_apikey' \ | <div class="term">$ curl --header 'Authorization: @@login_ui::username@@ put_here_the_apikey' \ |
6 | 7 | --data '{"cmd": "user_info", "user": "@@login_ui::username@@"}' \ | --data '{"cmd": "user_info", "user": "@@login_ui::username@@"}' \ |
7 | 8 | @@base_url@@/op/api | @@base_url@@/op/api |
8 | |||
9 | 9 | </div> | </div> |
File root/themes/default/user/settings/apikeys/list/footer.html changed (mode: 100644) (index 6861ab5..cbdef89) | |||
3 | 3 | </div> | </div> |
4 | 4 | ||
5 | 5 | <p> | <p> |
6 | <input type="submit" name="button" value="Delete selected keys" /> | ||
6 | <input type="submit" name="button" value="Delete selected" /> | ||
7 | 7 | </p> | </p> |
8 | 8 | </form> | </form> |
File root/themes/default/user/settings/workers/list/footer.html changed (mode: 100644) (index 16fe8a3..cbdef89) | |||
3 | 3 | </div> | </div> |
4 | 4 | ||
5 | 5 | <p> | <p> |
6 | <input type="submit" name="button" value="Delete selected workers" /> | ||
6 | <input type="submit" name="button" value="Delete selected" /> | ||
7 | 7 | </p> | </p> |
8 | 8 | </form> | </form> |
File scripts/builder.php changed (mode: 100644) (index 683c49c..6250577) | |||
... | ... | function xdispatch_one($key, $data) | |
165 | 165 | $now = time(); | $now = time(); |
166 | 166 | $s = &$rg_conns[$key]; | $s = &$rg_conns[$key]; |
167 | 167 | //rg_log('DEBUG: data=' . $data); | //rg_log('DEBUG: data=' . $data); |
168 | //rg_log_ml($key . ': DEBUG: xdispatch_one s: ' . print_r($s, TRUE)); | ||
168 | //rg_log_ml($key . ': DEBUG: xdispatch_one s: ' . rg_array2string($s)); | ||
169 | 169 | while (1) { | while (1) { |
170 | 170 | $u = @json_decode($data, TRUE); | $u = @json_decode($data, TRUE); |
171 | 171 | if ($u === NULL) { | if ($u === NULL) { |
... | ... | function xdispatch_one($key, $data) | |
177 | 177 | break; | break; |
178 | 178 | } | } |
179 | 179 | ||
180 | //rg_log_ml($key . ': DEBUG: u: ' . print_r($u, TRUE)); | ||
180 | //rg_log_ml($key . ': DEBUG: u: ' . rg_array2string($u)); | ||
181 | 181 | ||
182 | 182 | if (!isset($u['op'])) { | if (!isset($u['op'])) { |
183 | 183 | $err = array('errstr' => 'op parameter is missing'); | $err = array('errstr' => 'op parameter is missing'); |
184 | rg_log_ml($key . ': DEBUG: op parameter is missing; u: ' . print_r($u, TRUE)); | ||
184 | rg_log_ml($key . ': DEBUG: op parameter is missing; u: ' . rg_array2string($u)); | ||
185 | 185 | rg_conn_enq($key, json_encode($err) . "\n"); | rg_conn_enq($key, json_encode($err) . "\n"); |
186 | 186 | rg_conn_shutdown($key, 2); | rg_conn_shutdown($key, 2); |
187 | 187 | break; | break; |
188 | 188 | } | } |
189 | 189 | ||
190 | 190 | $op = $u['op']; unset($u['op']); | $op = $u['op']; unset($u['op']); |
191 | rg_log($key . ': op=' . $op); | ||
192 | |||
191 | 193 | if (strcmp($op, 'ANN') == 0) { | if (strcmp($op, 'ANN') == 0) { |
192 | 194 | if (($u['boot_time'] < $now - 30) || ($u['boot_time'] > $now + 30)) { | if (($u['boot_time'] < $now - 30) || ($u['boot_time'] > $now + 30)) { |
193 | 195 | $err = array( | $err = array( |
... | ... | function xdispatch_one($key, $data) | |
271 | 273 | $r = rg_worker_update($s['db'], $worker_uid, $wi['id'], $a); | $r = rg_worker_update($s['db'], $worker_uid, $wi['id'], $a); |
272 | 274 | if ($r !== TRUE) { | if ($r !== TRUE) { |
273 | 275 | rg_log($key . ': cannot update worker: ' . rg_worker_error()); | rg_log($key . ': cannot update worker: ' . rg_worker_error()); |
274 | $err = array('op' => $op, 'errstr' => rg_worker_info()); | ||
276 | $err = array('op' => $op, 'errstr' => rg_worker_error()); | ||
275 | 277 | rg_conn_enq($key, json_encode($err) . "\n"); | rg_conn_enq($key, json_encode($err) . "\n"); |
276 | 278 | rg_conn_shutdown($key, 2); | rg_conn_shutdown($key, 2); |
277 | 279 | break; | break; |
... | ... | function xdispatch_one($key, $data) | |
326 | 328 | } | } |
327 | 329 | ||
328 | 330 | if (strcmp($op, 'DON') == 0) { | if (strcmp($op, 'DON') == 0) { |
329 | rg_log_ml($key . ': ' . $jid . ': DEBUG: DON u:' . print_r($u, TRUE)); | ||
331 | rg_log_ml($key . ': ' . $jid . ': DEBUG: DON u:' . rg_array2string($u)); | ||
330 | 332 | ||
331 | 333 | $send_confirmation = TRUE; | $send_confirmation = TRUE; |
332 | 334 | if (!empty($u['error'])) { | if (!empty($u['error'])) { |
... | ... | function xdispatch_one($key, $data) | |
353 | 355 | if ($send_confirmation) { | if ($send_confirmation) { |
354 | 356 | // Send DoneREceived - so client will delete the job | // Send DoneREceived - so client will delete the job |
355 | 357 | $a = array('op' => 'DRE', 'id' => $jid); | $a = array('op' => 'DRE', 'id' => $jid); |
356 | rg_log_ml($key . ': ' . $jid . ': DEBUG: Sending DRE: ' . print_r($a, TRUE)); | ||
358 | rg_log_ml($key . ': ' . $jid . ': DEBUG: Sending DRE: ' . rg_array2string($a)); | ||
357 | 359 | rg_conn_enq($key, @json_encode($a) . "\n"); | rg_conn_enq($key, @json_encode($a) . "\n"); |
358 | 360 | } | } |
359 | 361 | break; | break; |
360 | 362 | } | } |
361 | 363 | ||
362 | 364 | if (strcmp($op, 'artifact_upload_info') == 0) { | if (strcmp($op, 'artifact_upload_info') == 0) { |
363 | rg_log_ml($key . ': ' . $jid . ': ' . $op . ': u: ' . print_r($u, TRUE)); | ||
365 | rg_log_ml($key . ': ' . $jid . ': ' . $op . ': u: ' . rg_array2string($u)); | ||
364 | 366 | if (!isset($job['artifacts'])) | if (!isset($job['artifacts'])) |
365 | 367 | $job['artifacts'] = array(); | $job['artifacts'] = array(); |
366 | 368 | ||
... | ... | function xdispatch_one($key, $data) | |
387 | 389 | $base['aid'] = $aid; | $base['aid'] = $aid; |
388 | 390 | ||
389 | 391 | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': ' | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': ' |
390 | . $op . ': u: ' . print_r($u, TRUE)); | ||
392 | . $op . ': u: ' . rg_array2string($u)); | ||
391 | 393 | ||
392 | 394 | // TODO: Move this where the job is prepared - where?! | // TODO: Move this where the job is prepared - where?! |
393 | 395 | if (!isset($job['repo_path'])) | if (!isset($job['repo_path'])) |
... | ... | function xdispatch_one($key, $data) | |
537 | 539 | $meta['map_into_source'][] = $path; | $meta['map_into_source'][] = $path; |
538 | 540 | } | } |
539 | 541 | } else { | } else { |
540 | rg_log_ml('DEBUG: para does not have map_into_source: ' . print_r($para, TRUE)); | ||
542 | rg_log_ml('DEBUG: para does not have map_into_source: ' . rg_array2string($para)); | ||
541 | 543 | } | } |
542 | 544 | ||
543 | 545 | foreach ($para['map'] as $path) { | foreach ($para['map'] as $path) { |
... | ... | function xdispatch_one($key, $data) | |
597 | 599 | } | } |
598 | 600 | $meta['upload_ts'] = time(); | $meta['upload_ts'] = time(); |
599 | 601 | ||
600 | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': meta: ' . print_r($meta, TRUE)); | ||
602 | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': meta: ' . rg_array2string($meta)); | ||
601 | 603 | $r = @file_put_contents($apath . '.rg.meta', | $r = @file_put_contents($apath . '.rg.meta', |
602 | 604 | rg_serialize($meta)); | rg_serialize($meta)); |
603 | 605 | if ($r === FALSE) { | if ($r === FALSE) { |
... | ... | function xdispatch_one($key, $data) | |
623 | 625 | break; | break; |
624 | 626 | } | } |
625 | 627 | ||
626 | rg_log_ml($key . ': Unknown operation [' . $op . ']! u: ' . print_r($u, TRUE)); | ||
628 | rg_log_ml($key . ': Unknown operation [' . $op . ']! u: ' . rg_array2string($u)); | ||
627 | 629 | $err = array('op' => $op, 'errstr' => 'unknown operation'); | $err = array('op' => $op, 'errstr' => 'unknown operation'); |
628 | 630 | rg_conn_enq($key, json_encode($err) . "\n"); | rg_conn_enq($key, json_encode($err) . "\n"); |
629 | 631 | break; | break; |
630 | 632 | } | } |
631 | 633 | unset($job); | unset($job); |
632 | 634 | ||
633 | //rg_log_ml('DEBUG: s: ' . print_r($s, TRUE)); | ||
635 | //rg_log_ml('DEBUG: s: ' . rg_array2string($s)); | ||
634 | 636 | unset($s); | unset($s); |
635 | 637 | } | } |
636 | 638 | ||
... | ... | function rg_process_job($db, &$job) | |
686 | 688 | ||
687 | 689 | rg_log_ml($jid . ': processing job...'); | rg_log_ml($jid . ': processing job...'); |
688 | 690 | ||
691 | // 'request' is the new way | ||
689 | 692 | if (!isset($job['request'])) | if (!isset($job['request'])) |
690 | 693 | $req = $job; | $req = $job; |
691 | 694 | else | else |
... | ... | function rg_process_job($db, &$job) | |
698 | 701 | $job['next_try'] = time() + 60; | $job['next_try'] = time() + 60; |
699 | 702 | return; | return; |
700 | 703 | } | } |
701 | //rg_log_ml('DEBUG: workers list: ' . print_r($workers_list, TRUE)); | ||
704 | //rg_log_ml('DEBUG: workers list: ' . rg_array2string($workers_list)); | ||
702 | 705 | ||
703 | 706 | // Trying to find a worker in the list of connections | // Trying to find a worker in the list of connections |
704 | 707 | foreach ($rg_conns as $key => &$i) { | foreach ($rg_conns as $key => &$i) { |
... | ... | if (!is_dir($rg_state_dir . '/builder')) { | |
809 | 812 | $jobs = array(); | $jobs = array(); |
810 | 813 | $state_dir = $rg_state_dir . '/builder'; | $state_dir = $rg_state_dir . '/builder'; |
811 | 814 | $saved_jobs = rg_load_files($state_dir, 'job-[0-9]*.ser', 'id'); | $saved_jobs = rg_load_files($state_dir, 'job-[0-9]*.ser', 'id'); |
812 | rg_log_ml('Jobs loaded from dir: ' . print_r($saved_jobs, TRUE)); | ||
815 | if (!empty($saved_jobs)) | ||
816 | rg_log_ml('Jobs loaded from dir: ' . rg_array2string($saved_jobs)); | ||
813 | 817 | ||
814 | 818 | rg_sql_app('rg-builder'); | rg_sql_app('rg-builder'); |
815 | 819 | $db = rg_sql_open($rg_sql); | $db = rg_sql_open($rg_sql); |
... | ... | do { | |
867 | 871 | } | } |
868 | 872 | ||
869 | 873 | if ($workers > 0) { | if ($workers > 0) { |
870 | $r = rg_builder_load_jobs($db, 'done = 0', 'itime', ''); | ||
874 | $r = rg_builder_load_jobs($db, 'done = 0', 'itime', '' /*limit*/); | ||
871 | 875 | if ($r['ok'] != 1) { | if ($r['ok'] != 1) { |
872 | 876 | rg_log('Cannot load jobs from database!'); | rg_log('Cannot load jobs from database!'); |
873 | 877 | continue; | continue; |
... | ... | do { | |
875 | 879 | ||
876 | 880 | $_r = TRUE; | $_r = TRUE; |
877 | 881 | foreach ($r['list'] as $jid => $job) { | foreach ($r['list'] as $jid => $job) { |
878 | unset($job['status']); // not neeeded for builder | ||
882 | unset($job['status']); // not needed for builder | ||
879 | 883 | ||
880 | 884 | if (isset($saved_jobs[$jid])) { | if (isset($saved_jobs[$jid])) { |
885 | rg_log($jid . ': We restored data from disk.'); | ||
886 | rg_log_ml($jid . ':DEBUG: ' . rg_array2string($saved_jobs[$jid])); | ||
881 | 887 | $jobs[$jid] = $saved_jobs[$jid]; | $jobs[$jid] = $saved_jobs[$jid]; |
882 | 888 | unset($saved_jobs[$jid]); | unset($saved_jobs[$jid]); |
883 | 889 | } | } |
884 | 890 | ||
885 | 891 | if (!isset($jobs[$jid])) { | if (!isset($jobs[$jid])) { |
886 | rg_log('New job from db: ' . $jid); | ||
892 | rg_log($jid . ': New job loaded from db'); | ||
893 | rg_log_ml($jid . ': DEBUG: job: ' . rg_array2string($job)); | ||
887 | 894 | $job['worker_id'] = 0; | $job['worker_id'] = 0; |
888 | 895 | $job['avoid'] = array(); // list of workers to avoid | $job['avoid'] = array(); // list of workers to avoid |
889 | 896 | $jobs[$jid] = $job; | $jobs[$jid] = $job; |
... | ... | do { | |
897 | 904 | break; | break; |
898 | 905 | ||
899 | 906 | // Clean old jobs | // Clean old jobs |
900 | foreach ($saved_jobs as $jid => $info) | ||
907 | foreach ($saved_jobs as $jid => $info) { | ||
908 | rg_log($jid . ': Cleaning useless job from disk'); | ||
901 | 909 | @unlink($state_dir . '/job-' . $jid . '.ser'); | @unlink($state_dir . '/job-' . $jid . '.ser'); |
910 | } | ||
902 | 911 | $saved_jobs = array(); | $saved_jobs = array(); |
903 | 912 | } | } |
904 | 913 |
File scripts/remote.php changed (mode: 100644) (index 1c75d4b..cca26d2) | |||
... | ... | if (isset($_SERVER['SSH_CONNECTION'])) { | |
147 | 147 | if ($lim == 0) | if ($lim == 0) |
148 | 148 | fatal('Too many requests! Please slow down.'); | fatal('Too many requests! Please slow down.'); |
149 | 149 | ||
150 | // We assume that the login user is the target user and no repo | ||
151 | rg_stats_conns_set('uid', $login_ui['uid']); | ||
152 | rg_stats_conns_set('repo_id', 0); | ||
153 | rg_stats_conns_set('type', 'ssh'); | ||
154 | |||
155 | 150 | // Only normal keys can execute some commands | // Only normal keys can execute some commands |
156 | 151 | $must_exit = rg_ssh_dispatch($db, $rg['ip'], $login_ui, $cmd_repo); | $must_exit = rg_ssh_dispatch($db, $rg['ip'], $login_ui, $cmd_repo); |
157 | 152 | ||
... | ... | $_t = preg_replace('/\.git$/' , '', $_t); | |
239 | 234 | $_t = explode('/', $_t); | $_t = explode('/', $_t); |
240 | 235 | if (strcmp($_t[0], 'user') == 0) { | if (strcmp($_t[0], 'user') == 0) { |
241 | 236 | $prefix = '/user'; | $prefix = '/user'; |
242 | $user = isset($_t[1]) ? $_t[1] : ''; | ||
243 | $repo = isset($_t[2]) ? $_t[2] : ''; | ||
237 | $repo_user = isset($_t[1]) ? $_t[1] : ''; | ||
238 | $repo_name = isset($_t[2]) ? $_t[2] : ''; | ||
244 | 239 | } else { | } else { |
245 | 240 | $prefix = ''; | $prefix = ''; |
246 | $user = isset($_t[0]) ? $_t[0] : ''; | ||
247 | $repo = isset($_t[1]) ? $_t[1] : ''; | ||
241 | $repo_user = isset($_t[0]) ? $_t[0] : ''; | ||
242 | $repo_name = isset($_t[1]) ? $_t[1] : ''; | ||
248 | 243 | } | } |
249 | 244 | ||
250 | 245 | rg_log('ip=[' . $rg['ip'] . '] host=[' . $host . '] cmd=[' . $rg['cmd'] . ']' | rg_log('ip=[' . $rg['ip'] . '] host=[' . $host . '] cmd=[' . $rg['cmd'] . ']' |
251 | . ' prefix=[' . $prefix . '] user=[' . $user . ']' | ||
252 | . ' repo=[' . $repo . '].'); | ||
246 | . ' prefix=[' . $prefix . '] repo_user=[' . $repo_user . ']' | ||
247 | . ' repo_name=[' . $repo_name . '].'); | ||
253 | 248 | ||
254 | 249 | if (strstr($flags, 'W')) { | if (strstr($flags, 'W')) { |
255 | 250 | // We are a worker, the command may be only for cloning! | // We are a worker, the command may be only for cloning! |
... | ... | if (($login_uid == 0) && strstr($flags, 'W')) | |
263 | 258 | $helper_flags .= 'B'; | $helper_flags .= 'B'; |
264 | 259 | ||
265 | 260 | $r = rg_repo_fetch_push_helper($db, $host, $rg['ip'], $login_ui, $prefix, | $r = rg_repo_fetch_push_helper($db, $host, $rg['ip'], $login_ui, $prefix, |
266 | $user, $repo, $rg['cmd'], $helper_flags); | ||
261 | $repo_user, $repo_name, $rg['cmd'], $helper_flags); | ||
267 | 262 | rg_log_ml('DEBUG: repo_fetch_push_helper: ' . print_r($r, TRUE)); | rg_log_ml('DEBUG: repo_fetch_push_helper: ' . print_r($r, TRUE)); |
268 | 263 | if (($r['ok'] !== 1) || ($r['allow'] !== 1)) | if (($r['ok'] !== 1) || ($r['allow'] !== 1)) |
269 | 264 | fatal($r['errmsg']); | fatal($r['errmsg']); |
File scripts/rgfs.TODO added (mode: 100644) (index 0000000..728e85f) | |||
1 | [ ] Steps: | ||
2 | We can call rg_wh_build_send_one but it look-ups the repo info, | ||
3 | filling a lot of info. So, probably the best way is to call | ||
4 | rg_builder_add. But, the package mapping is done also in | ||
5 | rg_wh_build_send_one. Anyway, the mapping is not standars, so, | ||
6 | not a problem to redo the map. | ||
7 | |||
8 | - How do I do the inverse lookup? I mean how to show that a | ||
9 | package is available for a repo/ref|head. | ||
10 | It is a little bit too much to scan all the folders. | ||
11 | I can restrict the lookup to the repos associated with the user | ||
12 | and to files in the 'username' folder. | ||
13 | Or I can build a look-up table. Triggered by the finish of the | ||
14 | createrepo (closing the connection or creating a trigger file). | ||
15 | |||
16 | 0c. Shoud we still have a user repo? Think about private repos. | ||
17 | 0e. What about public/private? | ||
18 | You can map a private repository to a public pkg repo. | ||
19 | In this case, the source packages may not be available. | ||
20 | And the user should pay for the disk and bandwidth, | ||
21 | as with a private pkg repo. | ||
22 | |||
23 | 1b. Populate user repo | ||
24 | - Global repo must be built by a trusted worker! | ||
25 | 2. If worker is native, regenerate global repo in the same build VM. | ||
26 | Even if worker is native, the packages may not be trusted. | ||
27 | 3. If worker is private, only trigger the global repo rebuild. STOP. | ||
28 | 4. If a user or a repo is renamed, trigger the rebuild of the | ||
29 | affected repos. | ||
30 | 5. If a mapping changes, rebuild. | ||
31 | A lock should prevent parallel rebuilds. | ||
32 | If we do not have the same env as the priv worker, we just skip | ||
33 | the regeneration of the repo. Same if the branch is not | ||
34 | stable/testing. | ||
35 | |||
36 | - For private pkg_repos, the user may choose to not prepend hers | ||
37 | username? The real question is if we want to interfere with | ||
38 | the distro packages. Should we have two repositories? | ||
39 | I think it is ok to prepend. If a user wants to replace the distro | ||
40 | package with a personal one, the user will just remove the distro | ||
41 | one and install the rg one. Not so simple: other packages may depend | ||
42 | on the not-prepended name. | ||
43 | - What to do on the web? I should signal that the project has a | ||
44 | package/repo. | ||
45 | - Describe on the repo home how to install the package. | ||
46 | - When adding commands to the webhook, should I ask a default command | ||
47 | to build the packages for the repo? To allow using to select | ||
48 | "abort on fail" on previous command or even disable the repo building? | ||
49 | - When a git 'delete' is taking place, we should remove the packages. | ||
50 | - What to do with user installing packages from rocketgit pkg repo | ||
51 | or from other untrusted source? Mount fs with nosuid? Other things? | ||
52 | Do not forget that the rpm installer is running as root. | ||
53 | - When we update pkg_[sub]repos tables (and version is increased), | ||
54 | we should trigger the rebuild of the pkg repo package. | ||
55 | |||
56 | [ ] What about private repos? | ||
57 | What if a user wants to share a private repo with somebody else? | ||
58 | [ ] Do a test/demo also with python rpm generated. | ||
59 | [ ] rpm: num-deltas must be configurable. | ||
60 | [ ] There are other means a rpm is generated: for example, python packages. | ||
61 | Right now I only check for the spec file. How to deal with them? | ||
62 | Skip the rpm generation and go streight to signing/createrepo? | ||
63 | [ ] Should we rename the packages in the global repository to prepend the username? | ||
64 | [ ] .repo doc: https://www.man7.org/linux/man-pages/man5/dnf.conf.5.html | ||
65 | [ ] We may want to use username=/password= for private repositories. | ||
66 | [ ] Seems nginx is closing the connection after a timeout. Prevent it. (proxy_read_timeout) | ||
67 | [ ] Report how many bytes were transfered. Tax them? | ||
68 | [ ] Use xz for createrepo compression? | ||
69 | [ ] 'src' rpm folders should be shared by all compatible environments. | ||
70 | [ ] Should we let the user choose what (binary/debug/source) | ||
71 | packages should be added to a repo? | ||
72 | [ ] We should limit the number of old rpms for a repo? | ||
73 | We should let the user control that (think disk space). | ||
74 | [ ] Seems delta rpms are not cleaned! Bad! | ||
75 | [ ] zchunk: dnf sends HTTP_RANGE. We should respect it! | ||
76 | [ ] Do the disk accounting for packages. | ||
77 | [ ] Do the bandwidth accounting for packages. | ||
78 | [ ] Test with python rpms. There I think we do not have a spec file! | ||
79 | Maybe search first for rpm and then for .spec? | ||
80 | [ ] |
File scripts/worker.TODO changed (mode: 100644) (index 5d062ee..84602e7) | |||
1 | [ ] Scenario: | ||
2 | repo_uid pkg_repo_uid job_uid Results | ||
3 | A A A allow_any_write | ||
4 | A G B | ||
5 | * A A allow_any_write | ||
6 | |||
7 | A A B allow_username=B | ||
8 | A B B allow_any_write | ||
9 | dotrepo G B allow_username=B | ||
10 | dotrepo B B allow_any_write | ||
11 | |||
12 | Can job_uid B + pkg_repo_uid A can overwrite pkgs in A? | ||
13 | But, if he can write in A, we should allow overwrite, right? | ||
14 | |||
15 | |||
16 | repo uid A, pkg repo uid G, job uid B => allow_username = A | ||
17 | [ ] Even if a rgfs is uid 0, we should not allow escaping from pkg_repos dir + distro + major + arch! | ||
18 | Really? Yes, we do not want an external worker to take over the server. | ||
19 | But, should uid0 jobs be sent to an external party? Not! We would leak the rgfs key! Check this! | ||
20 | [ ] If it is a private repo, we should allow all operations. | ||
21 | The problem is that we have the cases: | ||
22 | - building pkg as a user | ||
23 | - user A is the owner, user B is pushing | ||
24 | - user pkg repo w=[catab/*][.?repodata/*][drpms/*] | ||
25 | pkg_repo_id=12 pkg_subrepo_id=5 uid=846 repo_id=1190(ci1) | ||
26 | head=aaa... job_username=catab repo_uid=846 pkg_repo_uid=846 | ||
27 | repo_username=catab => allow_username=catab | ||
28 | - if uid == pkg_repo[uid] => allow_create_repo=1 allow_username=catab | ||
29 | - global pkg repo w=[+pending/catab/.*] {2350} {j892} | ||
30 | pkg_repo_id=1 pkg_subrepo_id=1 uid=846 repo_id=3627(ci2) | ||
31 | head=aaa... job_username=catab repo_uid=846 | ||
32 | {trigger 'regenerate'} | ||
33 | - building pkg as uid0 [moving from pending to username dir + createrepo] w=[] {2389} {j892} | ||
34 | pkg_subrepo_id=1 pkg_repo_id=1 uid=0 head=aaa... repo_id=1190 | ||
35 | pkg_repo_uid=0 repo_uid=846 repo_username=catab | ||
36 | allow_username=catab | ||
37 | - uid is 0 => we allow any write | ||
38 | - building a dotrepo package/repo w=[] {we enforce a global worker} | ||
39 | {But, if we allow a user to build a malformed rpm, why don't we allow a malformed dotrepo?} | ||
40 | - global pkg repo | ||
41 | repo_id= uid=0 pkg_repo_id=1 pkg_subrepo_id=1 head= | ||
42 | - we set allow_any_write=1 | ||
43 | - user pkg repo | ||
44 | repo_id= uid=846 pkg_subrepo_id=9 pkg_repo_id=25 head= job_username=catab pkg_repo_uid=846 | ||
45 | - we set: allow_any_write=1 | ||
46 | |||
47 | - TODO: we may want to store into the meta/info.json, what was the last | ||
48 | job building the repo and when and what builder etc. | ||
49 | |||
50 | |||
51 | === Schematic for build_repo.sh script from worker.php === | ||
52 | |||
53 | if (exec_scan_for_packages) | ||
54 | locate packages (.rpm, .deb) | ||
55 | exit if not found | ||
56 | for every pkg_repo_id | ||
57 | copy packages to "rpms/{pkg_repo_id}/{i}" | ||
58 | for every pkg_repo_id | ||
59 | create pkg_list_file | ||
60 | sign {pkg_repo_id} ${dir} {pkg_list_file} | ||
61 | for every mapping | ||
62 | mount rgfs | ||
63 | if (exec_move_pending) | ||
64 | TODO: we need to sign the packages | ||
65 | if (exec_copy_to_rgfs) | ||
66 | copy from "rpms/{pkg_repo_id} to rgfs | ||
67 | if (exec_createrepo) | ||
68 | create_repo | ||
69 | umount | ||
70 | |||
71 | === end === | ||
72 | |||
73 | [ ] When a job fails, after worker reconnects, something is not happening and | ||
74 | the /var/lib/rocketgit/worker/rocketgit-j-NR is not remoed. | ||
75 | [ ] Howdo I do the link between xchan and job? | ||
76 | [ ] When a user is building his own repo, we do not need a <username> dir! | ||
77 | [ ] When we move to '+pending', we need to be sure we do not use a partial | ||
78 | written file (by other VM)! | ||
79 | [ ] For sure we need to prevent rebuild global repos in parallel! | ||
80 | [ ] When sending DON command to the server, we need to provide a status code! | ||
81 | For example, if the helper started with an error, we switch to state | ||
82 | DONE, but we need to signal the error somehow. | ||
83 | [ ] An error of the build/rpms etc. seems I do not signal this back to the builder. | ||
84 | [ ] I need to take the environment into account. | ||
85 | [ ] | ||
86 | |||
1 | 87 | [ ] Switch to pools of workers and dynamically attach disks. | [ ] Switch to pools of workers and dynamically attach disks. |
2 | 88 | <disk type="block" device="disk"> | <disk type="block" device="disk"> |
3 | 89 | <driver name="qemu" type="raw" cache="none" io="native" iothread="2"/> | <driver name="qemu" type="raw" cache="none" io="native" iothread="2"/> |
42 | 128 | [ ] Upload some meta info about artifacts (branch, tag, start etc.). | [ ] Upload some meta info about artifacts (branch, tag, start etc.). |
43 | 129 | [ ] Somehow, we need to inform the server the total size of the artifacts. | [ ] Somehow, we need to inform the server the total size of the artifacts. |
44 | 130 | This way we can have some progress bar. | This way we can have some progress bar. |
131 | [ ] We do not want to abort all repo build if one mapping is failing. | ||
132 | [ ] Auto-extend the disk if is close to full? | ||
133 | [ ] We may have a permanent machine which just rebuilds the subrepos. | ||
134 | [ ] We must let the user restrict the architectures and major and arch! | ||
135 | [ ] We must prevent a parallel schedule of a pkg_subrepo. | ||
45 | 136 | [ ] | [ ] |
File scripts/worker.php changed (mode: 100644) (index e5822e9..e23d3ae) | |||
... | ... | define('RG_JOB_COLLECT_INFO', 30); | |
16 | 16 | ||
17 | 17 | $_s = microtime(TRUE); | $_s = microtime(TRUE); |
18 | 18 | ||
19 | $INC = dirname(__FILE__) . "/../inc"; | ||
20 | require_once($INC . "/init.inc.php"); | ||
21 | require_once($INC . "/log.inc.php"); | ||
22 | require_once($INC . "/prof.inc.php"); | ||
23 | require_once($INC . "/builder.inc.php"); | ||
24 | require_once($INC . "/conn.inc.php"); | ||
19 | require_once(__DIR__ . '/../inc/init.inc.php'); | ||
20 | require_once(__DIR__ . '/../inc/log.inc.php'); | ||
21 | require_once(__DIR__ . '/../inc/prof.inc.php'); | ||
22 | require_once(__DIR__ . '/../inc/builder.inc.php'); | ||
23 | require_once(__DIR__ . '/../inc/conn.inc.php'); | ||
24 | require_once(__DIR__ . '/../inc/user/packages_rpm.inc.php'); | ||
25 | 25 | ||
26 | 26 | rg_prof_start('MAIN'); | rg_prof_start('MAIN'); |
27 | 27 | ||
... | ... | function load_config($file) | |
184 | 184 | } | } |
185 | 185 | ||
186 | 186 | if (!file_exists($conf['state'] . '/key.pub')) { | if (!file_exists($conf['state'] . '/key.pub')) { |
187 | rg_log('Creating SSH key...'); | ||
187 | rg_log('Creating SSH key'); | ||
188 | 188 | $cmd = 'ssh-keygen -t rsa -b 4096 -N \'\'' | $cmd = 'ssh-keygen -t rsa -b 4096 -N \'\'' |
189 | 189 | . ' -C \'Key to connect to builder\'' | . ' -C \'Key to connect to builder\'' |
190 | 190 | . ' -f ' . escapeshellarg($conf['state'] . '/key'); | . ' -f ' . escapeshellarg($conf['state'] . '/key'); |
... | ... | function load_config($file) | |
252 | 252 | if (!isset($i['pkg_cmd'])) { | if (!isset($i['pkg_cmd'])) { |
253 | 253 | $x = explode('-', $name, 3); $x = $x[0]; $y = isset($x[1]) ? $x[1] : ''; | $x = explode('-', $name, 3); $x = $x[0]; $y = isset($x[1]) ? $x[1] : ''; |
254 | 254 | if ((strcasecmp($x, 'debian') == 0) || (strcasecmp($x, 'ubuntu') == 0)) { | if ((strcasecmp($x, 'debian') == 0) || (strcasecmp($x, 'ubuntu') == 0)) { |
255 | $i['pkg_cmd'] = 'apt --assume-yes --ignore-hold --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confnew install'; | ||
255 | $i['pkg_cmd'] = 'apt --assume-yes --ignore-hold' | ||
256 | . ' --allow-downgrades --allow-remove-essential' | ||
257 | . ' --allow-change-held-packages' | ||
258 | . ' -o Dpkg::Options::=--force-confnew install'; | ||
256 | 259 | } else if (strcasecmp($x, 'fedora') == 0) { | } else if (strcasecmp($x, 'fedora') == 0) { |
257 | 260 | $i['pkg_cmd'] = 'dnf -y install'; | $i['pkg_cmd'] = 'dnf -y install'; |
258 | 261 | } else if (strcasecmp($x, 'centos') == 0) { | } else if (strcasecmp($x, 'centos') == 0) { |
... | ... | function load_config($file) | |
286 | 289 | if (!isset($conf['libvirtd_group'])) | if (!isset($conf['libvirtd_group'])) |
287 | 290 | $conf['libvirtd_group'] = 'qemu'; | $conf['libvirtd_group'] = 'qemu'; |
288 | 291 | ||
289 | rg_log_ml('conf: ' . print_r($conf, TRUE)); | ||
292 | rg_log_ml('conf: ' . rg_array2string($conf)); | ||
290 | 293 | } | } |
291 | 294 | ||
292 | 295 | /* | /* |
... | ... | function save_job(&$job) | |
303 | 306 | break; | break; |
304 | 307 | } | } |
305 | 308 | ||
306 | rg_log($job['id'] . ': DEBUG: saving job...'); | ||
309 | rg_log($job['id'] . ': DEBUG: saving job'); | ||
307 | 310 | $f = $conf['state'] . '/job-' . $job['id'] . '.ser'; | $f = $conf['state'] . '/job-' . $job['id'] . '.ser'; |
308 | 311 | $r = rg_save($f, $job); | $r = rg_save($f, $job); |
309 | 312 | if ($r === FALSE) { | if ($r === FALSE) { |
... | ... | function start_worker($job) | |
549 | 552 | . ' >>/mnt/status/RG_LABELS' . "\n"; | . ' >>/mnt/status/RG_LABELS' . "\n"; |
550 | 553 | ||
551 | 554 | $s .= 'date +%s > ' . $prefix . '.start' . "\n" | $s .= 'date +%s > ' . $prefix . '.start' . "\n" |
552 | . 'echo "Executing [' . $i['cmd'] . ']..."' . "\n" | ||
555 | . 'echo "Executing [' . $i['cmd'] . ']"' . "\n" | ||
553 | 556 | . '(' . $i['cmd'] . ') &>' . $prefix . '.log' . "\n" | . '(' . $i['cmd'] . ') &>' . $prefix . '.log' . "\n" |
554 | 557 | . 'E=${?}' . "\n" | . 'E=${?}' . "\n" |
555 | 558 | . 'echo ${E} > ' . $prefix . ".status\n" | . 'echo ${E} > ' . $prefix . ".status\n" |
556 | 559 | . 'date +%s > ' . $prefix . '.done' . "\n" | . 'date +%s > ' . $prefix . '.done' . "\n" |
557 | 560 | . 'if [ "${E}" != "0" ]; then' . "\n" | . 'if [ "${E}" != "0" ]; then' . "\n" |
558 | 561 | . $lnok | . $lnok |
559 | . ($i['abort'] ? ' exit 0' . "\n" : '') | ||
562 | . ($i['abort'] ? ' exit 1' . "\n" : '') | ||
560 | 563 | . 'else' . "\n" | . 'else' . "\n" |
561 | 564 | . $lok | . $lok |
562 | 565 | . 'fi' . "\n\n"; | . 'fi' . "\n\n"; |
... | ... | function xhandle_one($key, $data) | |
754 | 757 | } | } |
755 | 758 | ||
756 | 759 | if (strcmp($op, 'FEATURES') == 0) { // what master suports | if (strcmp($op, 'FEATURES') == 0) { // what master suports |
757 | rg_log_ml($key . ': FEATURES command: ' . print_r($u, TRUE)); | ||
760 | rg_log_ml($key . ': FEATURES command: ' . rg_array2string($u)); | ||
758 | 761 | $features = $u['features']; | $features = $u['features']; |
759 | 762 | return; | return; |
760 | 763 | } | } |
... | ... | function xhandle_one($key, $data) | |
798 | 801 | return; | return; |
799 | 802 | } | } |
800 | 803 | ||
801 | rg_log_ml($key . ': ' . $jid . ': DEBUG: DRE u: ' . print_r($u, TRUE)); | ||
804 | rg_log_ml($key . ': ' . $jid . ': DEBUG: DRE u: ' . rg_array2string($u)); | ||
802 | 805 | // So, we can clean up everything related to this job | // So, we can clean up everything related to this job |
803 | 806 | // TODO: do we clear the state file? | // TODO: do we clear the state file? |
804 | 807 | // TODO: clear artifacts stuff? | // TODO: clear artifacts stuff? |
... | ... | function xhandle_one($key, $data) | |
819 | 822 | $aid = isset($u['aid']) ? $u['aid'] : 0; | $aid = isset($u['aid']) ? $u['aid'] : 0; |
820 | 823 | ||
821 | 824 | if (strcmp($op, 'artifact_upload_info') == 0) { | if (strcmp($op, 'artifact_upload_info') == 0) { |
822 | rg_log_ml($key . ': ' . $jid . ': UPLOAD INFO u: ' . print_r($u, TRUE)); | ||
825 | rg_log_ml($key . ': ' . $jid . ': UPLOAD INFO u: ' . rg_array2string($u)); | ||
823 | 826 | $job['info_confirmed'] = 1; | $job['info_confirmed'] = 1; |
824 | 827 | } else if (strcmp($op, 'artifact_upload_chunk') == 0) { | } else if (strcmp($op, 'artifact_upload_chunk') == 0) { |
825 | rg_log_ml($key . ': ' . $jid . ': UPLOAD CHUNK u: ' . print_r($u, TRUE)); | ||
828 | rg_log_ml($key . ': ' . $jid . ': UPLOAD CHUNK u: ' . rg_array2string($u)); | ||
826 | 829 | $job['artifacts_state'][$aid]['last_confirmed_pos'] = $u['next_pos']; | $job['artifacts_state'][$aid]['last_confirmed_pos'] = $u['next_pos']; |
827 | 830 | $job['dirty'] = 1; | $job['dirty'] = 1; |
828 | 831 | } else if (strcmp($op, 'artifact_upload_done') == 0) { | } else if (strcmp($op, 'artifact_upload_done') == 0) { |
829 | rg_log_ml($key . ': ' . $jid . ': UPLOAD DONE u: ' . print_r($u, TRUE)); | ||
832 | rg_log_ml($key . ': ' . $jid . ': UPLOAD DONE u: ' . rg_array2string($u)); | ||
830 | 833 | $job['artifacts_state'][$aid]['done'] = time(); | $job['artifacts_state'][$aid]['done'] = time(); |
831 | 834 | $job['dirty'] = 1; | $job['dirty'] = 1; |
832 | 835 | } else if (strcmp($op, 'artifact_upload_status') == 0) { | } else if (strcmp($op, 'artifact_upload_status') == 0) { |
833 | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': UPLOAD STATUS u: ' . print_r($u, TRUE)); | ||
836 | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': UPLOAD STATUS u: ' . rg_array2string($u)); | ||
834 | 837 | if ($u['status'] == 1) { | if ($u['status'] == 1) { |
835 | 838 | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': server has the aid'); | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': server has the aid'); |
836 | 839 | $job['artifacts_state'][$aid]['done'] = time(); | $job['artifacts_state'][$aid]['done'] = time(); |
... | ... | function xhandle_one($key, $data) | |
848 | 851 | } | } |
849 | 852 | $job['artifacts_state'][$aid]['wait_status'] = 0; | $job['artifacts_state'][$aid]['wait_status'] = 0; |
850 | 853 | } else { | } else { |
851 | rg_log_ml($key . ': cannot handle op: ' . $u['op'] . ': ' . print_r($u, TRUE)); | ||
854 | rg_log_ml($key . ': cannot handle op: ' . $u['op'] . ': ' . rg_array2string($u)); | ||
852 | 855 | } | } |
853 | 856 | ||
854 | 857 | unset($jobs); | unset($jobs); |
... | ... | function rg_job_artifacts_parse($root, $a) | |
908 | 911 | // we have an option for the previous declared file | // we have an option for the previous declared file |
909 | 912 | if ($next_aid == 0) { | if ($next_aid == 0) { |
910 | 913 | $ret['errors'][] = 'line ' . $line_no | $ret['errors'][] = 'line ' . $line_no |
911 | . ': we have an option without a file' | ||
914 | . ': we have an option without a file/dir' | ||
912 | 915 | . ' defined first; ignore it'; | . ' defined first; ignore it'; |
913 | 916 | continue; | continue; |
914 | 917 | } | } |
915 | 918 | ||
916 | $line = trim($line); | ||
917 | 919 | $x = explode('=', $line, 2); | $x = explode('=', $line, 2); |
918 | 920 | if (!isset($x[1])) { | if (!isset($x[1])) { |
919 | 921 | $ret['errors'][] = 'line ' . $line_no . ': no = found'; | $ret['errors'][] = 'line ' . $line_no . ': no = found'; |
... | ... | function rg_job_artifacts_parse($root, $a) | |
951 | 953 | if (strcmp($_i['path'], $line) != 0) | if (strcmp($_i['path'], $line) != 0) |
952 | 954 | continue; | continue; |
953 | 955 | ||
954 | rg_log('DEBUG: file ' . $_aid . ' is sent again'); | ||
956 | rg_log(' DEBUG: file ' . $_aid . ' is sent again'); | ||
955 | 957 | $aid = $_aid; | $aid = $_aid; |
956 | 958 | $list[$_aid]['para_i']++; | $list[$_aid]['para_i']++; |
957 | 959 | $found = TRUE; | $found = TRUE; |
... | ... | function rg_job_artifacts_parse($root, $a) | |
969 | 971 | 'para_i' => 0 | 'para_i' => 0 |
970 | 972 | ); | ); |
971 | 973 | $aid = $next_aid; | $aid = $next_aid; |
974 | rg_log(' DEBUG: allocated aid ' . $aid); | ||
972 | 975 | } | } |
976 | //rg_log_ml('DEBUG: list: ' . rg_array2string($list)); | ||
973 | 977 | ||
974 | 978 | // Now, it is time to filter the list of files, if needed | // Now, it is time to filter the list of files, if needed |
975 | 979 | $i = 0; | $i = 0; |
... | ... | function rg_job_artifacts_parse($root, $a) | |
977 | 981 | unset($per_aid['para_i']); | unset($per_aid['para_i']); |
978 | 982 | ||
979 | 983 | if (empty($per_aid['para'])) { | if (empty($per_aid['para'])) { |
980 | rg_log('DEBUG: empty para, ignore entry!'); | ||
984 | rg_log('DEBUG: empty para, ignore entry [' . $per_aid['path'] . ']!'); | ||
981 | 985 | unset($list[$aid]); | unset($list[$aid]); |
982 | 986 | continue; | continue; |
983 | 987 | } | } |
... | ... | function rg_job_artifacts_parse($root, $a) | |
1045 | 1049 | $x['size'] = $r['size']; | $x['size'] = $r['size']; |
1046 | 1050 | $ret['total_size'] += $r['size']; | $ret['total_size'] += $r['size']; |
1047 | 1051 | $ret['files'][$i++] = $x; | $ret['files'][$i++] = $x; |
1048 | rg_log('DEBUG: f=' . $f . ' matches ' . $per_para['regex']); | ||
1052 | rg_log(' DEBUG: f=' . $f . ' matches ' . $per_para['regex']); | ||
1049 | 1053 | } | } |
1050 | 1054 | } | } |
1051 | 1055 | } | } |
... | ... | function rg_job_artifacts_parse($root, $a) | |
1056 | 1060 | break; | break; |
1057 | 1061 | } | } |
1058 | 1062 | ||
1059 | rg_log_ml('artifacts parsed: ' . print_r($ret, TRUE)); | ||
1063 | rg_log_ml('artifacts parsed: ' . rg_array2string($ret)); | ||
1060 | 1064 | return $ret; | return $ret; |
1061 | 1065 | } | } |
1062 | 1066 | ||
... | ... | function rg_job_upload_artifacts(&$job) | |
1157 | 1161 | if (isset($job['artifacts_state'][$aid]['local_done'])) | if (isset($job['artifacts_state'][$aid]['local_done'])) |
1158 | 1162 | continue; | continue; |
1159 | 1163 | ||
1160 | rg_log($jid . ':' . $aid . ': DEBUG: Sending path [' . $path . ']...'); | ||
1164 | rg_log($jid . ':' . $aid . ': DEBUG: Sending path [' . $path . ']'); | ||
1161 | 1165 | $job['dirty'] = 1; // for sure we will change things | $job['dirty'] = 1; // for sure we will change things |
1162 | 1166 | if ($job['artifacts_state'][$aid]['in_progress'] == 0) { | if ($job['artifacts_state'][$aid]['in_progress'] == 0) { |
1163 | rg_log($jid . ':' . $aid . ': DEBUG: Preparing the uploading of file [' . $path . ']...'); | ||
1167 | rg_log($jid . ':' . $aid . ': DEBUG: Preparing the uploading of file [' . $path . ']'); | ||
1164 | 1168 | ||
1165 | 1169 | $x = array(); | $x = array(); |
1166 | 1170 | $x['op'] = 'artifact_upload_start'; | $x['op'] = 'artifact_upload_start'; |
... | ... | function rg_job_upload_artifacts(&$job) | |
1188 | 1192 | } | } |
1189 | 1193 | ||
1190 | 1194 | //rg_log($jid . ':' . $aid . ': DEBUG: seeking to pos' | //rg_log($jid . ':' . $aid . ': DEBUG: seeking to pos' |
1191 | // . $job['artifacts_state'][$aid]['pos'] . '...'); | ||
1195 | // . $job['artifacts_state'][$aid]['pos']); | ||
1192 | 1196 | $r = @fseek($fd, $job['artifacts_state'][$aid]['pos'], SEEK_SET); | $r = @fseek($fd, $job['artifacts_state'][$aid]['pos'], SEEK_SET); |
1193 | 1197 | if ($r === -1) { | if ($r === -1) { |
1194 | 1198 | rg_log($jid . ':' . $aid . ': DEBUG: Cannot seek: ' . rg_php_err()); | rg_log($jid . ':' . $aid . ': DEBUG: Cannot seek: ' . rg_php_err()); |
... | ... | function rg_job_upload_artifacts(&$job) | |
1235 | 1239 | if (!$all_done) | if (!$all_done) |
1236 | 1240 | return FALSE; | return FALSE; |
1237 | 1241 | ||
1238 | // TODO: we have a variable in $job and a file! We should not have both! TODO | ||
1242 | // TODO: we have a variable in $job and a file! We should not have both! | ||
1239 | 1243 | rg_log('Done uploading artifacts! Switching to state FINISH.'); | rg_log('Done uploading artifacts! Switching to state FINISH.'); |
1240 | 1244 | $job['state'] = RG_JOB_FINISH; | $job['state'] = RG_JOB_FINISH; |
1241 | 1245 | $job['dirty'] = 1; | $job['dirty'] = 1; |
... | ... | function rg_job_extract_info(&$job) | |
1252 | 1256 | { | { |
1253 | 1257 | global $conf; | global $conf; |
1254 | 1258 | ||
1255 | rg_log_ml('DEBUG: extract_info: job: ' . print_r($job, TRUE)); | ||
1259 | rg_log_ml('DEBUG: extract_info: job: ' . rg_array2string($job)); | ||
1256 | 1260 | ||
1257 | 1261 | $jid = $job['id']; | $jid = $job['id']; |
1258 | 1262 | $emain = escapeshellarg($job['main']); | $emain = escapeshellarg($job['main']); |
... | ... | function rg_job_extract_info(&$job) | |
1277 | 1281 | if ($r !== FALSE) { | if ($r !== FALSE) { |
1278 | 1282 | if (!empty($r)) | if (!empty($r)) |
1279 | 1283 | rg_log('error set from file to [' . $r . ']'); | rg_log('error set from file to [' . $r . ']'); |
1280 | $job['error'] = $r; | ||
1284 | $job['error'] = trim($r); | ||
1281 | 1285 | break; | break; |
1282 | 1286 | } | } |
1283 | 1287 | ||
... | ... | function rg_job_extract_info(&$job) | |
1285 | 1289 | if ($r !== FALSE) { | if ($r !== FALSE) { |
1286 | 1290 | if (!empty($r)) | if (!empty($r)) |
1287 | 1291 | rg_log('error2 set from file to [' . $r . ']'); | rg_log('error2 set from file to [' . $r . ']'); |
1288 | $job['error2'] = $r; | ||
1292 | $job['error2'] = trim($r); | ||
1289 | 1293 | break; | break; |
1290 | 1294 | } | } |
1291 | 1295 | ||
... | ... | function rg_job_extract_info(&$job) | |
1301 | 1305 | } | } |
1302 | 1306 | $job['status']['disk_used_mib'] = intval($r['blocks'] / 2 / 1024); | $job['status']['disk_used_mib'] = intval($r['blocks'] / 2 / 1024); |
1303 | 1307 | // TODO - remove this | // TODO - remove this |
1304 | $cmd = 'ln -f ' . $emain . '/image2.raw ' . $emain . '/..'; | ||
1308 | $cmd = 'ln -f ' . $emain . '/image2.raw ' . $emain . '/../image2-' . $jid . '.raw'; | ||
1305 | 1309 | $r = rg_exec($cmd, '', FALSE, FALSE, FALSE); | $r = rg_exec($cmd, '', FALSE, FALSE, FALSE); |
1306 | 1310 | // TODO - remove this | // TODO - remove this |
1307 | 1311 | $cmd = 'ln -f ' . $emain . '/machine.xml ' . $emain . '/..'; | $cmd = 'ln -f ' . $emain . '/machine.xml ' . $emain . '/..'; |
... | ... | function rg_job_extract_info(&$job) | |
1320 | 1324 | ||
1321 | 1325 | $r = @file_get_contents($job['main'] . '/root/status/err'); | $r = @file_get_contents($job['main'] . '/root/status/err'); |
1322 | 1326 | if ($r !== FALSE) | if ($r !== FALSE) |
1323 | $job['error'] = $r; | ||
1327 | $job['error'] = trim($r); | ||
1324 | 1328 | ||
1325 | 1329 | $labels = @file($job['main'] . '/root/status/RG_LABELS'); | $labels = @file($job['main'] . '/root/status/RG_LABELS'); |
1326 | 1330 | if ($labels === FALSE) | if ($labels === FALSE) |
... | ... | function vm_extract_info($name) | |
1403 | 1407 | break; | break; |
1404 | 1408 | } | } |
1405 | 1409 | ||
1406 | //rg_log_ml('DEBUG: domstats: ' . print_r($r['data'], TRUE)); | ||
1410 | //rg_log_ml('DEBUG: domstats: ' . rg_array2string($r['data'])); | ||
1407 | 1411 | $data = array(); | $data = array(); |
1408 | 1412 | $t = explode("\n", $r['data']); | $t = explode("\n", $r['data']); |
1409 | 1413 | foreach ($t as $line) { | foreach ($t as $line) { |
... | ... | function rg_worker_connect() | |
1473 | 1477 | ||
1474 | 1478 | rg_log('Connecting to ' . $conf['master_host'] . '/' . $conf['master_port'] | rg_log('Connecting to ' . $conf['master_host'] . '/' . $conf['master_port'] |
1475 | 1479 | . ' with proto ' . $conf['master_proto'] | . ' with proto ' . $conf['master_proto'] |
1476 | . ' with url [' . $conf['master_url'] . ']' . '...'); | ||
1480 | . ' with url [' . $conf['master_url'] . ']'); | ||
1477 | 1481 | if (strcmp($conf['master_proto'], 'tcp') == 0) { | if (strcmp($conf['master_proto'], 'tcp') == 0) { |
1478 | 1482 | $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); | $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
1479 | 1483 | if ($socket === FALSE) { | if ($socket === FALSE) { |
... | ... | while(1) { | |
1608 | 1612 | $vms = rg_builder_vm_list(); | $vms = rg_builder_vm_list(); |
1609 | 1613 | if ($vms === FALSE) | if ($vms === FALSE) |
1610 | 1614 | break; | break; |
1611 | //rg_log_ml('vms: ' . print_r($vms, TRUE)); | ||
1615 | //rg_log_ml('vms: ' . rg_array2string($vms)); | ||
1612 | 1616 | ||
1613 | 1617 | $name = 'rg-worker-' . $conf['id'] . '-' . $jid; | $name = 'rg-worker-' . $conf['id'] . '-' . $jid; |
1614 | 1618 | ||
1615 | 1619 | while ($job['state'] == RG_JOB_INIT) { | while ($job['state'] == RG_JOB_INIT) { |
1620 | // TODO: how this could happen?! | ||
1616 | 1621 | $k = array_search($name, $vms); | $k = array_search($name, $vms); |
1617 | 1622 | if ($k !== FALSE) { | if ($k !== FALSE) { |
1618 | rg_log($jid . ': Switch to state STARTED'); | ||
1623 | rg_log($jid . ': Switch to state STARTED (from INIT)'); | ||
1619 | 1624 | $job['state'] = RG_JOB_STARTED; | $job['state'] = RG_JOB_STARTED; |
1620 | 1625 | $job['dirty'] = 1; | $job['dirty'] = 1; |
1621 | 1626 | save_job($job); | save_job($job); |
... | ... | while(1) { | |
1627 | 1632 | rg_log($jid . ': Cannot fork!'); | rg_log($jid . ': Cannot fork!'); |
1628 | 1633 | break; | break; |
1629 | 1634 | } | } |
1630 | if ($pid == 0) { // child | ||
1635 | if ($pid == 0) // child | ||
1631 | 1636 | start_worker($job); | start_worker($job); |
1632 | exit(0); | ||
1633 | } | ||
1634 | 1637 | ||
1635 | rg_log($jid . ': Started worker with pid ' . $pid); | ||
1638 | rg_log($jid . ': Started helper with pid ' . $pid); | ||
1636 | 1639 | $job['state'] = RG_JOB_HELPER_STARTED; | $job['state'] = RG_JOB_HELPER_STARTED; |
1637 | 1640 | $job['start'] = time(); | $job['start'] = time(); |
1638 | 1641 | $job['dirty'] = 1; | $job['dirty'] = 1; |
... | ... | while(1) { | |
1717 | 1720 | $job['dirty'] = 1; | $job['dirty'] = 1; |
1718 | 1721 | save_job($job); | save_job($job); |
1719 | 1722 | ||
1720 | //rg_log_ml($jid . ': DEBUG: job_extract_info: job: ' . print_r($job, TRUE)); | ||
1723 | //rg_log_ml($jid . ': DEBUG: job_extract_info: job: ' . rg_array2string($job)); | ||
1721 | 1724 | } | } |
1722 | 1725 | ||
1723 | 1726 | //rg_log($jid . ': DEBUG: state \'' . job_state($job['state']) . '\''); | //rg_log($jid . ': DEBUG: state \'' . job_state($job['state']) . '\''); |
... | ... | while(1) { | |
1730 | 1733 | if ($job['done_last_sent'] + 30 > time()) | if ($job['done_last_sent'] + 30 > time()) |
1731 | 1734 | continue; | continue; |
1732 | 1735 | ||
1733 | rg_log($jid . ': DEBUG: Sending DON command...'); | ||
1736 | rg_log($jid . ': DEBUG: Sending DON command'); | ||
1734 | 1737 | $xjob = $job; | $xjob = $job; |
1735 | 1738 | $xjob['op'] = 'DON'; | $xjob['op'] = 'DON'; |
1736 | 1739 | unset($xjob['debug']); | unset($xjob['debug']); |
File selinux/rocketgit.fc changed (mode: 100644) (index a476621..2aaeda0) | |||
17 | 17 | /usr/share/rocketgit/scripts(/.*)? -- gen_context(system_u:object_r:rocketgit_exec_t,s0) | /usr/share/rocketgit/scripts(/.*)? -- gen_context(system_u:object_r:rocketgit_exec_t,s0) |
18 | 18 | /usr/share/rocketgit/hooks(/.*)? -- gen_context(system_u:object_r:rocketgit_exec_t,s0) | /usr/share/rocketgit/hooks(/.*)? -- gen_context(system_u:object_r:rocketgit_exec_t,s0) |
19 | 19 | ||
20 | /usr/lib/systemd/system/rocketgit-fpm.service gen_context(system_u:object_r:rocketgit_unit_file_t,s0) | ||
20 | /usr/lib/systemd/system/rocketgit-.*.service gen_context(system_u:object_r:rocketgit_unit_file_t,s0) | ||
21 | 21 | ||
22 | 22 | /usr/sbin/rg_authorize -- gen_context(system_u:object_r:rocketgit_exec_t,s0) | /usr/sbin/rg_authorize -- gen_context(system_u:object_r:rocketgit_exec_t,s0) |
23 | 23 | /usr/sbin/rg_change_pass -- gen_context(system_u:object_r:rocketgit_exec_t,s0) | /usr/sbin/rg_change_pass -- gen_context(system_u:object_r:rocketgit_exec_t,s0) |
File techdocs/cache.txt changed (mode: 100644) (index e69f04c..2bde434) | |||
... | ... | state $var | |
4 | 4 | ||
5 | 5 | user $uid | user $uid |
6 | 6 | info | info |
7 | keys $key_id | ||
7 | keys $key_id | ||
8 | pkg_repos | ||
9 | pkg_subrepos | ||
8 | 10 | ||
9 | 11 | wh $uid | wh $uid |
10 | 12 | list | list |
File tests/_run_tests.sh changed (mode: 100755) (index 516b4ec..483d3e2) | |||
2 | 2 | ||
3 | 3 | . ./env.txt | . ./env.txt |
4 | 4 | ||
5 | tests="http_api http_304 ldap_core ldap \ | ||
5 | tests="pkg_subrepo pkg_rpm gpg http_api http_304 ldap_core ldap \ | ||
6 | 6 | admin_set_web git_big_push admin_set_git by_http wh_lambda http_keys \ | admin_set_web git_big_push admin_set_git by_http wh_lambda http_keys \ |
7 | 7 | http_forgot \ | http_forgot \ |
8 | 8 | api wh_cloud pr_anon wh_http ssh http_totp totp git_log1 \ | api wh_cloud pr_anon wh_http ssh http_totp totp git_log1 \ |
File tests/bug.php changed (mode: 100644) (index b2ac4e2..b7cdbe6) | |||
... | ... | if (count($r) == 0) { | |
106 | 106 | rg_sql_close($db); | rg_sql_close($db); |
107 | 107 | ||
108 | 108 | rg_log("OK!"); | rg_log("OK!"); |
109 | ?> |
File tests/cache.php changed (mode: 100644) (index 663c86d..b308608) | |||
... | ... | rg_cache_core_set("a::b::c", "1"); | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | rg_log(''); | rg_log(''); |
27 | rg_log('Testing core_get...'); | ||
27 | rg_log_enter('Testing core_get...'); | ||
28 | 28 | $e = "1"; | $e = "1"; |
29 | 29 | $r = rg_cache_core_get("a::b::c"); | $r = rg_cache_core_get("a::b::c"); |
30 | 30 | if ($r !== $e) { | if ($r !== $e) { |
... | ... | if ($r !== $e) { | |
32 | 32 | rg_log("[$r] != [$e]!"); | rg_log("[$r] != [$e]!"); |
33 | 33 | exit(1); | exit(1); |
34 | 34 | } | } |
35 | rg_log_exit(); | ||
36 | |||
35 | 37 | ||
36 | 38 | rg_log(''); | rg_log(''); |
37 | rg_log('Testing unset on a dir (not value)...'); | ||
39 | rg_log_enter('Testing unset on a dir (not value)...'); | ||
38 | 40 | rg_cache_core_unset("a::b"); | rg_cache_core_unset("a::b"); |
39 | 41 | $r = rg_cache_core_get('a'); | $r = rg_cache_core_get('a'); |
40 | 42 | if (!empty($r)) { | if (!empty($r)) { |
... | ... | if (!empty($r)) { | |
42 | 44 | rg_log("unsetting a dir is not working!"); | rg_log("unsetting a dir is not working!"); |
43 | 45 | exit(1); | exit(1); |
44 | 46 | } | } |
47 | rg_log_exit(); | ||
48 | |||
45 | 49 | ||
46 | 50 | rg_log(''); | rg_log(''); |
47 | rg_log('Getting an invalid var...'); | ||
51 | rg_log_enter('Getting an invalid var...'); | ||
48 | 52 | $e = FALSE; | $e = FALSE; |
49 | 53 | $r = rg_cache_core_get("x::y::z"); | $r = rg_cache_core_get("x::y::z"); |
50 | 54 | if ($r !== $e) { | if ($r !== $e) { |
... | ... | if ($r !== $e) { | |
52 | 56 | rg_log("r must be FALSE!"); | rg_log("r must be FALSE!"); |
53 | 57 | exit(1); | exit(1); |
54 | 58 | } | } |
59 | rg_log_exit(); | ||
60 | |||
55 | 61 | ||
56 | 62 | rg_log(''); | rg_log(''); |
57 | rg_log('Testing unsetting of an invalid var...'); | ||
63 | rg_log_enter('Testing unsetting of an invalid var...'); | ||
58 | 64 | rg_cache_core_unset("x::y::z"); | rg_cache_core_unset("x::y::z"); |
59 | 65 | $e = FALSE; | $e = FALSE; |
60 | 66 | $r = rg_cache_core_get("x::y::z"); | $r = rg_cache_core_get("x::y::z"); |
... | ... | if ($r !== $e) { | |
63 | 69 | rg_log("r must be FALSE ($r)!"); | rg_log("r must be FALSE ($r)!"); |
64 | 70 | exit(1); | exit(1); |
65 | 71 | } | } |
72 | rg_log_exit(); | ||
73 | |||
66 | 74 | ||
67 | 75 | ////////////////////////////////// Arrays | ////////////////////////////////// Arrays |
68 | 76 | ||
... | ... | if ($r !== $e) { | |
103 | 111 | } | } |
104 | 112 | ||
105 | 113 | ||
114 | // TODO: This test does not make sense anymore, because after sleep, | ||
115 | // we will get timeout and then the re-check is disabled for 5s. | ||
116 | // Probably it was used to test I= match. | ||
117 | /* | ||
106 | 118 | rg_log(''); | rg_log(''); |
107 | rg_log('Testing set/get with a small timeout'); | ||
108 | $rg_cache_timeout = 1; | ||
119 | rg_log_enter('Testing set/get with a small timeout'); | ||
120 | $rg_cache_timeout = 1; // 1ms | ||
109 | 121 | rg_cache_set('test::A', 'A', 0); | rg_cache_set('test::A', 'A', 0); |
110 | 122 | rg_cache_set('test::B', 'B', 0); | rg_cache_set('test::B', 'B', 0); |
111 | 123 | rg_cache_sleep(); | rg_cache_sleep(); |
112 | $rg_cache = array(); | ||
113 | rg_cache_get('test::B'); | ||
124 | $rg_cache = array(); // invalidate memory cache | ||
125 | rg_cache_get('test::B'); // this will timeout | ||
114 | 126 | $rg_cache_timeout = 6000; | $rg_cache_timeout = 6000; |
115 | 127 | $r = rg_cache_get('test::A'); | $r = rg_cache_get('test::A'); |
116 | 128 | if ($r !== 'A') { | if ($r !== 'A') { |
117 | 129 | rg_log('Small timeout test failed! r=' . print_r($r, TRUE)); | rg_log('Small timeout test failed! r=' . print_r($r, TRUE)); |
118 | 130 | exit(1); | exit(1); |
119 | 131 | } | } |
132 | rg_log_exit(); | ||
133 | */ | ||
120 | 134 | ||
121 | 135 | ||
122 | 136 | rg_log(''); | rg_log(''); |
123 | rg_log('Testing timeout'); | ||
137 | rg_log_enter('Testing timeout'); | ||
124 | 138 | $rg_cache_timeout = 1; | $rg_cache_timeout = 1; |
125 | 139 | rg_cache_sleep(); | rg_cache_sleep(); |
126 | 140 | $rg_cache = array(); | $rg_cache = array(); |
... | ... | if ($r !== FALSE) { | |
130 | 144 | rg_log('Timeout test failed! r=' . print_r($r, TRUE)); | rg_log('Timeout test failed! r=' . print_r($r, TRUE)); |
131 | 145 | exit(1); | exit(1); |
132 | 146 | } | } |
147 | rg_log_exit(); | ||
133 | 148 | ||
134 | 149 | ||
135 | 150 | rg_log(''); | rg_log(''); |
... | ... | if (strcmp($r, 'value') != 0) { | |
143 | 158 | } | } |
144 | 159 | rg_log_exit(); | rg_log_exit(); |
145 | 160 | ||
146 | rg_log("OK!"); | ||
147 | ?> | ||
161 | |||
162 | rg_log('OK!'); |
File tests/common.php changed (mode: 100644) (index eb72cf0..6f82cb5) | |||
1 | 1 | <?php | <?php |
2 | 2 | $INC = dirname(__FILE__) . "/../inc"; | $INC = dirname(__FILE__) . "/../inc"; |
3 | require_once($INC . "/cache.inc.php"); | ||
3 | 4 | require_once($INC . "/state.inc.php"); | require_once($INC . "/state.inc.php"); |
4 | 5 | require_once($INC . "/sql.inc.php"); | require_once($INC . "/sql.inc.php"); |
5 | 6 | require_once($INC . "/struct.inc.php"); | require_once($INC . "/struct.inc.php"); |
... | ... | require_once($INC . "/fixes.inc.php"); | |
7 | 8 | ||
8 | 9 | $rg_util_debug = TRUE; | $rg_util_debug = TRUE; |
9 | 10 | ||
11 | @mkdir(__DIR__ . '/tmp'); | ||
12 | |||
10 | 13 | rg_log('rg_event_socket: ' . $rg_event_socket); | rg_log('rg_event_socket: ' . $rg_event_socket); |
11 | 14 | ||
12 | 15 | rg_sql_app("rg-tests"); | rg_sql_app("rg-tests"); |
... | ... | if ($db === FALSE) { | |
17 | 20 | } | } |
18 | 21 | ||
19 | 22 | ||
23 | // For http testing | ||
24 | //$test_url = "http://rg.embedromix.ro:9000"; // apache | ||
25 | //$test_url = "http://rg.embedromix.ro:9002"; // nginx | ||
26 | //$test_url = "https://rg.embedromix.ro:9003"; // nginx TLS | ||
27 | rg_cache_core_set($db, 'state::hostname', 'rg.embedromix.ro'); | ||
28 | rg_cache_core_set($db, 'state::http_allow', '9002'); | ||
29 | rg_cache_core_set($db, 'state::https_allow', '9003'); | ||
30 | |||
31 | |||
20 | 32 | // Force debug by setting the settings | // Force debug by setting the settings |
21 | 33 | $r = rg_state_set($db, 'debug', '1'); | $r = rg_state_set($db, 'debug', '1'); |
22 | 34 | if ($r === FALSE) { | if ($r === FALSE) { |
File tests/config.php changed (mode: 100644) (index 51b6e98..226ca11) | |||
... | ... | $rg_ssh_port = 2222; | |
33 | 33 | $rg_git_host = 'localhost'; | $rg_git_host = 'localhost'; |
34 | 34 | $rg_git_port = 9418; | $rg_git_port = 9418; |
35 | 35 | ||
36 | // For http testing | ||
37 | //$test_url = "http://rg.embedromix.ro:9000"; // apache | ||
38 | $test_url = "http://rg.embedromix.ro:9002"; // nginx | ||
39 | //$test_url = "https://rg.embedromix.ro:9003"; // nginx TLS | ||
40 | |||
41 | $rg_base_url = $test_url; | ||
42 | 36 | ||
43 | 37 | $a = @file(__DIR__ . '/env.txt'); | $a = @file(__DIR__ . '/env.txt'); |
44 | 38 | foreach ($a as $line) { | foreach ($a as $line) { |
File tests/git.php changed (mode: 100644) (index cc0d9ab..b6b73f0) | |||
... | ... | $r = rg_exec('mkdir -p temp_repos && cd temp_repos' | |
192 | 192 | . ' && echo -e "c" > a' | . ' && echo -e "c" > a' |
193 | 193 | . ' && echo -e "cccc" > b' | . ' && echo -e "cccc" > b' |
194 | 194 | . ' && git commit -a -m "ccc"' | . ' && git commit -a -m "ccc"' |
195 | . ' && echo -e "\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx" > a' | ||
195 | . ' && echo -e "\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx" > a' | ||
196 | 196 | . ' && echo -e "dddd" > b' | . ' && echo -e "dddd" > b' |
197 | 197 | . ' && git commit -a -m "ddd"' | . ' && git commit -a -m "ddd"' |
198 | 198 | . ' && echo -e "e" > a' | . ' && echo -e "e" > a' |
... | ... | rg_log_exit(); | |
240 | 240 | ||
241 | 241 | ||
242 | 242 | rg_log('OK!'); | rg_log('OK!'); |
243 | ?> |
File tools/rg_authorize changed (mode: 100755) (index fd2988a..56b5bf1) | |||
... | ... | if ($db === FALSE) { | |
34 | 34 | exit(1); | exit(1); |
35 | 35 | } | } |
36 | 36 | ||
37 | if ($_SERVER['argc'] != 2) { | ||
37 | if ($_SERVER['argc'] < 2) { | ||
38 | 38 | rg_log('Invalid number of parameters (' . $_SERVER['argc'] . ')!'); | rg_log('Invalid number of parameters (' . $_SERVER['argc'] . ')!'); |
39 | 39 | rg_log_ml('argv: ' . print_r($_SERVER['argv'], TRUE)); | rg_log_ml('argv: ' . print_r($_SERVER['argv'], TRUE)); |
40 | 40 | exit(1); | exit(1); |
... | ... | foreach ($r['list'] as $i) { | |
76 | 76 | ||
77 | 77 | rg_prof_end('MAIN'); | rg_prof_end('MAIN'); |
78 | 78 | rg_prof_log(); | rg_prof_log(); |
79 | ?> |