Plugin Directory


Ignore:
Timestamp:
10/27/2026 04:27:21 AM (10 hours ago)
Author:
softminal
Message:

Release 1.1.0: CDN URL rewrite, Cloudflare and Varnish clearing, delay JavaScript, combine CSS and JS, minify HTML

File:
1 edited

Legend:

Unmodified
Added
Removed
  • softminal-cache/trunk/app/Http/Controllers/CacheController.php

    r3763679 r3767725  
    33namespace SoftminalCache\App\Http\Controllers;
    44
     5use SoftminalCache\App\Admin\ReviewAsk;
    56use SoftminalCache\App\Cache\Config;
    67use SoftminalCache\App\Cache\ConfigFile;
    … …  
    1718use SoftminalCache\App\Check\SelfCheck;
    1819use SoftminalCache\App\Core\Compat;
     20use SoftminalCache\App\Edge\Edge;
    1921use SoftminalCache\App\Preload\HostLimits;
    2022use SoftminalCache\App\Preload\Preloader;
    … …  
    2729use SoftminalCache\App\Images\Stats as ImageStats;
    2830use SoftminalCache\App\Modules\Bloat;
     31use SoftminalCache\App\Modules\Cdn;
     32use SoftminalCache\App\Modules\CdnCheck;
    2933use SoftminalCache\App\Modules\Images;
    3034use SoftminalCache\App\Modules\Js;
    … …  
    230234
    231235        return $this->success($this->payload(), __('Cache cleared.', 'softminal-cache'));
     236    }
     237
     238    /** The review card: "later" asks again in two weeks, "done" never again. */
     239    public function review(\WP_REST_Request $request): \WP_REST_Response
     240    {
     241        $data = $this->validated($request, ['answer' => 'required|in:later,done']);
     242        ReviewAsk::answer(get_current_user_id(), $data['answer'] === 'done' ? 'done' : 'later');
     243
     244        return $this->success(ReviewAsk::status(get_current_user_id()));
     245    }
     246
     247    /** Fetch one core file through a CDN address, to check its origin before it is used. */
     248    public function cdnTest(\WP_REST_Request $request): \WP_REST_Response
     249    {
     250        $data = $this->validated($request, ['url' => 'required|string|max:200']);
     251
     252        return $this->success(CdnCheck::run((string) $data['url']));
    232253    }
    233254
    … …  
    284305                'bloat' => ['overlap' => Compat::overlaps('bloat'), 'heartbeat' => Bloat::HEARTBEAT, 'revisions' => Bloat::REVISIONS],
    285306                'css'   => ['overlap' => Compat::overlaps('css')],
     307                'html'  => ['overlap' => Compat::overlaps('html')],
     308                'cdn'   => ['overlap' => Compat::overlaps('cdn'), 'hosts' => Config::hosts(), 'types' => array_keys(Cdn::TYPES), 'max' => Cdn::MAX_URLS],
    286309                'script-manager' => ['overlap' => Compat::overlaps('script-manager'), 'seen' => Seen::all(), 'protected' => ScriptRules::PROTECTED, 'homeUrl' => home_url('/'), 'maxPages' => ScriptRules::MAX_PAGES],
    287310                'fonts' => ['overlap' => Compat::overlaps('fonts')] + GoogleFonts::status(),
    … …  
    296319            'lastPurge'  => isset($state['last_purge']) ? (int) $state['last_purge'] : null,
    297320            'safeMode'   => ['on' => SafeMode::active(), 'source' => SafeMode::source()],
     321            'review'     => ReviewAsk::status(get_current_user_id()),
     322            'edge'       => Edge::status() + ['overlaps' => ['cloudflare' => Compat::overlaps('cloudflare'), 'varnish' => Compat::overlaps('varnish')]],
    298323            'compat'     => Compat::summary() + ['moduleErrors' => Modules::errors()],
    299324            'undo'       => $this->undoPayload(),
Note: See TracChangeset for help on using the changeset viewer.