PluginProbe
Extendify / 3.2.3
Extendify v3.2.3
3.2.3 3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 All 129 releases
← All changes | app/AutoLaunch/Controllers/WPController.php +39 -5 3.1.1 → 3.2.3 View file →
@@ -8,11 +8,14 @@
8 8
9 9 defined('ABSPATH') || die('No direct access.');
10 10
11 11 use Extendify\Agent\Controllers\ChatHistoryController;
12 +use Extendify\PartnerData;
12 13 use Extendify\Shared\DataProvider\ResourceData;
13 14 use Extendify\Shared\Services\AutoUpdate\AutoUpdate;
15 +use Extendify\Shared\Services\LaunchUpdate\LaunchUpdater;
14 16 use Extendify\Shared\Services\Sanitizer;
17 +use Extendify\SiteVisibility;
15 18
16 19 /**
17 20 * The controller for interacting with WordPress.
18 21 */
@@ -156,9 +159,20 @@
156 159 \update_option('extendify_check_for_image_imports', true, false);
157 160 \delete_transient('extendify_import_images_check_delay');
158 161
159 162 \update_option('extendify_onboarding_completed', gmdate('Y-m-d\TH:i:s\Z'));
163 + // Anything already in the chat reads as an onboarding offer the user answered.
164 + ChatHistoryController::clear();
165 + LaunchUpdater::clearAttempts();
160 166
167 + if (PartnerData::setting('useComingSoon')) {
168 + SiteVisibility::markUnpublished();
169 + }
170 +
171 + if (PartnerData::setting('useSearchEngineBlock')) {
172 + SiteVisibility::blockIndexing();
173 + }
174 +
161 175 \do_action('extendify_after_launch');
162 176
163 177 return new \WP_REST_Response('ok');
164 178 }
@@ -163,23 +177,43 @@
163 177 return new \WP_REST_Response('ok');
164 178 }
165 179
166 180 /**
167 - * Runs every time the launch page loads: resets launch state (a no-op on a
168 - * fresh site, the expected reset on an existing one) and enables auto-updates.
181 + * Apply pending theme / PUC-plugin upgrades before Launch runs (see
182 + * LaunchUpdater::run, which never throws).
169 183 *
170 184 * @return \WP_REST_Response
171 185 */
186 + public static function runUpdates()
187 + {
188 + return new \WP_REST_Response(LaunchUpdater::run());
189 + }
190 +
191 + /**
192 + * Runs on every launch page load, so it must not discard site state.
193 + *
194 + * @return \WP_REST_Response
195 + */
172 196 public static function preLaunch()
173 197 {
174 - \delete_option('extendify_onboarding_completed');
175 - ChatHistoryController::clear();
176 -
177 198 if (AutoUpdate::isEnabled()) {
178 199 AutoUpdate::enableAutoUpdateForPlugin(EXTENDIFY_PLUGIN_BASENAME);
179 200 AutoUpdate::addToAutoUpdateList('auto_update_themes', 'extendable');
180 201 AutoUpdate::enableAutoUpdateForCore();
181 202 }
203 +
204 + return new \WP_REST_Response(['success' => true]);
205 + }
206 +
207 + /**
208 + * Discards the launched state after the user confirms the restart.
209 + *
210 + * @return \WP_REST_Response
211 + */
212 + public static function resetLaunchState()
213 + {
214 + \delete_option('extendify_onboarding_completed');
215 + ChatHistoryController::clear();
182 216
183 217 return new \WP_REST_Response(['success' => true]);
184 218 }
185 219 }