Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gate upgrade from pre-1.0 users #1442

Merged
merged 1 commit into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion application/src/Service/EnvironmentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class EnvironmentFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $services, $requestedName, array $options = null)
{
return new Environment($services->get('Omeka\Connection'));
return new Environment(
$services->get('Omeka\Connection'),
$services->get('Omeka\Settings')
);
}
}
17 changes: 16 additions & 1 deletion application/src/Stdlib/Environment.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Omeka\Stdlib;

use Omeka\Module;
use Omeka\Settings\Settings;
use Doctrine\DBAL\Connection;

class Environment
Expand All @@ -27,9 +29,22 @@ class Environment

/**
* @param Connection $connection
* @param Settings $settings
*/
public function __construct(Connection $connection)
public function __construct(Connection $connection, Settings $settings)
{
$codeVersion = Module::VERSION;
$dbVersion = $settings->get('version');
if ($dbVersion // Perform this check only if Omeka is installed.
&& version_compare($dbVersion, 1, '<')
&& version_compare($codeVersion, 2, '>=')
) {
$this->errorMessages[] = new Message(
'You must upgrade Omeka S to at least version 1.0.0 before upgrading to version %s. You are currently on version %s.', // @translate
$codeVersion,
$dbVersion
);
}
if (!version_compare(PHP_VERSION, self::PHP_MINIMUM_VERSION, '>=')) {
$this->errorMessages[] = new Message(
'The installed PHP version (%s) is too low. Omeka requires at least version %s.', // @translate
Expand Down