Index: trunk/tools/WikipediaStatistics/index.php |
— | — | @@ -81,41 +81,43 @@ |
82 | 82 | <hr noshade="noshade" size="1" /> |
83 | 83 | <pre><?php |
84 | 84 | |
85 | | - $dbr = new Database(); |
86 | | - $dateRange = array( |
87 | | - sprintf( |
88 | | - 'rev_timestamp > %s', |
89 | | - $dbr->addQuotes( date( 'Ymd', strtotime( $parameters['from'] ) ) |
90 | | - ) |
91 | | - ), |
92 | | - sprintf( |
93 | | - 'rev_timestamp < %s', |
94 | | - $dbr->addQuotes( date( 'Ymd', strtotime( $parameters['to'] ) ) |
95 | | - ) |
96 | | - ), |
97 | | - ); |
98 | | - switch ( $parameters['type'] ) { |
99 | | - case 'edits': |
100 | | - $result = $dbr->select( |
101 | | - 'revision', |
102 | | - 'COUNT( rev_id )', |
103 | | - $dateRange, |
104 | | - array( 'LIMIT' => 1 ) |
105 | | - ); |
106 | | - break; |
107 | | - case 'editors': |
108 | | - $result = $dbr->select( |
109 | | - 'revision', |
110 | | - 'DISTINCT COUNT( rev_user )', |
111 | | - $dateRange, |
112 | | - array( 'LIMIT' => 1 ) |
113 | | - ); |
114 | | - break; |
115 | | - } |
116 | | - if ( isset( $result ) ) { |
117 | | - while( $row = $result->fetchRow() ) { |
118 | | - echo $row[0]; |
| 85 | + if ( isset( $_POST['submit'] ) ) { |
| 86 | + $dbr = new Database(); |
| 87 | + $dateRange = array( |
| 88 | + sprintf( |
| 89 | + 'rev_timestamp > %s', |
| 90 | + $dbr->addQuotes( date( 'Ymd', strtotime( $parameters['from'] ) ) |
| 91 | + ) |
| 92 | + ), |
| 93 | + sprintf( |
| 94 | + 'rev_timestamp < %s', |
| 95 | + $dbr->addQuotes( date( 'Ymd', strtotime( $parameters['to'] ) ) |
| 96 | + ) |
| 97 | + ), |
| 98 | + ); |
| 99 | + switch ( $parameters['type'] ) { |
| 100 | + case 'edits': |
| 101 | + $result = $dbr->select( |
| 102 | + 'revision', |
| 103 | + 'COUNT( rev_id )', |
| 104 | + $dateRange, |
| 105 | + array( 'LIMIT' => 1 ) |
| 106 | + ); |
| 107 | + break; |
| 108 | + case 'editors': |
| 109 | + $result = $dbr->select( |
| 110 | + 'revision', |
| 111 | + 'DISTINCT COUNT( rev_user )', |
| 112 | + $dateRange, |
| 113 | + array( 'LIMIT' => 1 ) |
| 114 | + ); |
| 115 | + break; |
119 | 116 | } |
| 117 | + if ( isset( $result ) ) { |
| 118 | + while( $row = $result->fetchRow() ) { |
| 119 | + echo $row[0]; |
| 120 | + } |
| 121 | + } |
120 | 122 | } |
121 | 123 | |
122 | 124 | ?></pre> |