FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CDash/importBackup.php at master · billhoffman/CDash · GitHub
billhoffman
/
CDash
Public
forked from
Kitware/CDash
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
CDash
/
importBackup.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
122 lines (100 loc) · 2.93 KB
Breadcrumbs
CDash
/
importBackup.php
Copy path
File metadata and controls
122 lines (100 loc) · 2.93 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/*=========================================================================
Program: CDash - Cross-Platform Dashboard System
Module: $Id: buildOverview.php 1161 2008-09-19 14:56:14Z jjomier $
Language: PHP
Date: $Date: 2008-03-06 22:24:57 -0500 (Thu, 06 Mar 2008) $
Version: $Revision: 666 $
Copyright (c) 2002 Kitware, Inc. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
include
(
"
cdash/config.php
"
);
require_once
(
"
cdash/pdo.php
"
);
include
(
'
login.php
'
);
include
(
"
cdash/version.php
"
);
if
(
$
session_OK
)
{
include_once
(
'
cdash/common.php
'
);
include_once
(
"
cdash/ctestparser.php
"
);
set_time_limit
(
0
);
$
db
=
pdo_connect
(
"
$
CDASH_DB_HOST
"
,
"
$
CDASH_DB_LOGIN
"
,
"
$
CDASH_DB_PASS
"
);
pdo_select_db
(
"
$
CDASH_DB_NAME
"
,
$
db
);
checkUserPolicy
(@
$
_SESSION
[
'
cdash
'
][
'
loginid
'
],
0
);
// only admin
$
xml
=
begin_XML_for_XSLT
();
$
xml
.=
"
<title>CDash - Import Backups</title>
"
;
$
xml
.=
"
<menutitle>CDash</menutitle>
"
;
$
xml
.=
"
<menusubtitle>Backups</menusubtitle>
"
;
$
xml
.=
"
<backurl>manageBackup.php</backurl>
"
;
$
alert
=
""
;
@
$
Submit
=
$
_POST
[
"
Submit
"
];
@
$
filemask
=
$
_POST
[
"
filemask
"
];
if
(
$
filemask
==
''
)
{
$
filemask
=
"
*.xml
"
;
}
if
(
$
Submit
&&
$
filemask
)
{
$
filelist
=
glob
(
"
$
CDASH_BACKUP_DIRECTORY
/
$
filemask
"
);
$
i
=
0
;
$
n
=
count
(
$
filelist
);
add_log
(
"
before loop n=
"
.
$
n
,
"
importBackup.php
"
,
LOG_INFO
);
foreach
(
$
filelist
as
$
filename
)
{
++
$
i
;
$
projectid
= -
1
;
add_log
(
"
looping i=
"
.
$
i
.
"
filename=
"
.
$
filename
,
"
importBackup.php
"
,
LOG_INFO
);
# split on path separator
$
pathParts
=
split
(
"
[/
\\
]
"
,
$
filename
);
# split on cdash separator "_"
if
(
count
(
$
pathParts
)>=
1
)
{
$
cdashParts
=
split
(
"
[_]
"
,
$
pathParts
[
count
(
$
pathParts
)-
1
]);
$
projectid
=
get_project_id
(
$
cdashParts
[
0
]);
}
if
(
$
projectid
!= -
1
)
{
$
name
=
get_project_name
(
$
projectid
);
$
handle
=
fopen
(
$
filename
,
"
r
"
);
if
(
$
handle
)
{
ctest_parse
(
$
handle
,
$
projectid
);
fclose
(
$
handle
);
unset(
$
handle
);
}
else
{
add_log
(
"
could not open file filename=
"
.
$
filename
,
"
importBackup.php
"
,
LOG_ERR
);
}
}
else
{
add_log
(
"
could not determine projectid from filename=
"
.
$
filename
,
"
importBackup.php
"
,
LOG_ERR
);
}
}
add_log
(
"
after loop n=
"
.
$
n
,
"
importBackup.php
"
,
LOG_INFO
);
$
alert
=
'
Import backup complete.
'
.
$
i
.
'
files processed.
'
;
$
xml
.=
add_XML_value
(
"
alert
"
,
$
alert
);
}
// end submit
// Now doing the xslt transition
$
xml
.=
"
</cdash>
"
;
generate_XSLT
(
$
xml
,
"
importBackup
"
);
}
// end session
?>
Back
|
FazBrowse Home
|
New Git URL