forked from Kitware/CDash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitinfo.php
85 lines (67 loc) · 1.95 KB
/
gitinfo.php
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
<?php
/*=========================================================================
Program: CDash - Cross-Platform Dashboard System
Module: $Id$
Language: PHP
Date: $Date$
Version: $Revision$
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.
=========================================================================*/
require_once('login.php');
function echo_svn_output($cmd)
{
// Assumes being able to run 'svn' on the web server in the CDash
// directory...
//
$svn_output = `git $cmd`;
echo '<h3>git ' . $cmd . '</h3>';
echo '<pre>';
echo htmlentities($svn_output);
echo '</pre>';
echo '<br/>';
}
function echo_file_contents($filename)
{
// Emit the contents of the named file, but only if it exists.
// If it doesn't exist, emit nothing.
//
if (file_exists($filename))
{
$contents = file_get_contents($filename);
echo '<h3>contents of "'.$filename.'"</h3>';
echo '<pre>';
echo htmlentities($contents);
echo '</pre>';
echo '<br/>';
}
}
if ($session_OK)
{
$userid = $_SESSION['cdash']['loginid'];
$user_is_admin = pdo_get_field_value(
"SELECT admin FROM " . qid("user") . " WHERE id='$userid'",
'admin',
0);
if ($user_is_admin)
{
echo_svn_output('--version');
echo_svn_output('remote -v');
echo_svn_output('status');
echo_svn_output('diff');
global $CDASH_ROOT_DIR;
echo_file_contents($CDASH_ROOT_DIR.'/cdash/config.local.php');
echo_file_contents($CDASH_ROOT_DIR.'/tests/config.test.local.php');
echo '<h3>phpinfo</h3>';
phpinfo();
echo '<br/>';
}
else
{
echo 'Admin login required to display svn info.';
}
}
?>