servdhost / craft-asset-storage

MIT License
10 stars 1 forks source link

Servd Cache Purge Missing #30

Closed mortscode closed 3 years ago

mortscode commented 3 years ago

Servd Assets Plugin / Version 2.4.6

Servd Static Cache Purge is no longer in Utilities > Cache image

When I run clear-caches/servd-static-cache I'm also getting an error:

Unknown command: clear-caches/servd-static-cache
Caused by: Exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request: clear-caches/servd-static-cache'

in /app/vendor/yiisoft/yii2/base/Controller.php:152

Stack trace:
#0 /app/vendor/yiisoft/yii2/console/Controller.php(184): yii\base\Controller->runAction('servd-static-ca...', Array)
#1 /app/vendor/craftcms/cms/src/console/Controller.php(221): yii\console\Controller->runAction('servd-static-ca...', Array)
#2 /app/vendor/yiisoft/yii2/base/Module.php(534): craft\console\Controller->runAction('servd-static-ca...', Array)
#3 /app/vendor/yiisoft/yii2/console/Application.php(181): yii\base\Module->runAction('clear-caches/se...', Array)
#4 /app/vendor/craftcms/cms/src/console/Application.php(89): yii\console\Application->runAction('clear-caches/se...', Array)
#5 /app/vendor/yiisoft/yii2/console/Application.php(148): craft\console\Application->runAction('clear-caches/se...', Array)
#6 /app/vendor/yiisoft/yii2/base/Application.php(392): yii\console\Application->handleRequest(Object(craft\console\Request))
#7 /app/craft(22): yii\base\Application->run()
mortscode commented 3 years ago

I downgraded to version 2.4.4 and the missing cache purge problem persists. I'm baffled.

mortscode commented 3 years ago

I installed it into my plugin development environment and I'm getting the same issue. I downgraded craft 1 version and servd-asset-storage 2 versions. Uninstalled all other plugins and the Servd Purge Cache utilities are still missing. Racking my brain to figure out what I might have changed?

mortscode commented 3 years ago

In my vendor > servd > craft-asset-storage > src > StaticCache > StaticCache.php file, I'm seeing the registerEventHandlers() method:

private function registerEventHandlers()
    {

        Event::on(
            ClearCaches::class,
            ClearCaches::EVENT_REGISTER_CACHE_OPTIONS,
            function (RegisterCacheOptionsEvent $event) {
                $event->options[] = [
                    'key' => 'servd-static-cache',
                    'label' => Craft::t('servd-asset-storage', 'Servd Static Cache'),
                    'action' => function () {
                        $this->clearStaticCache();
                    },
                ];

                /***
                 * Deprecated cli key
                 */
                $event->options[] = [
                    'key' => 'servd-asset-storage',
                    'label' => Craft::t('servd-asset-storage', 'Servd Static Cache (Deprecated)'),
                    'action' => function () {
                        $this->clearStaticCache();
                    },
                ];
            }
        );
    }
mortscode commented 3 years ago

The "Servd Static Cache" & Depreciated checkboxes are still present in the utilities on my Production build from 4 days ago: image

I have some updates to push but I'm hesitant to do so because we rely pretty heavily on the ability to dump the cache.

mattgrayisok commented 3 years ago

Hey @mortscode

The static cache functionality within the plugin is disabled in local dev and only activates when running within Servd. That's because the code for the static cache integration talks directly to some components within the Servd platform that wouldn't exist in your local dev env, so would cause errors when updating entries etc!

Nothing significant has changed with the static cache implementation recently so you should be ok to get things updated. You can test in Staging within Servd first too if you'd like to double check everything is working as expected.

mortscode commented 3 years ago

I was having an issue with my plugin working locally—behaving in a way that historically that has been solved with a cache clear. I thought I was losing my mind. Gotta stop staying up so late I guess.

Sorry about that. Please throw this issue off a high cliff.