return $this->installSteps;
}
+ /**
+ * Actually perform the installation
+ * @param Array $startCB A callback array for the beginning of each step
+ * @param Array $endCB A callback array for the end of each step
+ * @return Array of Status objects
+ */
+ public function performInstallation( $startCB, $endCB ) {
+ $installResults = array();
+ foreach( $this->getInstallSteps() as $stepObj ) {
+ $step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
+ call_user_func_array( $startCB, array( $step ) );
+ $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->{$func}();
+ }
+ call_user_func_array( $endCB, array( $step, $status ) );
+ $installResults[$step] = $status;
+ }
+ return $installResults;
+ }
+
public function installExtensions() {
global $wgHooks, $wgAutoloadClasses;
$exts = $this->getVar( '_Extensions' );
}
$this->startForm();
$this->addHTML("<ul>");
- foreach( $this->parent->getInstallSteps() as $stepObj ) {
- $step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
- $this->startStage( "config-install-$step" );
- $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->showStatusBox( $status );
- }
- $this->endStage( $ok );
- }
+ $this->parent->performInstallation(
+ array( $this, 'startStage'),
+ array( $this, 'endStage' )
+ );
$this->addHTML("</ul>");
$this->endForm();
return true;
}
- private function startStage( $msg ) {
- $this->addHTML( "<li>" . wfMsgHtml( $msg ) . wfMsg( 'ellipsis') );
+ public function startStage( $step ) {
+ $this->addHTML( "<li>" . wfMsgHtml( "config-install-$step" ) . wfMsg( 'ellipsis') );
}
- private function endStage( $success = true ) {
+ public function endStage( $step, $status ) {
+ $success = $status->isGood();
$msg = $success ? 'config-install-step-done' : 'config-install-step-failed';
$html = wfMsgHtml( 'word-separator' ) . wfMsgHtml( $msg );
if ( !$success ) {
+ $this->parent->showStatusBox( $status );
$html = "<span class=\"error\">$html</span>";
}
$this->addHTML( $html . "</li>\n" );