From 486ec8af9626a76e1cbb01217cdd8893ca14eed7 Mon Sep 17 00:00:00 2001 From: nguyenanhung Date: Sun, 13 Oct 2024 15:00:09 +0700 Subject: [PATCH] Add simple CodeIgniter Command --- CHANGELOG.md | 6 +++++ app/controllers/Command.php | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 app/controllers/Command.php diff --git a/CHANGELOG.md b/CHANGELOG.md index c986ae0..21ea336 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Change Log được viết theo biểu mẫu tại đây: https://keepachangelog.com/en/1.0.0/ +## [1.1.8] - 2024/10/13 + +### What's Changed + +- [x] Add simple CodeIgniter Command + ## [1.1.7] - 2024/09/08 ### What's Changed diff --git a/app/controllers/Command.php b/app/controllers/Command.php new file mode 100644 index 0000000..df603ac --- /dev/null +++ b/app/controllers/Command.php @@ -0,0 +1,50 @@ + + * @copyright 713uk13m + */ +class Command extends HungNG_CI_Base_Controllers +{ + public function __construct() + { + parent::__construct(); + $this->load->helper('directory'); + } + + public function index(): void + { + if (!is_cli()) { + show_404(); + } + ResponseOutput::writeLn('CodeIgniter Command Interface'); + } + + public function clean_cache() + { + if (!is_cli()) { + show_404(); + } + $this->command_clean_cache_file(); + } + + public function clean_opcache() + { + if (!is_cli()) { + show_404(); + } + $this->opcache_flush_reset(); + } + + public function flush_logs() + { + if (!is_cli()) { + show_404(); + } + $this->default_base_flush_logs(); + } +}