new file: olm-login.php
This commit is contained in:
@@ -6,6 +6,7 @@ namespace KbMarkdownImporter\Admin;
|
||||
use KbMarkdownImporter\GitLab\GitLabClient;
|
||||
use KbMarkdownImporter\Import\ImportLogger;
|
||||
use KbMarkdownImporter\Import\ImportManager;
|
||||
use KbMarkdownImporter\Olm\ChangelogSync;
|
||||
use KbMarkdownImporter\Plugin;
|
||||
|
||||
final class SyncPage
|
||||
@@ -24,6 +25,7 @@ final class SyncPage
|
||||
<form method="post" class="kb-sync-actions">
|
||||
<?php wp_nonce_field('kb_markdown_sync'); ?>
|
||||
<?php submit_button(__('Sync All', 'kb-markdown-importer'), 'primary', 'kb_markdown_sync_all', false); ?>
|
||||
<?php submit_button(__('Sync OLM Changelog', 'kb-markdown-importer'), 'secondary', 'kb_markdown_sync_changelog', false); ?>
|
||||
<?php submit_button(__('Dry Run', 'kb-markdown-importer'), 'secondary', 'kb_markdown_dry_run', false); ?>
|
||||
</form>
|
||||
|
||||
@@ -63,9 +65,20 @@ final class SyncPage
|
||||
{
|
||||
if (isset($_POST['kb_markdown_sync_all']) && check_admin_referer('kb_markdown_sync')) {
|
||||
(new ImportManager())->syncAll(false);
|
||||
(new ChangelogSync())->sync();
|
||||
echo '<div class="notice notice-success"><p>' . esc_html__('Synchronization finished.', 'kb-markdown-importer') . '</p></div>';
|
||||
}
|
||||
|
||||
if (isset($_POST['kb_markdown_sync_changelog']) && check_admin_referer('kb_markdown_sync')) {
|
||||
$response = (new ChangelogSync())->sync();
|
||||
$data = (array) $response->get_data();
|
||||
$success = true === ($data['success'] ?? false);
|
||||
$message = $success
|
||||
? __('OLM changelog synchronization finished.', 'kb-markdown-importer')
|
||||
: (string) ($data['message'] ?? __('OLM changelog synchronization failed.', 'kb-markdown-importer'));
|
||||
echo '<div class="notice notice-' . ($success ? 'success' : 'error') . '"><p>' . esc_html($message) . '</p></div>';
|
||||
}
|
||||
|
||||
if (isset($_POST['kb_markdown_dry_run']) && check_admin_referer('kb_markdown_sync')) {
|
||||
(new ImportManager())->syncAll(true);
|
||||
echo '<div class="notice notice-info"><p>' . esc_html__('Dry run finished.', 'kb-markdown-importer') . '</p></div>';
|
||||
|
||||
Reference in New Issue
Block a user