File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323/**
2424 * Class IndexController
2525 */
26- class IndexController
26+ class IndexController extends ApiController
2727{
2828 /**
2929 * @return string
@@ -32,4 +32,28 @@ public function index()
3232 {
3333 return \View::make ('front.api-index ' );
3434 }
35+
36+ /**
37+ * Reset OPcache
38+ *
39+ * @return \Illuminate\Http\Response
40+ */
41+ public function resetOpcache (string $ token )
42+ {
43+ $ validToken = config ('app.opcache_webhook_token ' , null );
44+
45+ if (empty ($ validToken ) || $ token !== $ validToken ) {
46+ return $ this ->errorUnauthorized ('Invalid reset token. ' );
47+ }
48+
49+ if (function_exists ('opcache_reset ' )) {
50+ if (opcache_reset ()) {
51+ return $ this ->respondWithArray (['message ' => 'OPcache reset successful ' ]);
52+ }
53+
54+ return $ this ->errorInternalError ('OPcache reset failed ' );
55+ }
56+
57+ return $ this ->errorInternalError ('OPcache extension not loaded ' );
58+ }
3559}
You can’t perform that action at this time.
0 commit comments