Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
f61027e3
Commit
f61027e3
authored
Aug 12, 2008
by
dinesh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commiting uploaded for bzr
parent
4dc3994d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
26 deletions
+61
-26
web/configuration
web/configuration
+9
-2
web/db/ccan.db
web/db/ccan.db
+0
-0
web/uploader.php
web/uploader.php
+52
-24
No files found.
web/configuration
View file @
f61027e3
...
...
@@ -9,10 +9,10 @@ $repopath = "testrepo/";
$ccanlint
=
"tools/ccanlint -d "
;
//infotojson
$infotojson
=
"tools/infotojson "
;
$infotojson
=
"
../../
tools/infotojson "
;
//create tar of all dependencies
$create_dep_tar
=
"../tools/create_dep_tar "
;
$create_dep_tar
=
"../
../
tools/create_dep_tar "
;
//junk code
$junkcode
=
"junkcode/"
;
...
...
@@ -32,5 +32,12 @@ $frommail = "ccan@ozlabs.org";
//email for admins
$ccan_admin
=
"g.dinesh.cse@gmail.com"
;
//ccan home
$ccan_home_dir
=
"ccan/"
;
//bzr clone
$bzr_clone
=
'bzr clone /home/dinesh/testwebsite/ '
;
//bzr push
$bzr_push
=
'bzr push /home/dinesh/testwebsite/ '
;
?>
\ No newline at end of file
web/db/ccan.db
View file @
f61027e3
No preview for this file type
web/uploader.php
View file @
f61027e3
...
...
@@ -28,15 +28,7 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip"
else
{
exec
(
'tar -xf '
.
$tempfolder
.
$_FILES
[
"uploadedfile"
][
"name"
]
.
' -C '
.
$tempfolder
,
$op
,
$status
);
}
checkerror
(
$status
[
0
],
"Error: cannot extract(tar error)."
);
//chmod
exec
(
'chmod -R 0777 '
.
$tempfolder
.
$folder
,
$status
);
checkerror
(
$status
[
0
],
"Error: chmod execution error."
);
//running ccanlint
exec
(
$ccanlint
.
$tempfolder
.
$folder
,
$score
,
$status
);
//checkerror($status,"Error: ccanlint execution error.");
checkerror
(
$status
,
"Error: cannot extract(tar error)."
);
//if user not logged in
if
(
$_SESSION
[
"slogged"
]
==
false
)
{
...
...
@@ -48,8 +40,6 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip"
//send mail for review to admins
$subject
=
"Review: code upload at temporary repository"
;
$message
=
"Some developer has uploaded code who has not logged in.
\n\n
Module is stored in "
.
$temprepo
.
$folder
.
".
\n\n
Output of ccanlint:
\n
"
;
foreach
(
$score
as
$disp
)
$message
=
$message
.
$disp
.
"
\n
"
;
$toaddress
=
getccanadmin
(
$db
);
mail
(
$toaddress
,
$subject
,
$message
,
"From:
$frommail
"
);
...
...
@@ -58,45 +48,83 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip"
exit
();
}
//running ccanlint
exec
(
$ccanlint
.
$tempfolder
.
$folder
,
$score
,
$status
);
//if not junk code
if
(
$status
==
0
)
{
$rename
=
$folder
;
$exactpath
=
$repopath
.
$_SESSION
[
'susername'
]
.
'/'
;
if
(
file_exists
(
$exactpath
))
{
echo
"<div align=
\"
center
\"
> Your another upload is in progress please wait...</div>"
;
exit
();
}
//bzr local repo for commit
chdir
(
$repopath
);
unset
(
$op
);
exec
(
$bzr_clone
.
$_SESSION
[
'susername'
],
$op
,
$status
);
checkerror
(
$status
,
"Error: bzr local repo."
);
chdir
(
'..'
);
//if module already exist
if
(
file_exists
(
$repopath
.
$ccan_home_dir
.
$folder
))
{
if
(
file_exists
(
$exactpath
.
$ccan_home_dir
.
$folder
))
{
// if owner is not same
if
(
!
(
getowner
(
$
repopath
.
$ccan_home_dir
.
$folder
,
$db
)
==
$_SESSION
[
'susername'
]))
{
if
(
!
file_exists
(
$repopath
.
$ccan_home_dir
.
$folder
.
'-'
.
$_SESSION
[
'susername'
]))
echo
"<div align=
\"
center
\"
>"
.
$repopath
.
$ccan_home_dir
.
$folder
.
" already exists. Renaming to "
.
$folder
.
"-"
.
$_SESSION
[
'susername'
]
.
"</div>"
;
if
(
!
(
getowner
(
$
ccan_home_dir
.
$folder
,
$db
)
==
$_SESSION
[
'susername'
]))
{
if
(
!
file_exists
(
$repopath
.
$ccan_home_dir
.
$folder
.
'-'
.
$_SESSION
[
'susername'
]))
echo
"<div align=
\"
center
\"
>"
.
$ccan_home_dir
.
$folder
.
" already exists. Renaming to "
.
$folder
.
"-"
.
$_SESSION
[
'susername'
]
.
"</div>"
;
else
echo
"<div align=
\"
center
\"
>"
.
$repopath
.
$ccan_home_dir
.
$folder
.
"-"
.
$_SESSION
[
'susername'
]
.
" already exists. Overwriting "
.
$folder
.
"-"
.
$_SESSION
[
'susername'
]
.
"</div>"
;
echo
"<div align=
\"
center
\"
>"
.
$ccan_home_dir
.
$folder
.
"-"
.
$_SESSION
[
'susername'
]
.
" already exists. Overwriting "
.
$folder
.
"-"
.
$_SESSION
[
'susername'
]
.
"</div>"
;
$rename
=
$folder
.
"-"
.
$_SESSION
[
'susername'
];
}
else
echo
"<div align=
\"
center
\"
>"
.
$repopath
.
$ccan_home_dir
.
$folder
.
" already exists(uploaded by you). Overwriting "
.
$repopath
.
$folder
.
"</div>"
;
}
//module not exist. store author to db
else
{
storefileowner
(
$
repopath
.
$ccan_home_dir
.
$folder
,
$_SESSION
[
'susername'
],
$db
);
storefileowner
(
$
ccan_home_dir
.
$folder
,
$_SESSION
[
'susername'
],
$db
);
}
rmdirr
(
$repopath
.
$ccan_home_dir
.
$rename
);
rename
(
$tempfolder
.
$folder
,
$repopath
.
$ccan_home_dir
.
$rename
);
echo
"<div align=
\"
center
\"
> Stored to "
.
$repopath
.
$ccan_home_dir
.
$rename
.
"</div>"
;
exec
(
$infotojson
.
$repopath
.
$ccan_home_dir
.
$rename
.
"/_info.c "
.
$repopath
.
$ccan_home_dir
.
$rename
.
"/json_"
.
$rename
.
" "
.
$_SESSION
[
'susername'
]
.
" "
.
$db
,
$status
);
checkerror
(
$status
[
0
],
"Error: In infotojson."
);
//createsearchindex($rename, $repopath.$rename, $infofile, $db, $_SESSION['susername']);
rmdirr
(
$exactpath
.
$ccan_home_dir
.
$rename
);
rename
(
$tempfolder
.
$folder
,
$exactpath
.
$ccan_home_dir
.
$rename
);
chdir
(
$exactpath
);
unset
(
$op
);
exec
(
$infotojson
.
$ccan_home_dir
.
$rename
.
" "
.
$ccan_home_dir
.
$rename
.
"/_info.c "
.
$ccan_home_dir
.
$rename
.
"/json_"
.
$rename
.
" "
.
$_SESSION
[
'susername'
]
.
" ../../"
.
$db
,
$op
,
$status
);
checkerror
(
$status
,
"Error: In infotojson."
);
unset
(
$op
);
exec
(
'bzr add'
,
$op
,
$status
);
checkerror
(
$status
,
"Error: bzr add error."
);
unset
(
$op
);
exec
(
'bzr commit --unchanged -m "commiting from ccan web '
.
$rename
.
" "
.
$_SESSION
[
'susername'
]
.
'"'
,
$op
,
$status
);
checkerror
(
$status
,
"Error: bzr commit error."
);
unset
(
$op
);
exec
(
$bzr_push
,
$op
,
$status
);
checkerror
(
$status
,
"Error: bzr push error."
);
chdir
(
'../..'
);
rmdirr
(
$exactpath
);
echo
"<div align=
\"
center
\"
> Stored to "
.
$ccan_home_dir
.
$rename
.
"</div>"
;
}
//if junk code (no _info.c etc)
else
{
rmdirr
(
$junkcode
.
$folder
.
'-'
.
$_SESSION
[
'susername'
]);
rename
(
$tempfolder
.
$folder
,
$junkcode
.
$folder
.
'-'
.
$_SESSION
[
'susername'
]);
if
(
$score
==
''
)
$msg
=
'Below is details for test.'
;
echo
"<div align=
\"
center
\"
><table><tr><td> Score for code is low. Cannot copy to repository. Moving to "
.
$junkcode
.
$folder
.
'-'
.
$_SESSION
[
'susername'
]
.
"... </br></br>"
.
$msg
.
" </br></br></td></tr><tr><td>"
;
foreach
(
$score
as
$disp
)
echo
"
$disp
</br>"
;
echo
"</td></tr></table></div>"
;
}
unlink
(
$tempfolder
.
$_FILES
[
"uploadedfile"
][
"name"
]);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment