get_method() === 'POST' && $request->get_route() === '/wp/v2/plugins' && filter_var($request->get_header('X-Extendify-Force-Reinstall'), FILTER_VALIDATE_BOOLEAN); self::$slug = self::$forcing ? (string) $request->get_param('slug') : ''; return $response; } /** * Without the slug check, force-reinstalling any other plugin would land in * our folder. * * @param string|\WP_Error $source - The extracted package folder. * @param string $remoteSource - The temporary folder holding it. * @return string|\WP_Error */ public static function useInstalledDirectory($source, $remoteSource) { if (self::$slug !== Config::$slug) { return $source; } return LaunchUpdater::useInstalledDirectory($source, $remoteSource); } /** * @param array $options - The upgrader package options. * @return array */ public static function clearDestination($options) { if (self::$forcing) { $options['clear_destination'] = true; } return $options; } }