mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-21 21:48:42 +00:00
feat(uoj/1/app): move data to the root when subfolder exists in the uploaded data zip
There is subfolder in the uploaded data archive file, we can now process it. We will move files in the subfolder out to the data rootdir of current problem. If you have some data archives with subfolder, don't need to repack them manually.
This commit is contained in:
parent
2e3817cabe
commit
2dc8e74fc1
@ -94,7 +94,7 @@ EOD;
|
||||
}
|
||||
unlink($up_filename);
|
||||
}else{
|
||||
$errmsg = "请上传zip文件!";
|
||||
$errmsg = "请上传zip格式!";
|
||||
becomeMsgPage('<div>' . $errmsg . '</div><a href="/problem/'.$problem['id'].'/manage/data">返回</a>');
|
||||
}
|
||||
}
|
||||
@ -780,9 +780,9 @@ EOD
|
||||
<div class="modal-body">
|
||||
<form action="" method="post" enctype="multipart/form-data" role="form">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputFile">文件</label>
|
||||
<label for="exampleInputFile">上传zip文件</label>
|
||||
<input type="file" name="problem_data_file" id="problem_data_file">
|
||||
<p class="help-block">请上传.zip文件</p>
|
||||
<p class="help-block">说明:请将所有数据放置于压缩包根目录内。若压缩包内存在子文件夹,则会将这些一级子文件夹下的内容移动到根目录下,然后这些一级子文件夹删除;若这些子文件夹内存在同名文件,则会发生随机替换,仅保留一个副本。</p>
|
||||
</div>
|
||||
<input type="hidden" name="problem_data_file_submit" value="submit">
|
||||
</div>
|
||||
|
@ -394,6 +394,10 @@ EOD
|
||||
else if($type=='data'){
|
||||
exec(
|
||||
<<<EOD
|
||||
cd $cur_dir/1
|
||||
for sub_dir in `find -maxdepth 1 -type d ! -name .`; do
|
||||
mv -f \$sub_dir/* . && rm -rf \$sub_dir
|
||||
done
|
||||
cd $cur_dir
|
||||
svn add * --username $svnusr --password $svnpwd
|
||||
svn commit -m "add testdata from zip file online." --username $svnusr --password $svnpwd
|
||||
|
Loading…
Reference in New Issue
Block a user