diff --git a/op_cache.php b/op_cache.php new file mode 100644 index 0000000..ce79499 --- /dev/null +++ b/op_cache.php @@ -0,0 +1,28 @@ +load_controller(); +//} diff --git a/src/mockup/cli_controllers/app/home_ctrl.php b/src/mockup/cli_controllers/app/home_ctrl.php index ac752bd..aa57b6e 100644 --- a/src/mockup/cli_controllers/app/home_ctrl.php +++ b/src/mockup/cli_controllers/app/home_ctrl.php @@ -9,6 +9,61 @@ class home_ctrl { public function index() { echo "Welcome to Index CLI..."; } + + public function op_cache() { + if (!opcache_get_status()) { + echo "Op-Cache NOT Enabled!!!"; + exit(1); + } + + $all_files = []; + + $prj = PROJECT_BASE_DIR; + + $public = dirname($prj, 1) . "/public/"; + + $all_files[] = $public . "main.page"; + + $dir = \main_tts\TTS_FRAMEWORK . "bootstrap/"; + foreach (glob($dir . "*.php") as $filename) { + if (str_contains($filename, "errors.php")) { + continue; + } + $all_files[] = $filename; + } + + $dir = \main_tts\TTS_FRAMEWORK . "classes/"; + $all_files[] = $dir . "console_app.php"; + $all_files[] = $dir . "app.php"; + $all_files[] = $dir . "assets.php"; + $all_files[] = $dir . "html_document.php"; + $all_files[] = $dir . "loadall.php"; + $all_files[] = $dir . "request.php"; + $all_files[] = $dir . "router.php"; + $all_files[] = $dir . "security.php"; + $all_files[] = $dir . "tag_matches.php"; + $all_files[] = $dir . "view.php"; + $all_files[] = $dir . "database/help_load.php"; + $all_files[] = $dir . "database/help_save.php"; + $all_files[] = $dir . "database/paginate.php"; + $all_files[] = $dir . "traits/database/run_sql.php"; + $all_files[] = $dir . "traits/database/validation.php"; + $all_files[] = $dir . "traits/security/csrf_token_functions.php"; + $all_files[] = $dir . "traits/security/session_hijacking_functions.php"; + $i = 0; + foreach ($all_files as $file) { + $i++; + $results = opcache_compile_file($file); + if ($results) { + echo "Added to cache, the file: $file" . PHP_EOL; + } else { + echo "FAILED to cache file: $file" . PHP_EOL; + } + + } + echo "Total Compiled: $i" . PHP_EOL; + echo PHP_EOL . "Done with OP-Cache Compile..." . PHP_EOL; + } public function name_demo() { echo "Name Demo CLI..."; diff --git a/src/mockup/controllers/app/home_ctrl.php b/src/mockup/controllers/app/home_ctrl.php index 98376ed..b57123f 100644 --- a/src/mockup/controllers/app/home_ctrl.php +++ b/src/mockup/controllers/app/home_ctrl.php @@ -38,6 +38,11 @@ class home_ctrl { $view->render($this); } + public function opcache_check() { + \bs_tts\common::dump(opcache_get_status(true)); +// print_r(realpath_cache_get()); + } + public function error() { tts_broken_error(); } // Needed: To show Live Page for Broken Pages } \ No newline at end of file