@@ -120,9 +120,9 @@ function formatSizeUnits($bytes)
120
120
return $ bytes ;
121
121
}
122
122
}
123
- if (! function_exists ('genarateFileIndex ' )) {
123
+ if ( ! function_exists ('generateFileIndex ' )) {
124
124
/**
125
- * Function genarateFileIndex
125
+ * Function generateFileIndex
126
126
*
127
127
* @param string $file_path
128
128
* @param string $file_name
@@ -132,7 +132,7 @@ function formatSizeUnits($bytes)
132
132
* @copyright: 713uk13m <[email protected] >
133
133
* @time : 09/11/2021 55:13
134
134
*/
135
- function genarateFileIndex ($ file_path = '' , $ file_name = 'index.html ' )
135
+ function generateFileIndex ($ file_path = '' , $ file_name = 'index.html ' )
136
136
{
137
137
if (function_exists ('log_message ' ) && function_exists ('write_file ' )) {
138
138
if ($ file_path !== '' ) {
@@ -164,9 +164,9 @@ function genarateFileIndex($file_path = '', $file_name = 'index.html')
164
164
return false ;
165
165
}
166
166
}
167
- if (! function_exists ('genarateFileHtaccess ' )) {
167
+ if ( ! function_exists ('generateFileHtaccess ' )) {
168
168
/**
169
- * Function genarateFileHtaccess
169
+ * Function generateFileHtaccess
170
170
*
171
171
* @param string $file_path
172
172
* @param string $file_name
@@ -176,7 +176,7 @@ function genarateFileIndex($file_path = '', $file_name = 'index.html')
176
176
* @copyright: 713uk13m <[email protected] >
177
177
* @time : 09/11/2021 55:51
178
178
*/
179
- function genarateFileHtaccess ($ file_path = '' , $ file_name = '.htaccess ' )
179
+ function generateFileHtaccess ($ file_path = '' , $ file_name = '.htaccess ' )
180
180
{
181
181
if (function_exists ('log_message ' ) && function_exists ('write_file ' )) {
182
182
if ($ file_path !== '' ) {
@@ -208,7 +208,7 @@ function genarateFileHtaccess($file_path = '', $file_name = '.htaccess')
208
208
return false ;
209
209
}
210
210
}
211
- if (! function_exists ('genarateFileReadme ' )) {
211
+ if ( ! function_exists ('generateFileReadme ' )) {
212
212
/**
213
213
* Function genarateFileReadme
214
214
*
@@ -220,7 +220,7 @@ function genarateFileHtaccess($file_path = '', $file_name = '.htaccess')
220
220
* @copyright: 713uk13m <[email protected] >
221
221
* @time : 09/15/2021 58:14
222
222
*/
223
- function genarateFileReadme ($ file_path = '' , $ file_name = 'README.md ' )
223
+ function generateFileReadme ($ file_path = '' , $ file_name = 'README.md ' )
224
224
{
225
225
if (function_exists ('log_message ' ) && function_exists ('write_file ' )) {
226
226
if ($ file_path !== '' ) {
@@ -256,13 +256,14 @@ function genarateFileReadme($file_path = '', $file_name = 'README.md')
256
256
* Function makeNewFolder
257
257
*
258
258
* @param string $folderPath
259
+ * @param bool $gitkeep
259
260
*
260
261
* @return bool
261
262
* @author : 713uk13m <[email protected] >
262
263
* @copyright: 713uk13m <[email protected] >
263
264
* @time : 09/11/2021 57:33
264
265
*/
265
- function makeNewFolder ($ folderPath = '' )
266
+ function makeNewFolder ($ folderPath = '' , $ gitkeep = false )
266
267
{
267
268
if (empty ($ folderPath )) {
268
269
return false ;
@@ -271,10 +272,26 @@ function makeNewFolder($folderPath = '')
271
272
if (!mkdir ($ folderPath ) && !is_dir ($ folderPath )) {
272
273
throw new RuntimeException (sprintf ('Directory "%s" was not created ' , $ folderPath ));
273
274
}
274
- genarateFileIndex ($ folderPath );
275
- genarateFileHtaccess ($ folderPath );
276
- genarateFileReadme ($ folderPath );
277
-
275
+ $ createIndex = generateFileIndex ($ folderPath );
276
+ $ createHtaccess = generateFileHtaccess ($ folderPath );
277
+ $ createReadme = generateFileReadme ($ folderPath );
278
+ if (is_cli ()) {
279
+ if ($ createIndex ) {
280
+ echo "Create file index.html in " . $ folderPath . " successfully " ;
281
+ }
282
+ if ($ createHtaccess ) {
283
+ echo "Create file .htaccess in " . $ folderPath . " successfully " ;
284
+ }
285
+ if ($ createReadme ) {
286
+ echo "Create file README.md in " . $ folderPath . " successfully " ;
287
+ }
288
+ }
289
+ if ($ gitkeep === true ) {
290
+ $ createGitkeep = touch ($ folderPath . '/.gitkeep ' );
291
+ if (is_cli () && $ createGitkeep ) {
292
+ echo "Create file .gitkeep in " . $ folderPath . " successfully " ;
293
+ }
294
+ }
278
295
return true ;
279
296
}
280
297
@@ -286,15 +303,16 @@ function makeNewFolder($folderPath = '')
286
303
* Function new_folder
287
304
*
288
305
* @param string $folder
306
+ * @param bool $gitkeep
289
307
*
290
308
* @return bool
291
309
* @author : 713uk13m <[email protected] >
292
310
* @copyright: 713uk13m <[email protected] >
293
311
* @time : 09/11/2021 58:13
294
312
*/
295
- function new_folder ($ folder = '' )
313
+ function new_folder ($ folder = '' , $ gitkeep = false )
296
314
{
297
- return makeNewFolder ($ folder );
315
+ return makeNewFolder ($ folder, $ gitkeep );
298
316
}
299
317
}
300
318
if (!function_exists ('scan_folder ' )) {
0 commit comments