function startSession() {
$sessPath = $this->getSessionSavePath();
if( $sessPath != '' ) {
- if( !is_dir( $sessPath ) || !is_writeable( $sessPath ) ) {
+ if( strval( ini_get( 'open_basedir' ) ) != '' ) {
+ // we need to skip the following check when open_basedir is on.
+ // The session path probably *wont* be writable by the current
+ // user, and telling them to change it is bad. Bug 23021.
+ } elseif( !is_dir( $sessPath ) || !is_writeable( $sessPath ) ) {
$this->showError( 'config-session-path-bad', $sessPath );
return false;
}
/**
* Get the value of session.save_path
*
- * Per http://www.php.net/manual/en/ref.session.php#ini.session.save-path,
+ * Per http://www.php.net/manual/en/session.configuration.php#ini.session.save-path,
* this might have some additional preceding parts which need to be
* ditched
*
/**
* Clean up from execute()
- * @private.
*/
- function finish() {
+ private function finish() {
$this->output->output();
$this->session['happyPages'] = $this->happyPages;
$this->session['skippedPages'] = $this->skippedPages;
}
/**
- * Output an error box using a Status object
+ * Output an error or warning box using a Status object
*/
- function showStatusErrorBox( $status ) {
- $text = $status->getWikiText();
- $this->output->addHTML( $this->getErrorBox( $text ) );
+ function showStatusBox( $status ) {
+ if( !$status->isGood() ) {
+ $text = $status->getWikiText();
+ if( $status->isOk() ) {
+ $box = $this->getWarningBox( $text );
+ } else {
+ $box = $this->getErrorBox( $text );
+ }
+ $this->output->addHTML( $box );
+ }
}
- function showStatusError( $status ) {
+ function showStatusMessage( $status ) {
$text = $status->getWikiText();
$this->output->addWikiText(
"<div class=\"config-message\">\n" .
}
}
-class WebInstallerPage {
+abstract class WebInstallerPage {
function __construct( $parent ) {
$this->parent = $parent;
}
return array_search( $this->getName(), $this->parent->pageSequence );
}
- function execute() {
- if ( $this->parent->request->wasPosted() ) {
- return 'continue';
- } else {
- $this->startForm();
- $this->addHTML( 'Mockup' );
- $this->endForm();
- }
- }
+ abstract function execute();
function getVar( $var ) {
return $this->parent->getVar( $var );
$this->setVar( '_UpgradeDone', false );
return 'continue';
} else {
- $this->parent->showStatusErrorBox( $status );
+ $this->parent->showStatusBox( $status );
}
}
} elseif ( $status->isGood() ) {
return 'continue';
} else {
- $this->parent->showStatusErrorBox( $status );
+ $this->parent->showStatusBox( $status );
}
}
'label' => 'config-upload-deleted',
) ) .
$this->parent->getHelpBox( 'config-upload-deleted-help' ) .
+ '</div>' .
$this->parent->getTextBox( array(
'var' => 'wgLogo',
'label' => 'config-logo'
) ) .
$this->parent->getHelpBox( 'config-logo-help' ) .
- '</div>' .
$this->parent->getFieldsetEnd()
);
- $caches = array( 'none', 'anything', 'db' );
- $selected = 'db';
+ $caches = array( 'none' );
if( count( $this->getVar( '_Caches' ) ) ) {
$caches[] = 'accel';
$selected = 'accel';
}
$this->startForm();
$this->addHTML("<ul>");
- foreach( $this->parent->getInstallSteps() as $step ) {
+ foreach( $this->parent->getInstallSteps() as $stepObj ) {
+ $step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
$this->startStage( "config-install-$step" );
- $func = 'install' . ucfirst( $step );
- $status = $this->parent->{$func}();
+ $status = null;
+
+ # Call our working function
+ if ( is_array( $step ) ) {
+ # A custom callaback
+ $callback = $stepObj['callback'];
+ $status = call_user_func_array( $callback, array() );
+ } else {
+ # Boring implicitly named callback
+ $func = 'install' . ucfirst( $step );
+ $status = $this->parent->{$func}();
+ }
+
$ok = $status->isGood();
if ( !$ok ) {
- $this->parent->showStatusErrorBox( $status );
+ $this->parent->showStatusBox( $status );
}
$this->endStage( $ok );
}
}
protected function formatTextFile( $text ) {
+ $text = str_replace( array( '<', '{{', '[[' ),
+ array( '<', '{{', '[[' ), $text );
// replace numbering with [1], [2], etc with MW-style numbering
$text = preg_replace( "/\r?\n(\r?\n)?\\[\\d+\\]/m", "\\1#", $text );
// join word-wrapped lines into one