Make the Migration page accessible through admin.php?page=mailpoet-migration
This commit is contained in:
@ -36,7 +36,13 @@ class Changelog {
|
|||||||
|
|
||||||
if($version === null) {
|
if($version === null) {
|
||||||
// new install
|
// new install
|
||||||
$redirect_url = admin_url('admin.php?page=mailpoet-welcome');
|
$mp2_migrator = new MP2Migrator();
|
||||||
|
if($mp2_migrator->isMigrationNeeded()) {
|
||||||
|
// Migration from MP2
|
||||||
|
$redirect_url = admin_url('admin.php?page=mailpoet-migration');
|
||||||
|
} else {
|
||||||
|
$redirect_url = admin_url('admin.php?page=mailpoet-welcome');
|
||||||
|
}
|
||||||
} else if($version !== Env::$version) {
|
} else if($version !== Env::$version) {
|
||||||
// update
|
// update
|
||||||
$redirect_url = admin_url('admin.php?page=mailpoet-update');
|
$redirect_url = admin_url('admin.php?page=mailpoet-update');
|
||||||
|
@ -143,6 +143,8 @@ class MP2Migrator {
|
|||||||
$this->importCustomFields();
|
$this->importCustomFields();
|
||||||
$this->importSubscribers();
|
$this->importSubscribers();
|
||||||
|
|
||||||
|
Setting::setValue('mailpoet_migration_complete', true);
|
||||||
|
|
||||||
$this->log(sprintf('=== ' . __('END IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
|
$this->log(sprintf('=== ' . __('END IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
|
||||||
$result = ob_get_contents();
|
$result = ob_get_contents();
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace MailPoet\Config;
|
namespace MailPoet\Config;
|
||||||
|
|
||||||
use MailPoet\Config\MP2Migrator;
|
|
||||||
use MailPoet\Cron\CronTrigger;
|
use MailPoet\Cron\CronTrigger;
|
||||||
use MailPoet\Form\Block;
|
use MailPoet\Form\Block;
|
||||||
use MailPoet\Form\Renderer as FormRenderer;
|
use MailPoet\Form\Renderer as FormRenderer;
|
||||||
@ -216,6 +215,18 @@ class Menu {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
add_submenu_page(
|
||||||
|
true,
|
||||||
|
$this->setPageTitle(__('Migration', 'mailpoet')),
|
||||||
|
'',
|
||||||
|
Env::$required_permission,
|
||||||
|
'mailpoet-migration',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'migration'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
true,
|
true,
|
||||||
$this->setPageTitle(__('Update', 'mailpoet')),
|
$this->setPageTitle(__('Update', 'mailpoet')),
|
||||||
@ -271,25 +282,23 @@ class Menu {
|
|||||||
$redirect_url = admin_url('admin.php?page=mailpoet-newsletters');
|
$redirect_url = admin_url('admin.php?page=mailpoet-newsletters');
|
||||||
}
|
}
|
||||||
|
|
||||||
$mp2_migrator = new MP2Migrator();
|
$data = array(
|
||||||
if($mp2_migrator->isMigrationNeeded()) {
|
'settings' => Setting::getAll(),
|
||||||
$mp2_migrator->init();
|
'current_user' => wp_get_current_user(),
|
||||||
$data = array(
|
'redirect_url' => $redirect_url,
|
||||||
'log_file_url' => $mp2_migrator->log_file_url,
|
'sub_menu' => 'mailpoet-newsletters'
|
||||||
'progress_url' => $mp2_migrator->progressbar->url,
|
);
|
||||||
);
|
$this->displayPage('welcome.html', $data);
|
||||||
$this->displayPage('mp2migration.html', $data);
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$data = array(
|
function migration() {
|
||||||
'settings' => Setting::getAll(),
|
$mp2_migrator = new MP2Migrator();
|
||||||
'current_user' => wp_get_current_user(),
|
$mp2_migrator->init();
|
||||||
'redirect_url' => $redirect_url,
|
$data = array(
|
||||||
'sub_menu' => 'mailpoet-newsletters'
|
'log_file_url' => $mp2_migrator->log_file_url,
|
||||||
);
|
'progress_url' => $mp2_migrator->progressbar->url,
|
||||||
$this->displayPage('welcome.html', $data);
|
);
|
||||||
}
|
$this->displayPage('mp2migration.html', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
Reference in New Issue
Block a user