Refactors AccessControl and passes it as dependency to JSON API and Menu

This commit is contained in:
Vlad
2017-08-14 11:28:31 -04:00
parent 51fbf29031
commit 2e5554a3af
12 changed files with 286 additions and 241 deletions

View File

@@ -4,7 +4,10 @@ use MailPoet\Models\Setting;
use MailPoet\Util\Url;
class Changelog {
function __construct() {
private $access_control;
function __construct(AccessControl $access_control) {
$this->access_control = $access_control;
}
function init() {
@@ -34,7 +37,7 @@ class Changelog {
$version = Setting::getValue('version', null);
$redirect_url = null;
$mp2_migrator = new MP2Migrator();
$mp2_migrator = new MP2Migrator($this->access_control);
if(!in_array($_GET['page'], array('mailpoet-migration', 'mailpoet-settings')) && $mp2_migrator->isMigrationStartedAndNotCompleted()) {
// Force the redirection if the migration has started but is not completed
$redirect_url = admin_url('admin.php?page=mailpoet-migration');