r102514 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102513‎ | r102514 | r102515 >
Date:14:31, 9 November 2011
Author:reedy
Status:resolved
Tags:
Comment:
REL1_18 MFT r92846, r93065, r93834, r94171
Modified paths:
  • /branches/REL1_18/phase3 (modified) (history)
  • /branches/REL1_18/phase3/includes (modified) (history)
  • /branches/REL1_18/phase3/includes/installer/CliInstaller.php (modified) (history)
  • /branches/REL1_18/phase3/includes/installer/Installer.i18n.php (modified) (history)
  • /branches/REL1_18/phase3/includes/installer/Installer.php (modified) (history)
  • /branches/REL1_18/phase3/includes/installer/WebInstaller.php (modified) (history)
  • /branches/REL1_18/phase3/includes/templates/NoLocalSettings.php (modified) (history)
  • /branches/REL1_18/phase3/includes/upload/UploadStash.php (modified) (history)
  • /branches/REL1_18/phase3/resources/jquery.ui/themes/vector/jquery.ui.button.css (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/upload/UploadStash.php
@@ -219,18 +219,18 @@
220220 wfDebug( __METHOD__ . " key for '$path': $key\n" );
221221
222222 // if not already in a temporary area, put it there
223 - $storeResult = $this->repo->storeTemp( basename( $path ), $path );
 223+ $storeStatus = $this->repo->storeTemp( basename( $path ), $path );
224224
225 - if ( ! $storeResult->isOK() ) {
 225+ if ( ! $storeStatus->isOK() ) {
226226 // It is a convention in MediaWiki to only return one error per API exception, even if multiple errors
227227 // are available. We use reset() to pick the "first" thing that was wrong, preferring errors to warnings.
228 - // This is a bit lame, as we may have more info in the $storeResult and we're throwing it away, but to fix it means
 228+ // This is a bit lame, as we may have more info in the $storeStatus and we're throwing it away, but to fix it means
229229 // redesigning API errors significantly.
230 - // $storeResult->value just contains the virtual URL (if anything) which is probably useless to the caller
231 - $error = $storeResult->getErrorsArray();
 230+ // $storeStatus->value just contains the virtual URL (if anything) which is probably useless to the caller
 231+ $error = $storeStatus->getErrorsArray();
232232 $error = reset( $error );
233233 if ( ! count( $error ) ) {
234 - $error = $storeResult->getWarningsArray();
 234+ $error = $storeStatus->getWarningsArray();
235235 $error = reset( $error );
236236 if ( ! count( $error ) ) {
237237 $error = array( 'unknown', 'no error recorded' );
@@ -238,11 +238,10 @@
239239 }
240240 throw new UploadStashFileException( "error storing file in '$path': " . implode( '; ', $error ) );
241241 }
242 - $stashPath = $storeResult->value;
 242+ $stashPath = $storeStatus->value;
243243
244244 // fetch the current user ID
245245 if ( !$this->isLoggedIn ) {
246 - wfDebugCallstack();
247246 throw new UploadStashNotLoggedInException( __METHOD__ . ' No user is logged in, files must belong to users' );
248247 }
249248
Property changes on: branches/REL1_18/phase3/includes/upload/UploadStash.php
___________________________________________________________________
Modified: svn:mergeinfo
250249 Merged /trunk/phase3/includes/upload/UploadStash.php:r93065,93834
Index: branches/REL1_18/phase3/includes/installer/WebInstaller.php
@@ -1053,4 +1053,27 @@
10541054 $img . ' ' . wfMsgHtml( 'config-download-localsettings' ) );
10551055 return Html::rawElement( 'div', array( 'class' => 'config-download-link' ), $anchor );
10561056 }
 1057+
 1058+ public function envCheckPath( ) {
 1059+ // PHP_SELF isn't available sometimes, such as when PHP is CGI but
 1060+ // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
 1061+ // to get the path to the current script... hopefully it's reliable. SIGH
 1062+ $path = false;
 1063+ if ( !empty( $_SERVER['PHP_SELF'] ) ) {
 1064+ $path = $_SERVER['PHP_SELF'];
 1065+ } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
 1066+ $path = $_SERVER['SCRIPT_NAME'];
 1067+ }
 1068+ if ($path !== false) {
 1069+ $uri = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
 1070+ $this->setVar( 'wgScriptPath', $uri );
 1071+ } else {
 1072+ $this->showError( 'config-no-uri' );
 1073+ return false;
 1074+ }
 1075+
 1076+
 1077+ return parent::envCheckPath();
 1078+ }
 1079+
10571080 }
Index: branches/REL1_18/phase3/includes/installer/Installer.php
@@ -857,19 +857,6 @@
858858
859859 $this->setVar( 'IP', $IP );
860860
861 - // PHP_SELF isn't available sometimes, such as when PHP is CGI but
862 - // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
863 - // to get the path to the current script... hopefully it's reliable. SIGH
864 - if ( !empty( $_SERVER['PHP_SELF'] ) ) {
865 - $path = $_SERVER['PHP_SELF'];
866 - } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
867 - $path = $_SERVER['SCRIPT_NAME'];
868 - } elseif ( $this->getVar( 'wgScriptPath' ) ) {
869 - // Some kind soul has set it for us already (e.g. debconf)
870 - return true;
871 - } else {
872 - $this->showError( 'config-no-uri' );
873 - return false;
874861 }
875862
876863 $uri = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
Index: branches/REL1_18/phase3/includes/installer/Installer.i18n.php
@@ -147,9 +147,12 @@
148148 Image thumbnailing will be disabled.',
149149 'config-no-uri' => "'''Error:''' Could not determine the current URI.
150150 Installation aborted.",
 151+ 'config-no-cli-uri' => "'''Warning''': No --scriptpath specified, using default: <code>$1</code>.",
151152 'config-using-server' => 'Using server name "<nowiki>$1</nowiki>".',
152153 'config-uploads-not-safe' => "'''Warning:''' Your default directory for uploads <code>$1</code> is vulnerable to arbitrary scripts execution.
153154 Although MediaWiki checks all uploaded files for security threats, it is highly recommended to [http://www.mediawiki.org/wiki/Manual:Security#Upload_security close this security vulnerability] before enabling uploads.",
 155+ 'config-no-cli-uploads-check' => "'''Warning:''' Your default directory for uploads (<code>$1</code>) is not checked for vulnerability
 156+to arbitrary script execution during the CLI install.",
154157 'config-brokenlibxml' => 'Your system has a combination of PHP and libxml2 versions which is buggy and can cause hidden data corruption in MediaWiki and other web applications.
155158 Upgrade to PHP 5.2.9 or later and libxml2 2.7.3 or later ([http://bugs.php.net/bug.php?id=45996 bug filed with PHP]).
156159 Installation aborted.',
Index: branches/REL1_18/phase3/includes/installer/CliInstaller.php
@@ -13,6 +13,7 @@
1414 * @since 1.17
1515 */
1616 class CliInstaller extends Installer {
 17+ private $specifiedScriptPath = false;
1718
1819 private $optionMap = array(
1920 'dbtype' => 'wgDBtype',
@@ -45,6 +46,10 @@
4647
4748 parent::__construct();
4849
 50+ if ( isset( $option['scriptpath'] ) ) {
 51+ $this->specifiedScriptPath = true;
 52+ }
 53+
4954 foreach ( $this->optionMap as $opt => $global ) {
5055 if ( isset( $option[$opt] ) ) {
5156 $GLOBALS[$global] = $option[$opt];
@@ -170,4 +175,16 @@
171176 exit;
172177 }
173178 }
 179+
 180+ public function envCheckPath( ) {
 181+ if ( !$this->specifiedScriptPath ) {
 182+ $this->showMessage( 'config-no-cli-uri', $this->getVar("wgScriptPath") );
 183+ }
 184+ return parent::envCheckPath();
 185+ }
 186+
 187+ public function dirIsExecutable( $dir, $url ) {
 188+ $this->showMessage( 'config-no-cli-uploads-check', $dir );
 189+ return false;
 190+ }
174191 }
Property changes on: branches/REL1_18/phase3/includes/installer/CliInstaller.php
___________________________________________________________________
Modified: svn:mergeinfo
175192 Merged /trunk/phase3/includes/installer/CliInstaller.php:r93834
Index: branches/REL1_18/phase3/includes/templates/NoLocalSettings.php
@@ -9,11 +9,18 @@
1010 if ( !isset( $wgVersion ) ) {
1111 $wgVersion = 'VERSION';
1212 }
13 -$script = $_SERVER['SCRIPT_NAME'];
14 -$path = pathinfo( $script, PATHINFO_DIRNAME ) . '/';
15 -$path = str_replace( '//', '/', $path );
16 -$ext = pathinfo( $script, PATHINFO_EXTENSION );
1713
 14+$matches = array();
 15+$ext = 'php';
 16+$path = '/';
 17+foreach( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) {
 18+ if( !preg_match( '/\.(php5?)$/', $part, $matches ) ) {
 19+ $path .= "$part/";
 20+ } else {
 21+ $ext = $matches[1] == 'php5' ? 'php5' : 'php';
 22+ }
 23+}
 24+
1825 # Check to see if the installer is running
1926 if ( !function_exists( 'session_name' ) ) {
2027 $installerStarted = false;
Property changes on: branches/REL1_18/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
2128 Merged /trunk/phase3/includes:r93065,93834,94171
Index: branches/REL1_18/phase3/resources/jquery.ui/themes/vector/jquery.ui.button.css
@@ -9,22 +9,22 @@
1010
1111 /*button text element */
1212 .ui-button .ui-button-text { display: block; line-height: 1.4em; }
13 -.ui-button-text-only .ui-button-text { padding: .125em .25em; }
14 -.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
15 -.ui-button-text-icon-primary .ui-button-text { padding: 0.1em 0.8em 0.1em 1.9em; }
16 -.ui-button-text-icon-secondary .ui-button-text { padding: .1em 1.9em .1em 0.8em; }
17 -.ui-button-text-icons .ui-button-text { padding: 0.1em 1.9em 0.1em 1.9em; }
 13+.ui-button-text-only .ui-button-text { padding: 0.3em 1em 0.25em 1em; }
 14+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: 0.3em; text-indent: -9999999px; }
 15+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: 0.3em 1em 0.25em 2.1em; }
 16+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: 0.3em 2.1em 0.25em 1em; }
 17+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
1818 /* for older versions of jQuery UI */
19 -.ui-button-text-icon .ui-button-text { padding: 0.1em 0.8em 0.1em 1.9em; }
 19+.ui-button-text-icon .ui-button-text { padding: 0.3em 1em 0.3em 2.1em; }
2020
2121 /* no icon support for input elements, provide padding by default */
22 -input.ui-button { padding: .4em 1em; }
 22+input.ui-button { padding: 0.3em 1em; }
2323
2424 /*button icon element(s) */
2525 .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -9px; }
2626 .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
27 -.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: 0; }
28 -.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icon .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: 16px; }
 27+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: 0.5em; }
 28+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icon .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: 0.5em; }
2929
3030 /*button sets*/
3131 .ui-buttonset { margin-right: 7px; }
@@ -36,7 +36,7 @@
3737 body .ui-button {
3838 -moz-border-radius: 4px;
3939 -webkit-border-radius: 4px;
40 - padding: 0.2em 0.6em 0.15em !important;
 40+ border-radius: 4px;
4141 margin: 0.5em 0 0.5em 0.4em !important;
4242 border: 1px solid #a6a6a6 !important;
4343 /* @embed */
Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
4444 Merged /trunk/phase3:r92846,93065,93834,94171

Follow-up revisions

RevisionCommit summaryAuthorDate
r102515Remove extraneous } from r102514reedy14:40, 9 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92846follow-up to r91499 - set padding for the elements inside the button rather t...kaldari02:11, 22 July 2011
r93065Changed storeResult to storeStatus (more informative), removed leftover stack...raindrift16:55, 25 July 2011
r93834* Make envCheckPath() specific to each installer, web vs cli...mah15:46, 3 August 2011
r94171(bug 30219) NoLocalSettings.php broken on Windows servers. Per Tim on r70711,...demon17:28, 10 August 2011

Status & tagging log