PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
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 0.5.0 0.6.0 All 127 releases
← All changes | app/AutoLaunch/Controllers/WPController.php +22 -5 3.1.63.2.1 View file →
@@ -8,12 +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;
14 15 use Extendify\Shared\Services\LaunchUpdate\LaunchUpdater;
15 16 use Extendify\Shared\Services\Sanitizer;
17 +use Extendify\SiteVisibility;
16 18
17 19 /**
18 20 * The controller for interacting with WordPress.
19 21 */
@@ -157,10 +159,16 @@
157 159 \update_option('extendify_check_for_image_imports', true, false);
158 160 \delete_transient('extendify_import_images_check_delay');
159 161
160 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();
161 165 LaunchUpdater::clearAttempts();
162 166
167 + if (PartnerData::setting('useComingSoon')) {
168 + SiteVisibility::markUnpublished();
169 + }
170 +
163 171 \do_action('extendify_after_launch');
164 172
165 173 return new \WP_REST_Response('ok');
166 174 }
@@ -176,23 +184,32 @@
176 184 return new \WP_REST_Response(LaunchUpdater::run());
177 185 }
178 186
179 187 /**
180 - * Runs every time the launch page loads: resets launch state (a no-op on a
181 - * fresh site, the expected reset on an existing one) and enables auto-updates.
188 + * Runs on every launch page load, so it must not discard site state.
182 189 *
183 190 * @return \WP_REST_Response
184 191 */
185 192 public static function preLaunch()
186 193 {
187 - \delete_option('extendify_onboarding_completed');
188 - ChatHistoryController::clear();
189 -
190 194 if (AutoUpdate::isEnabled()) {
191 195 AutoUpdate::enableAutoUpdateForPlugin(EXTENDIFY_PLUGIN_BASENAME);
192 196 AutoUpdate::addToAutoUpdateList('auto_update_themes', 'extendable');
193 197 AutoUpdate::enableAutoUpdateForCore();
194 198 }
199 +
200 + return new \WP_REST_Response(['success' => true]);
201 + }
202 +
203 + /**
204 + * Discards the launched state after the user confirms the restart.
205 + *
206 + * @return \WP_REST_Response
207 + */
208 + public static function resetLaunchState()
209 + {
210 + \delete_option('extendify_onboarding_completed');
211 + ChatHistoryController::clear();
195 212
196 213 return new \WP_REST_Response(['success' => true]);
197 214 }
198 215 }