Skip to content
Snippets Groups Projects
Commit 9fd58b52 authored by Demian Katz's avatar Demian Katz
Browse files

Added option to skip steps in upgrade process.

parent f8acfa44
No related merge requests found
...@@ -604,6 +604,19 @@ class UpgradeController extends AbstractBase ...@@ -604,6 +604,19 @@ class UpgradeController extends AbstractBase
return $this->createViewModel(); return $this->createViewModel();
} }
/**
* Make sure we only skip the actions the user wants us to.
*
* @return void
*/
protected function processSkipParam()
{
$skip = $this->params()->fromPost('skip', []);
foreach (['config', 'database', 'metadata'] as $action) {
$this->cookie->{$action . 'Okay'} = in_array($action, (array)$skip);
}
}
/** /**
* Prompt the user for a source version (to upgrade from 2.x). * Prompt the user for a source version (to upgrade from 2.x).
* *
...@@ -628,6 +641,7 @@ class UpgradeController extends AbstractBase ...@@ -628,6 +641,7 @@ class UpgradeController extends AbstractBase
$this->cookie->sourceDir = realpath(APPLICATION_PATH); $this->cookie->sourceDir = realpath(APPLICATION_PATH);
// Clear out request to avoid infinite loop: // Clear out request to avoid infinite loop:
$this->getRequest()->getPost()->set('sourceversion', ''); $this->getRequest()->getPost()->set('sourceversion', '');
$this->processSkipParam();
return $this->forwardTo('Upgrade', 'Home'); return $this->forwardTo('Upgrade', 'Home');
} }
} }
...@@ -665,19 +679,19 @@ class UpgradeController extends AbstractBase ...@@ -665,19 +679,19 @@ class UpgradeController extends AbstractBase
} }
// Now make sure we have a configuration file ready: // Now make sure we have a configuration file ready:
if (!isset($this->cookie->configOkay)) { if (!isset($this->cookie->configOkay) || !$this->cookie->configOkay) {
return $this->redirect()->toRoute('upgrade-fixconfig'); return $this->redirect()->toRoute('upgrade-fixconfig');
} }
// Now make sure the database is up to date: // Now make sure the database is up to date:
if (!isset($this->cookie->databaseOkay)) { if (!isset($this->cookie->databaseOkay) || !$this->cookie->databaseOkay) {
return $this->redirect()->toRoute('upgrade-fixdatabase'); return $this->redirect()->toRoute('upgrade-fixdatabase');
} }
// Check for missing metadata in the resource table; note that we do a // Check for missing metadata in the resource table; note that we do a
// redirect rather than a forward here so that a submit button clicked // redirect rather than a forward here so that a submit button clicked
// in the database action doesn't cause the metadata action to also submit! // in the database action doesn't cause the metadata action to also submit!
if (!isset($this->cookie->metadataOkay)) { if (!isset($this->cookie->metadataOkay) || !$this->cookie->metadataOkay) {
return $this->redirect()->toRoute('upgrade-fixmetadata'); return $this->redirect()->toRoute('upgrade-fixmetadata');
} }
...@@ -718,4 +732,3 @@ class UpgradeController extends AbstractBase ...@@ -718,4 +732,3 @@ class UpgradeController extends AbstractBase
return $this->forwardTo('Upgrade', 'Home'); return $this->forwardTo('Upgrade', 'Home');
} }
} }
...@@ -12,8 +12,18 @@ ...@@ -12,8 +12,18 @@
<form class="form-inline" method="post" action="<?=$this->url('upgrade-getsourcedir')?>"> <form class="form-inline" method="post" action="<?=$this->url('upgrade-getsourcedir')?>">
<input type="text" name="sourcedir" /> <input class="btn btn-default" type="submit" /> <input type="text" name="sourcedir" /> <input class="btn btn-default" type="submit" />
</form> </form>
<hr />
<h3>Option 2: Upgrade from VuFind 2.x</h3> <h3>Option 2: Upgrade from VuFind 2.x</h3>
<p>Please enter the version number you are upgrading from (e.g. 2.0.1):</p>
<form class="form-inline" method="post" action="<?=$this->url('upgrade-getsourceversion')?>"> <form class="form-inline" method="post" action="<?=$this->url('upgrade-getsourceversion')?>">
<input type="text" name="sourceversion" /> <input class="btn btn-default" type="submit" /> <p>
Please enter the version number you are upgrading from (e.g. 2.0.1):
<input type="text" name="sourceversion" />
</p>
<p>Options:<br />
<? foreach (['config' => 'Configuration', 'database' => 'Database Structure', 'metadata' => 'Stored Metadata'] as $key => $value): ?>
<input type="checkbox" name="skip[]" id="skip-<?=$this->escapeHtmlAttr($key)?>" value="<?=$this->escapeHtmlAttr($key)?>" />
<label for="skip-<?=$this->escapeHtmlAttr($key)?>">Skip <?=$this->escapeHtml($value); ?> Upgrade</label><br />
<? endforeach; ?>
</p>
<input class="btn btn-default" type="submit" />
</form> </form>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment