├── .gitignore ├── CacheManager ├── CacheManager.php ├── CacheManagerController.php ├── CacheManagerListener.php ├── CacheManagerWidget.php ├── meta.yaml ├── resources │ ├── assets │ │ └── css │ │ │ └── cachemanager.css │ └── views │ │ └── widget.blade.php └── routes.yaml ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | node_modules/ 3 | .idea 4 | 5 | # Laravel 4 specific 6 | bootstrap/compiled.php 7 | app/storage/ 8 | 9 | # Laravel 5 & Lumen specific 10 | bootstrap/cache/ 11 | storage/ 12 | .env.*.php 13 | .env.php 14 | .env 15 | .env.example -------------------------------------------------------------------------------- /CacheManager/CacheManager.php: -------------------------------------------------------------------------------- 1 | cachemanager = new CacheManager(); 19 | } 20 | 21 | /** 22 | * Clear Statamic cache 23 | */ 24 | public function clearAll() 25 | { 26 | try { 27 | // Update feed 28 | $this->cachemanager->clearCache(); 29 | 30 | // Log success returns 31 | Log::info('All cache cleared successfully'); 32 | 33 | // Return back to dashboard with success message 34 | return back()->with('success', 'All cache cleared successfully'); 35 | } catch (\Exception $e) { 36 | Log::error('Problem clearing your cache'); 37 | return back()->withErrors('error', ' Problem clearing your all/one of cache' . $e); 38 | } 39 | } 40 | 41 | 42 | /** 43 | * Update Stache cache 44 | */ 45 | public function updateStache() 46 | { 47 | try { 48 | // Update feed 49 | $this->cachemanager->updateStache(); 50 | 51 | // Log success returns 52 | Log::info('Stache updated successfully'); 53 | 54 | // Return back to dashboard with success message 55 | return back()->with('success', 'Stache updated successfully'); 56 | } catch (\Exception $e) { 57 | Log::error('Problem updating your stache'); 58 | return back()->withErrors('error', ' Problem updating your stache' . $e); 59 | } 60 | } 61 | 62 | 63 | /** 64 | * Clear Statamic cache 65 | */ 66 | public function clearCache() 67 | { 68 | 69 | try { 70 | // Update feed 71 | $this->cachemanager->clearCache(); 72 | 73 | // Log success returns 74 | Log::info('Cache cleared successfully'); 75 | 76 | // Return back to dashboard with success message 77 | return back()->with('success', 'Cache cleared successfully'); 78 | } catch (\Exception $e) { 79 | Log::error('Problem clearing your cache'); 80 | return back()->withErrors('error', ' Problem clearing your cache' . $e); 81 | } 82 | } 83 | 84 | 85 | /** 86 | * Clear Glide cache 87 | */ 88 | public function clearGlide() 89 | { 90 | 91 | try { 92 | $this->cachemanager->clearGlide(); 93 | 94 | // Log success returns 95 | Log::info('Glide cache cleared successfully'); 96 | 97 | // Return back to dashboard with success message 98 | return back()->with('success', 'Glide cache cleared successfully'); 99 | } catch (\Exception $e) { 100 | Log::error('Problem clearing glide cache'); 101 | return back()->withErrors('error', ' Problem clearing glide cache' . $e); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /CacheManager/CacheManagerListener.php: -------------------------------------------------------------------------------- 1 | 'initCacheManager', 16 | ]; 17 | 18 | 19 | /** 20 | * Initialize Aggregator assets 21 | * @return string 22 | */ 23 | public function initCacheManager() 24 | { 25 | return $this->css->tag('cachemanager.css'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CacheManager/CacheManagerWidget.php: -------------------------------------------------------------------------------- 1 | getMeta()['url']; 18 | 19 | return $this->view('widget', compact('github_page'))->render(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CacheManager/meta.yaml: -------------------------------------------------------------------------------- 1 | name: CacheManager 2 | version: 1.0.3 3 | description: Manage your statamic cache 4 | url: https://github.com/lesaff/statamic-cachemanager 5 | developer: Rudy Affandi 6 | developer_url: https://github.com/lesaff 7 | -------------------------------------------------------------------------------- /CacheManager/resources/assets/css/cachemanager.css: -------------------------------------------------------------------------------- 1 | #cachemanager .list { 2 | list-style-type: none; 3 | margin: 10px 0; 4 | padding: 0; 5 | } 6 | 7 | #cachemanager .list li { 8 | margin-bottom: 5px; 9 | padding: 0; 10 | } 11 | 12 | #cachemanager .list-separator li.border-top, 13 | #cachemanager .row-separator { 14 | border-top: 1px dotted #e0e0e0; 15 | margin-top: 5px; 16 | padding-top: 5px; 17 | } 18 | 19 | #cachemanager .list-separator li.first, 20 | #cachemanager .list li.first { 21 | border-top: 0 !important; 22 | } 23 | -------------------------------------------------------------------------------- /CacheManager/resources/views/widget.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Cache Manager

4 | 5 |
6 | 9 | 13 |
14 | 15 |
16 | 17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 | 29 | 30 | 31 | 34 | 35 | 36 |
22 | Clear Cache 23 |
27 | Clear Glide (image) cache 28 |
32 | Update Stache 33 |
37 |
38 |
39 | -------------------------------------------------------------------------------- /CacheManager/routes.yaml: -------------------------------------------------------------------------------- 1 | routes: 2 | /: index 3 | 4 | /clear-all: 5 | uses: clearAll 6 | as: cachemanager.clear-all 7 | /clear-cache: 8 | uses: clearCache 9 | as: cachemanager.clear-cache 10 | /update-stache: 11 | uses: updateStache 12 | as: cachemanager.update-stache 13 | /clear-glide: 14 | uses: clearGlide 15 | as: cachemanager.clear-glide 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Rudy Affandi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # statamic-cachemanager 2 | Cache Manager Widget for Statamic V2.x 3 | by Rudy Affandi (2016) 4 | 5 | ![screen shot 2016-04-11 at 2 10 17 pm](https://cloud.githubusercontent.com/assets/1151181/14435616/2ab8a1a4-ffef-11e5-8b38-99094c56b7f3.png) 6 | 7 | ## What is this? 8 | CacheManager is a Statamic V2.x dashboard widget that allows you to clear your cache/stache directly from the control panel. This is equivalent to the `php please cache:clear` command. 9 | 10 | ## Installation 11 | Copy `CacheManager` to your `site/addons` folder. Open your control panel, go to the Settings / Control Panel and add the following: 12 | ``` 13 | - 14 | type: CacheManager 15 | width: 33 16 | ``` 17 | 18 | Save it and visit your Dashboard. 19 | 20 | ## Road map 21 | - Add static cache, Pagespeed, Opcache, APC Cache clearing method 22 | - Add other features (metrics, time stamp, etc) 23 | 24 | ## Bugs 25 | Please use the github issue to report bugs. 26 | 27 | ## I like this, how can I contribute? 28 | Feel free to fork this repo and send me a Pull Request. 29 | --------------------------------------------------------------------------------