PluginProbe
WDesignKit – AI Templates, Widget Builder & MCP Workflow / 2.7.0
WDesignKit – AI Templates, Widget Builder & MCP Workflow v2.7.0
2.7.0 2.6.6 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.0 2.3.3 2.3.2 2.3.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 All 129 releases
wdesignkit / includes / admin / import / import-load.php

import-load.php in WDesignKit – AI Templates, Widget Builder & MCP Workflow 2.7.0, at includes/admin/import/import-load.php

92 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Loader for the PHP importer service layer.
4 *
5 * Single require point so the plugin's dependency loader gains one line rather than six.
6 *
7 * Every file below defines classes only — nothing is instantiated at load time, so requiring
8 * this has no effect on any existing request. The browser importer does not call any of it;
9 * the wizard's path through admin-ajax is unchanged.
10 *
11 * Two hooks are registered at the bottom: the deferred-thumbnail cron, and the site-side
12 * import queue, which has to be listening on cron and admin_init before either fires.
13 *
14 * Order matters slightly: the session is referenced by the AI content store, and the runner
15 * references all of them.
16 *
17 * @package Wdesignkit
18 * @since 2.6.5
19 */
20
21 if ( ! defined( 'ABSPATH' ) ) {
22 exit;
23 }
24
25 $wdkit_import_dir = __DIR__ . '/';
26
27 require_once $wdkit_import_dir . 'class-wdkit-import-log.php';
28 require_once $wdkit_import_dir . 'class-wdkit-import-css.php';
29 require_once $wdkit_import_dir . 'class-wdkit-import-errors.php';
30 require_once $wdkit_import_dir . 'class-wdkit-import-session.php';
31 require_once $wdkit_import_dir . 'class-wdkit-import-context.php';
32 require_once $wdkit_import_dir . 'class-wdkit-ai-content.php';
33 require_once $wdkit_import_dir . 'class-wdkit-import-media.php';
34 require_once $wdkit_import_dir . 'class-wdkit-import-team-images.php';
35 require_once $wdkit_import_dir . 'class-wdkit-import-dependencies.php';
36 require_once $wdkit_import_dir . 'class-wdkit-import-globals.php';
37 require_once $wdkit_import_dir . 'class-wdkit-import-settings.php';
38 require_once $wdkit_import_dir . 'class-wdkit-import-navigation.php';
39 require_once $wdkit_import_dir . 'class-wdkit-import-taxonomy.php';
40 require_once $wdkit_import_dir . 'class-wdkit-import-products.php';
41 require_once $wdkit_import_dir . 'class-wdkit-import-cleanup.php';
42 require_once $wdkit_import_dir . 'class-wdkit-import-reset.php';
43 require_once $wdkit_import_dir . 'class-wdkit-page-importer.php';
44 require_once $wdkit_import_dir . 'class-wdkit-import-posts.php';
45 require_once $wdkit_import_dir . 'class-wdkit-import-runner.php';
46 require_once $wdkit_import_dir . 'class-wdkit-import-bridge.php';
47 require_once $wdkit_import_dir . 'class-wdkit-import-wizard.php';
48 require_once $wdkit_import_dir . 'class-wdkit-import-remote.php';
49 require_once $wdkit_import_dir . 'class-wdkit-import-job-executor.php';
50
51 /* The site-side import queue. The one exception to "no hooks at load time" above: its whole
52 * job is to run on cron and on admin_init, so it has to be wired up before either fires. It
53 * registers a schedule and two actions and does nothing else until this site has been
54 * registered for imports. */
55 if ( class_exists( 'Wdkit_Import_Remote' ) ) {
56 Wdkit_Import_Remote::init();
57 }
58
59 /* The other half: runs a claimed job through wdkit_create_full_site. Listens for the action
60 * the transport fires, so it has to be wired up before any cron tick can claim anything. */
61 if ( class_exists( 'Wdkit_Import_Job_Executor' ) ) {
62 Wdkit_Import_Job_Executor::init();
63 }
64
65 /* Page warm-up, deferred out of the import request. Doing it inline deadlocked against the
66 * worker the import itself was holding — see the note in stage_finalize(). The event carries
67 * every imported page's URL; one scheduled by an older version carries none and warms the
68 * front page alone, as it always did. */
69 add_action(
70 'wdkit_warm_imported_front',
71 function ( $urls = array() ) {
72 if ( class_exists( 'Wdkit_Import_Css' ) ) {
73 $urls = is_array( $urls ) ? $urls : array();
74
75 /* Twice, for the reason the wizard's warm-up runs twice: each page's first render
76 * records its templates and invalidates the pages warmed before it. */
77 Wdkit_Import_Css::warm( $urls );
78 Wdkit_Import_Css::warm( $urls );
79 }
80 }
81 );
82
83 /* Thumbnail sizes the import deliberately skipped, built afterwards by cron. */
84 add_action(
85 'wdkit_regenerate_import_thumbnails',
86 function () {
87 if ( class_exists( 'Wdkit_Import_Media' ) ) {
88 Wdkit_Import_Media::regenerate_pending_thumbnails();
89 }
90 }
91 );
92