-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from nguyenanhung/develop
Add function: init_basic_codeigniter_storage_directory
- Loading branch information
Showing
2 changed files
with
42 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,7 +120,7 @@ function formatSizeUnits($bytes) | |
return $bytes; | ||
} | ||
} | ||
if ( ! function_exists('generateFileIndex')) { | ||
if (!function_exists('generateFileIndex')) { | ||
/** | ||
* Function generateFileIndex | ||
* | ||
|
@@ -164,7 +164,7 @@ function generateFileIndex($file_path = '', $file_name = 'index.html') | |
return false; | ||
} | ||
} | ||
if ( ! function_exists('generateFileHtaccess')) { | ||
if (!function_exists('generateFileHtaccess')) { | ||
/** | ||
* Function generateFileHtaccess | ||
* | ||
|
@@ -208,7 +208,7 @@ function generateFileHtaccess($file_path = '', $file_name = '.htaccess') | |
return false; | ||
} | ||
} | ||
if ( ! function_exists('generateFileReadme')) { | ||
if (!function_exists('generateFileReadme')) { | ||
/** | ||
* Function genarateFileReadme | ||
* | ||
|
@@ -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 <[email protected]> | ||
|
@@ -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 <[email protected]> | ||
|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters