Added op_cache.php to auto-load HOT files.

main
Robert 3 years ago
parent f0799885f3
commit a27f96a986
  1. 28
      op_cache.php
  2. 55
      src/mockup/cli_controllers/app/home_ctrl.php
  3. 5
      src/mockup/controllers/app/home_ctrl.php

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
require 'src/before_main.php';
\bs_tts\site_helper::set_all_projects(['mockup']);
\bs_tts\site_helper::set_default_project("mockup");
$PHPUNIT_Testing = false;
$cli_args = "/mockup/app/home/op_cache";
\bs_tts\site_helper::init(PROJECT_BASE_DIR, $cli_args, "get", $PHPUNIT_Testing);
require 'src/main.php';
if (\tts\console_app::is_cli() === false) {
echo 'Unable to Start';
exit;
}
echo 'Starting...' . PHP_EOL;
//$returned_route = \tts\router::execute();
//if ($returned_route["found"] === false) {
$app = new \tts\app();
$app->load_controller();
//}

@ -9,6 +9,61 @@ class home_ctrl {
public function index() { public function index() {
echo "Welcome to Index CLI..."; 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() { public function name_demo() {
echo "Name Demo CLI..."; echo "Name Demo CLI...";

@ -38,6 +38,11 @@ class home_ctrl {
$view->render($this); $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 public function error() { tts_broken_error(); } // Needed: To show Live Page for Broken Pages
} }
Loading…
Cancel
Save