Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions helpers/file_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function formatSizeUnits($bytes)
return $bytes;
}
}
if ( ! function_exists('generateFileIndex')) {
if (!function_exists('generateFileIndex')) {
/**
* Function generateFileIndex
*
Expand Down Expand Up @@ -164,7 +164,7 @@ function generateFileIndex($file_path = '', $file_name = 'index.html')
return false;
}
}
if ( ! function_exists('generateFileHtaccess')) {
if (!function_exists('generateFileHtaccess')) {
/**
* Function generateFileHtaccess
*
Expand Down Expand Up @@ -208,7 +208,7 @@ function generateFileHtaccess($file_path = '', $file_name = '.htaccess')
return false;
}
}
if ( ! function_exists('generateFileReadme')) {
if (!function_exists('generateFileReadme')) {
/**
* Function genarateFileReadme
*
Expand Down Expand Up @@ -256,7 +256,7 @@ function generateFileReadme($file_path = '', $file_name = 'README.md')
* Function makeNewFolder
*
* @param string $folderPath
* @param bool $gitkeep
* @param bool $gitkeep
*
* @return bool
* @author : 713uk13m <dev@nguyenanhung.com>
Expand Down Expand Up @@ -303,7 +303,7 @@ function makeNewFolder($folderPath = '', $gitkeep = false)
* Function new_folder
*
* @param string $folder
* @param bool $gitkeep
* @param bool $gitkeep
*
* @return bool
* @author : 713uk13m <dev@nguyenanhung.com>
Expand Down Expand Up @@ -425,3 +425,38 @@ function getAllFileInFolder($path)
}
}
}
if (!function_exists('init_basic_codeigniter_storage_directory')) {
function init_basic_codeigniter_storage_directory($customizes = array())
{
if (is_cli() && (defined('APPPATH') && defined('FCPATH'))) {
echo "Initialize storage directory" . PHP_EOL;

makeNewFolder(APPPATH . 'cache');
makeNewFolder(APPPATH . 'cache/ci_sessions');
makeNewFolder(APPPATH . 'logs');
makeNewFolder(APPPATH . 'logs-data');

makeNewFolder(FCPATH . 'storage');
makeNewFolder(FCPATH . 'storage/cache');
makeNewFolder(FCPATH . 'storage/cache_db');
makeNewFolder(FCPATH . 'storage/cache_page');
makeNewFolder(FCPATH . 'storage/ci_sessions');
makeNewFolder(FCPATH . 'storage/cookies');
makeNewFolder(FCPATH . 'storage/htmlPurity');
makeNewFolder(FCPATH . 'storage/tmp');
makeNewFolder(FCPATH . 'storage/logs');
makeNewFolder(FCPATH . 'storage/logs/Requests');
makeNewFolder(FCPATH . 'storage/logs-vendor');
file_create(FCPATH . 'storage/logs/accessDenied.log');

if (!empty($customizes) && is_array($customizes)) {
foreach ($customizes as $folder) {
makeNewFolder($folder);
}
}

echo "Storage directory initialized successfully" . PHP_EOL;
}
exit();
}
}
4 changes: 2 additions & 2 deletions src/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
class BaseHelper
{
const VERSION = '1.6.5';
const LAST_MODIFIED = '2024-09-08';
const VERSION = '1.6.6';
const LAST_MODIFIED = '2024-09-15';
const PROJECT_NAME = 'CodeIgniter - Basic Helper';
const AUTHOR_NAME = 'Hung Nguyen';
const AUTHOR_FULL_NAME = 'Hung Nguyen';
Expand Down