Index: trunk/tools/subversion/users.php |
— | — | @@ -1,56 +1,57 @@ |
2 | | -<!DOCTYPE html> |
3 | | -<html> |
4 | | - <head> |
5 | | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
6 | | - <title>Wikimedia Subversion user list</title> |
7 | | - </head> |
8 | | - |
9 | | - <body> |
10 | | - <h1>Wikimedia Subversion user list</h1> |
11 | | - <table border="1"> |
12 | | - <tr> |
13 | | - <th>Username</th> |
14 | | - <th>Real name</th> |
15 | | - <th>Ready for git?</th> |
16 | | - </tr> |
| 2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
| 4 | +<head> |
| 5 | + <title>Wikimedia Subversion user list</title> |
| 6 | + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 7 | +</head> |
| 8 | +<body> |
| 9 | +<h1>Wikimedia Subversion user list</h1> |
| 10 | +<table border="1"> |
| 11 | + <tr> |
| 12 | + <th>Username</th> |
| 13 | + <th>Real name</th> |
| 14 | + <th>Ready for git?</th> |
| 15 | + </tr> |
17 | 16 | <?php |
18 | 17 | |
19 | 18 | $time = microtime( true ); |
20 | | -$lines = file( '/etc/passwd' ); |
| 19 | +exec( "getent passwd", $lines ); |
21 | 20 | exec( "HOME=/tmp /usr/bin/svn up /var/cache/svnusers 2>&1", $output, $retval ); |
22 | 21 | if ( $retval ) { |
23 | 22 | $error = implode( "\n", $output ); |
24 | 23 | } else { |
25 | 24 | $error = false; |
26 | 25 | } |
| 26 | +$committed = file( '/home/demon/commit' ); |
27 | 27 | |
28 | 28 | foreach ( $lines as $line ) { |
29 | 29 | $parts = explode( ':', trim( $line ) ); |
30 | | - if ( !isset( $parts[2] ) || $parts[2] < 501 ) { |
| 30 | + if ( !isset( $parts[2] ) || $parts[2] < 500 ) { |
31 | 31 | continue; |
32 | 32 | } |
33 | 33 | $userInfo = getUserInfo( $parts[0] ); |
34 | 34 | $encUsername = htmlspecialchars( $parts[0] ); |
35 | 35 | $userInfo = array_map( 'htmlspecialchars', $userInfo ); |
36 | | - $readyForGit = isset( $userInfo['name'] ) && isset( $userInfo['email'] ) ? 'Y' : 'N'; |
37 | 36 | $link = $userInfo['url'] ? "<a href=\"{$userInfo['url']}\">$encUsername</a>" : $encUsername; |
| 37 | + $readyForGit = isset( $userInfo['name'] ) && isset( $userInfo['email'] ) ? 'Y' : 'N'; |
| 38 | + $haveCommitted = in_array( $parts[0], $committed ) ? 'Y' : 'N'; |
38 | 39 | |
39 | 40 | $rows[$parts[0]] = <<<EOT |
40 | | - <tr id="$encUsername"> |
41 | | - <td>$link</td> |
42 | | - <td>{$userInfo['name']}</td> |
43 | | - <td>$readyForGit</td> |
44 | | - </tr> |
| 41 | +<tr id="$encUsername"> |
| 42 | +<td>$link</td> |
| 43 | +<td>{$userInfo['name']}</td> |
| 44 | +<td>$readyForGit</td> |
| 45 | +</tr> |
45 | 46 | |
46 | 47 | EOT; |
47 | 48 | } |
48 | 49 | ksort( $rows ); |
49 | | -echo implode( '', $rows ); |
50 | | -echo " </table>\n"; |
51 | | -echo " <!-- Request time: " . ( microtime( true ) - $time ) . " -->\n"; |
| 50 | +echo implode( '', $rows ) . "</table>\n"; |
| 51 | +echo "<!-- Request time: " . ( microtime( true ) - $time ) . " -->\n"; |
52 | 52 | if ( $retval ) { |
53 | | - echo " <p>Error: " . htmlspecialchars( $error ) . "</p>\n"; |
| 53 | + echo "<p>Error: " . htmlspecialchars( $error ) . "</p>\n"; |
54 | 54 | } |
| 55 | +echo "</html>\n"; |
55 | 56 | |
56 | 57 | function getUserInfo( $userName ) { |
57 | 58 | $userInfo = array( |
— | — | @@ -69,8 +70,3 @@ |
70 | 71 | } |
71 | 72 | return $userInfo; |
72 | 73 | } |
73 | | - |
74 | | -?> |
75 | | - |
76 | | - </body> |
77 | | -</html> |