diff --git a/module/VuFind/src/VuFind/Controller/UpgradeController.php b/module/VuFind/src/VuFind/Controller/UpgradeController.php index 989a818a0081d493c27ee5527dab4a94682ee7ff..73ac35a77a6c8d7a3220f4a0578ae76570fc1403 100644 --- a/module/VuFind/src/VuFind/Controller/UpgradeController.php +++ b/module/VuFind/src/VuFind/Controller/UpgradeController.php @@ -604,6 +604,19 @@ class UpgradeController extends AbstractBase 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). * @@ -628,6 +641,7 @@ class UpgradeController extends AbstractBase $this->cookie->sourceDir = realpath(APPLICATION_PATH); // Clear out request to avoid infinite loop: $this->getRequest()->getPost()->set('sourceversion', ''); + $this->processSkipParam(); return $this->forwardTo('Upgrade', 'Home'); } } @@ -665,19 +679,19 @@ class UpgradeController extends AbstractBase } // 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'); } // 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'); } // 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 // 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'); } @@ -718,4 +732,3 @@ class UpgradeController extends AbstractBase return $this->forwardTo('Upgrade', 'Home'); } } - diff --git a/themes/bootstrap3/templates/upgrade/getsourcedir.phtml b/themes/bootstrap3/templates/upgrade/getsourcedir.phtml index ce9c4925d610b762262a9ebc3e8184a5f0ac27d3..e0bf64956b24479275cfc090124cb24f5345e76e 100644 --- a/themes/bootstrap3/templates/upgrade/getsourcedir.phtml +++ b/themes/bootstrap3/templates/upgrade/getsourcedir.phtml @@ -12,8 +12,18 @@ <form class="form-inline" method="post" action="<?=$this->url('upgrade-getsourcedir')?>"> <input type="text" name="sourcedir" /> <input class="btn btn-default" type="submit" /> </form> +<hr /> <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')?>"> - <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>