r74850 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74849‎ | r74850 | r74851 >
Date:18:47, 16 October 2010
Author:ialex
Status:ok
Tags:
Comment:
svn:eol-style native
Modified paths:
  • /trunk/extensions/ArticleEmblems/README (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/api_payflowpro_gateway.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter.css (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/pfp_api_controller.js (modified) (history)
  • /trunk/extensions/UploadWizard/README (modified) (history)
  • /trunk/extensions/WikiBhasha/README.txt (modified) (history)
  • /trunk/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php (modified) (history)
  • /trunk/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php (modified) (history)
  • /trunk/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php (modified) (history)
  • /trunk/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php (modified) (history)
  • /trunk/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php (modified) (history)
  • /trunk/phase3/includes/SeleniumWebSettings.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/SeleniumServerManager.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/SimpleSeleniumConfig.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/selenium_settings.ini.php52.sample (modified) (history)

Diff [purge]

Property changes on: trunk/phase3/maintenance/tests/selenium/SimpleSeleniumConfig.php
___________________________________________________________________
Added: svn:eol-style
11 + native
Index: trunk/phase3/maintenance/tests/selenium/SeleniumServerManager.php
@@ -1,228 +1,228 @@
2 -<?php
3 -/**
4 - * Selenium server manager
5 - *
6 - * @file
7 - * @ingroup Maintenance
8 - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
9 - * http://citizendium.org/
10 - *
11 - * This program is free software; you can redistribute it and/or modify
12 - * it under the terms of the GNU General Public License as published by
13 - * the Free Software Foundation; either version 2 of the License, or
14 - * (at your option) any later version.
15 - *
16 - * This program is distributed in the hope that it will be useful,
17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 - * GNU General Public License for more details.
20 - *
21 - * You should have received a copy of the GNU General Public License along
22 - * with this program; if not, write to the Free Software Foundation, Inc.,
23 - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 - * http://www.gnu.org/copyleft/gpl.html
25 - *
26 - * @addtogroup Maintenance
27 - */
28 -
29 -class SeleniumServerManager {
30 - private $SeleniumStartServer = false;
31 - private $OS = '';
32 - private $SeleniumServerPid = 'NaN';
33 - private $SeleniumServerPort = 4444;
34 - private $SeleniumServerStartTimeout = 10; // 10 secs.
35 - private $SeleniumServerExecPath;
36 -
37 - public function __construct( $startServer,
38 - $serverPort,
39 - $serverExecPath ) {
40 - $this->OS = (string) PHP_OS;
41 - if ( isset( $startServer ) )
42 - $this->SeleniumStartServer = $startServer;
43 - if ( isset( $serverPort ) )
44 - $this->SeleniumServerPort = $serverPort;
45 - if ( isset( $serverExecPath ) )
46 - $this->SeleniumServerExecPath = $serverExecPath;
47 - return;
48 - }
49 -
50 - // Getters for certain private attributes. No setters, since they
51 - // should not change after the manager object is created.
52 -
53 - public function getSeleniumStartServer() {
54 - return $this->SeleniumStartServer;
55 - }
56 -
57 - public function getSeleniumServerPort() {
58 - return $this->SeleniumServerPort;
59 - }
60 -
61 - public function getSeleniumServerPid() {
62 - return $this->SeleniumServerPid;
63 - }
64 -
65 - // Changing value of SeleniumStartServer allows starting server after
66 - // creation of the class instance. Only allow setting SeleniumStartServer
67 - // to true, since after server is started, it is shut down by stop().
68 -
69 - public function setSeleniumStartServer( $startServer ) {
70 - if ( $startServer == true ) $this->SeleniumStartServer = true;
71 - }
72 -
73 - // return values are: 1) started - server started, 2) failed -
74 - // server not started, 3) running - instructed to start server, but
75 - // server already running
76 -
77 - public function start() {
78 -
79 - if ( !$this->SeleniumStartServer ) return 'failed';
80 -
81 - // commented out cases are untested
82 -
83 - switch ( $this->OS ) {
84 - case "Linux":
85 -# case' CYGWIN_NT-5.1':
86 -# case 'Darwin':
87 -# case 'FreeBSD':
88 -# case 'HP-UX':
89 -# case 'IRIX64':
90 -# case 'NetBSD':
91 -# case 'OpenBSD':
92 -# case 'SunOS':
93 -# case 'Unix':
94 - // *nix based OS
95 - return $this->startServerOnUnix();
96 - break;
97 - case "Windows":
98 - case "WIN32":
99 - case "WINNT":
100 - // Windows
101 - return $this->startServerOnWindows();
102 - break;
103 - default:
104 - // An untested OS
105 - return 'failed';
106 - break;
107 - }
108 - }
109 -
110 - public function stop() {
111 -
112 - // commented out cases are untested
113 -
114 - switch ( $this->OS ) {
115 - case "Linux":
116 -# case' CYGWIN_NT-5.1':
117 -# case 'Darwin':
118 -# case 'FreeBSD':
119 -# case 'HP-UX':
120 -# case 'IRIX64':
121 -# case 'NetBSD':
122 -# case 'OpenBSD':
123 -# case 'SunOS':
124 -# case 'Unix':
125 - // *nix based OS
126 - return $this->stopServerOnUnix();
127 - break;
128 - case "Windows":
129 - case "WIN32":
130 - case "WINNT":
131 - // Windows
132 - return $this->stopServerOnWindows();
133 - break;
134 - default:
135 - // An untested OS
136 - return 'failed';
137 - break;
138 - }
139 - }
140 -
141 - private function startServerOnUnix() {
142 -
143 - $output = array();
144 - $user = $_ENV['USER'];
145 - exec("ps -U " . $user . " w | grep -i selenium-server", $output);
146 -
147 - // Start server. If there is already a server running,
148 - // return running.
149 -
150 - if ( isset( $this->SeleniumServerExecPath ) ) {
151 - $found = 0;
152 - foreach ( $output as $string ) {
153 - $found += preg_match(
154 - '~^(.*)java(.+)-jar(.+)selenium-server~',
155 - $string );
156 - }
157 - if ( $found == 0 ) {
158 -
159 - // Didn't find the selenium server. Start it up.
160 - // First set up comamand line suffix.
161 - // NB: $! is pid of last job run in background
162 - // The echo guarentees it is put into $op when
163 - // the exec command is run.
164 -
165 - $commandSuffix = ' > /dev/null 2>&1'. ' & echo $!';
166 - $portText = ' -port ' . $this->SeleniumServerPort;
167 - $command = "java -jar " .
168 - $this->SeleniumServerExecPath .
169 - $portText . $commandSuffix;
170 - exec($command ,$op);
171 - $pid = (int)$op[0];
172 - if ( $pid != "" )
173 - $this->SeleniumServerPid = $pid;
174 - else {
175 - $this->SeleniumServerPid = 'NaN';
176 - // Server start failed.
177 - return 'failed';
178 - }
179 - // Wait for the server to startup and listen
180 - // on its port. Note: this solution kinda
181 - // stinks, since it uses a wait loop - dnessett
182 -
183 - for ( $cnt = 1;
184 - $cnt <= $this->SeleniumServerStartTimeout;
185 - $cnt++ ) {
186 - $fp = @fsockopen ( 'localhost',
187 - $this->SeleniumServerPort,
188 - &$errno, &$errstr, 0 );
189 - if ( !$fp ) {
190 - sleep( 1 );
191 - continue;
192 - // Server start succeeded.
193 - } else {
194 - fclose ( $fp );
195 - return 'started';
196 - }
197 - }
198 - echo ( "Starting Selenium server timed out.\n" );
199 - return 'failed';
200 - }
201 - // server already running.
202 - else return 'running';
203 -
204 - }
205 - // No Server execution path defined.
206 - return 'failed';
207 - }
208 -
209 - private function startServerOnWindows() {
210 - // Unimplemented.
211 - return 'failed';
212 - }
213 -
214 - private function stopServerOnUnix() {
215 -
216 - if ( !empty( $this->SeleniumServerPid ) &&
217 - $this->SeleniumServerPid != 'NaN' ) {
218 - exec( "kill -9 " . $this->SeleniumServerPid );
219 - return 'stopped';
220 - }
221 - else return 'failed';
222 - }
223 -
224 - private function stopServerOnWindows() {
225 - // Unimplemented.
226 - return 'failed';
227 -
228 - }
229 -}
 2+<?php
 3+/**
 4+ * Selenium server manager
 5+ *
 6+ * @file
 7+ * @ingroup Maintenance
 8+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 9+ * http://citizendium.org/
 10+ *
 11+ * This program is free software; you can redistribute it and/or modify
 12+ * it under the terms of the GNU General Public License as published by
 13+ * the Free Software Foundation; either version 2 of the License, or
 14+ * (at your option) any later version.
 15+ *
 16+ * This program is distributed in the hope that it will be useful,
 17+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 19+ * GNU General Public License for more details.
 20+ *
 21+ * You should have received a copy of the GNU General Public License along
 22+ * with this program; if not, write to the Free Software Foundation, Inc.,
 23+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 24+ * http://www.gnu.org/copyleft/gpl.html
 25+ *
 26+ * @addtogroup Maintenance
 27+ */
 28+
 29+class SeleniumServerManager {
 30+ private $SeleniumStartServer = false;
 31+ private $OS = '';
 32+ private $SeleniumServerPid = 'NaN';
 33+ private $SeleniumServerPort = 4444;
 34+ private $SeleniumServerStartTimeout = 10; // 10 secs.
 35+ private $SeleniumServerExecPath;
 36+
 37+ public function __construct( $startServer,
 38+ $serverPort,
 39+ $serverExecPath ) {
 40+ $this->OS = (string) PHP_OS;
 41+ if ( isset( $startServer ) )
 42+ $this->SeleniumStartServer = $startServer;
 43+ if ( isset( $serverPort ) )
 44+ $this->SeleniumServerPort = $serverPort;
 45+ if ( isset( $serverExecPath ) )
 46+ $this->SeleniumServerExecPath = $serverExecPath;
 47+ return;
 48+ }
 49+
 50+ // Getters for certain private attributes. No setters, since they
 51+ // should not change after the manager object is created.
 52+
 53+ public function getSeleniumStartServer() {
 54+ return $this->SeleniumStartServer;
 55+ }
 56+
 57+ public function getSeleniumServerPort() {
 58+ return $this->SeleniumServerPort;
 59+ }
 60+
 61+ public function getSeleniumServerPid() {
 62+ return $this->SeleniumServerPid;
 63+ }
 64+
 65+ // Changing value of SeleniumStartServer allows starting server after
 66+ // creation of the class instance. Only allow setting SeleniumStartServer
 67+ // to true, since after server is started, it is shut down by stop().
 68+
 69+ public function setSeleniumStartServer( $startServer ) {
 70+ if ( $startServer == true ) $this->SeleniumStartServer = true;
 71+ }
 72+
 73+ // return values are: 1) started - server started, 2) failed -
 74+ // server not started, 3) running - instructed to start server, but
 75+ // server already running
 76+
 77+ public function start() {
 78+
 79+ if ( !$this->SeleniumStartServer ) return 'failed';
 80+
 81+ // commented out cases are untested
 82+
 83+ switch ( $this->OS ) {
 84+ case "Linux":
 85+# case' CYGWIN_NT-5.1':
 86+# case 'Darwin':
 87+# case 'FreeBSD':
 88+# case 'HP-UX':
 89+# case 'IRIX64':
 90+# case 'NetBSD':
 91+# case 'OpenBSD':
 92+# case 'SunOS':
 93+# case 'Unix':
 94+ // *nix based OS
 95+ return $this->startServerOnUnix();
 96+ break;
 97+ case "Windows":
 98+ case "WIN32":
 99+ case "WINNT":
 100+ // Windows
 101+ return $this->startServerOnWindows();
 102+ break;
 103+ default:
 104+ // An untested OS
 105+ return 'failed';
 106+ break;
 107+ }
 108+ }
 109+
 110+ public function stop() {
 111+
 112+ // commented out cases are untested
 113+
 114+ switch ( $this->OS ) {
 115+ case "Linux":
 116+# case' CYGWIN_NT-5.1':
 117+# case 'Darwin':
 118+# case 'FreeBSD':
 119+# case 'HP-UX':
 120+# case 'IRIX64':
 121+# case 'NetBSD':
 122+# case 'OpenBSD':
 123+# case 'SunOS':
 124+# case 'Unix':
 125+ // *nix based OS
 126+ return $this->stopServerOnUnix();
 127+ break;
 128+ case "Windows":
 129+ case "WIN32":
 130+ case "WINNT":
 131+ // Windows
 132+ return $this->stopServerOnWindows();
 133+ break;
 134+ default:
 135+ // An untested OS
 136+ return 'failed';
 137+ break;
 138+ }
 139+ }
 140+
 141+ private function startServerOnUnix() {
 142+
 143+ $output = array();
 144+ $user = $_ENV['USER'];
 145+ exec("ps -U " . $user . " w | grep -i selenium-server", $output);
 146+
 147+ // Start server. If there is already a server running,
 148+ // return running.
 149+
 150+ if ( isset( $this->SeleniumServerExecPath ) ) {
 151+ $found = 0;
 152+ foreach ( $output as $string ) {
 153+ $found += preg_match(
 154+ '~^(.*)java(.+)-jar(.+)selenium-server~',
 155+ $string );
 156+ }
 157+ if ( $found == 0 ) {
 158+
 159+ // Didn't find the selenium server. Start it up.
 160+ // First set up comamand line suffix.
 161+ // NB: $! is pid of last job run in background
 162+ // The echo guarentees it is put into $op when
 163+ // the exec command is run.
 164+
 165+ $commandSuffix = ' > /dev/null 2>&1'. ' & echo $!';
 166+ $portText = ' -port ' . $this->SeleniumServerPort;
 167+ $command = "java -jar " .
 168+ $this->SeleniumServerExecPath .
 169+ $portText . $commandSuffix;
 170+ exec($command ,$op);
 171+ $pid = (int)$op[0];
 172+ if ( $pid != "" )
 173+ $this->SeleniumServerPid = $pid;
 174+ else {
 175+ $this->SeleniumServerPid = 'NaN';
 176+ // Server start failed.
 177+ return 'failed';
 178+ }
 179+ // Wait for the server to startup and listen
 180+ // on its port. Note: this solution kinda
 181+ // stinks, since it uses a wait loop - dnessett
 182+
 183+ for ( $cnt = 1;
 184+ $cnt <= $this->SeleniumServerStartTimeout;
 185+ $cnt++ ) {
 186+ $fp = @fsockopen ( 'localhost',
 187+ $this->SeleniumServerPort,
 188+ &$errno, &$errstr, 0 );
 189+ if ( !$fp ) {
 190+ sleep( 1 );
 191+ continue;
 192+ // Server start succeeded.
 193+ } else {
 194+ fclose ( $fp );
 195+ return 'started';
 196+ }
 197+ }
 198+ echo ( "Starting Selenium server timed out.\n" );
 199+ return 'failed';
 200+ }
 201+ // server already running.
 202+ else return 'running';
 203+
 204+ }
 205+ // No Server execution path defined.
 206+ return 'failed';
 207+ }
 208+
 209+ private function startServerOnWindows() {
 210+ // Unimplemented.
 211+ return 'failed';
 212+ }
 213+
 214+ private function stopServerOnUnix() {
 215+
 216+ if ( !empty( $this->SeleniumServerPid ) &&
 217+ $this->SeleniumServerPid != 'NaN' ) {
 218+ exec( "kill -9 " . $this->SeleniumServerPid );
 219+ return 'stopped';
 220+ }
 221+ else return 'failed';
 222+ }
 223+
 224+ private function stopServerOnWindows() {
 225+ // Unimplemented.
 226+ return 'failed';
 227+
 228+ }
 229+}
Property changes on: trunk/phase3/maintenance/tests/selenium/SeleniumServerManager.php
___________________________________________________________________
Added: svn:eol-style
230230 + native
Property changes on: trunk/phase3/maintenance/tests/selenium/selenium_settings.ini.php52.sample
___________________________________________________________________
Added: svn:eol-style
231231 + native
Property changes on: trunk/phase3/includes/SeleniumWebSettings.php
___________________________________________________________________
Added: svn:eol-style
232232 + native
Index: trunk/extensions/WikiBhasha/README.txt
@@ -1,6 +1,6 @@
2 -This extension directory reserved for the WikiBhasha (Beta) software
3 -to be created shortly by Wikipedia user, WikiBhasha.MSR.
4 -
5 -WikiBhasha (Beta) is a being open-sourced as a MediaWiki Extension here http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/WikiBhasha),
6 -with the Javascript portions under Apache License 2.0 and the PHP
7 -portions under Gnu GPL License 2.0.
 2+This extension directory reserved for the WikiBhasha (Beta) software
 3+to be created shortly by Wikipedia user, WikiBhasha.MSR.
 4+
 5+WikiBhasha (Beta) is a being open-sourced as a MediaWiki Extension here http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/WikiBhasha),
 6+with the Javascript portions under Apache License 2.0 and the PHP
 7+portions under Gnu GPL License 2.0.
Property changes on: trunk/extensions/WikiBhasha/README.txt
___________________________________________________________________
Added: svn:eol-style
88 + native
Property changes on: trunk/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php
___________________________________________________________________
Added: svn:eol-style
99 + native
Property changes on: trunk/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
___________________________________________________________________
Added: svn:eol-style
1010 + native
Property changes on: trunk/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php
___________________________________________________________________
Added: svn:eol-style
1111 + native
Property changes on: trunk/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php
___________________________________________________________________
Added: svn:eol-style
1212 + native
Property changes on: trunk/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php
___________________________________________________________________
Added: svn:eol-style
1313 + native
Property changes on: trunk/extensions/ArticleEmblems/README
___________________________________________________________________
Added: svn:eol-style
1414 + native
Property changes on: trunk/extensions/DonationInterface/payflowpro_gateway/api_payflowpro_gateway.php
___________________________________________________________________
Added: svn:eol-style
1515 + native
Property changes on: trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter.css
___________________________________________________________________
Added: svn:eol-style
1616 + native
Property changes on: trunk/extensions/DonationInterface/payflowpro_gateway/pfp_api_controller.js
___________________________________________________________________
Added: svn:eol-style
1717 + native
Property changes on: trunk/extensions/UploadWizard/README
___________________________________________________________________
Added: svn:eol-style
1818 + native

Status & tagging log