new file: olm-login.php
This commit is contained in:
@@ -10,6 +10,7 @@ use KbMarkdownImporter\Admin\SyncPage;
|
||||
use KbMarkdownImporter\Frontend\Router;
|
||||
use KbMarkdownImporter\Frontend\SearchController;
|
||||
use KbMarkdownImporter\Import\ImportManager;
|
||||
use KbMarkdownImporter\Olm\ChangelogSync;
|
||||
|
||||
final class Plugin
|
||||
{
|
||||
@@ -135,7 +136,15 @@ final class Plugin
|
||||
|
||||
register_rest_route('kb-markdown/v1', '/sync', [
|
||||
'methods' => 'POST',
|
||||
'callback' => static fn (\WP_REST_Request $request): \WP_REST_Response => (new ImportManager())->syncAll((bool) $request->get_param('dry_run')),
|
||||
'callback' => static function (\WP_REST_Request $request): \WP_REST_Response {
|
||||
$response = (new ImportManager())->syncAll((bool) $request->get_param('dry_run'));
|
||||
|
||||
if (! (bool) $request->get_param('dry_run')) {
|
||||
(new ChangelogSync())->sync();
|
||||
}
|
||||
|
||||
return $response;
|
||||
},
|
||||
'permission_callback' => static fn (): bool => current_user_can('sync_kb_docs'),
|
||||
]);
|
||||
|
||||
@@ -145,6 +154,12 @@ final class Plugin
|
||||
'permission_callback' => static fn (): bool => current_user_can('sync_kb_docs'),
|
||||
]);
|
||||
|
||||
register_rest_route('kb-markdown/v1', '/sync/changelog', [
|
||||
'methods' => 'POST',
|
||||
'callback' => static fn (): \WP_REST_Response => (new ChangelogSync())->sync(),
|
||||
'permission_callback' => static fn (): bool => current_user_can('sync_kb_docs'),
|
||||
]);
|
||||
|
||||
register_rest_route('kb-markdown/v1', '/search', [
|
||||
'methods' => 'GET',
|
||||
'callback' => [SearchController::class, 'restSearch'],
|
||||
@@ -179,6 +194,7 @@ final class Plugin
|
||||
public function runCronSync(): void
|
||||
{
|
||||
(new ImportManager())->syncAll(false);
|
||||
(new ChangelogSync())->sync();
|
||||
}
|
||||
|
||||
public function enqueueFrontendAssets(): void
|
||||
|
||||
Reference in New Issue
Block a user