forked from yamada28go/docker-exment
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathget-logs.php
More file actions
30 lines (24 loc) · 772 Bytes
/
get-logs.php
File metadata and controls
30 lines (24 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
include_once("helper.php");
$currentDir = getcwd();
$resultLogPath = $currentDir . '/logs';
if(!file_exists($resultLogPath)){
mkdir($resultLogPath);
}
$nowLogPath = $resultLogPath . '/' . date('YmdHis');
if(!file_exists($nowLogPath)){
mkdir($nowLogPath);
}
$dirs = getBuildDirs();
foreach($dirs as $dir){
$fullPath = $currentDir . '/build/' . $dir;
chdir($fullPath);
// copy log file
$logfiles = glob($fullPath.'/php/volumes/logs/{*,.[!.]*,..?*}', GLOB_BRACE);
foreach($logfiles as $logfile){
$filename = pathinfo($logfile, PATHINFO_FILENAME);
$extension = pathinfo($logfile, PATHINFO_EXTENSION);
$copyFilePath = "{$nowLogPath}/{$filename}_{$dir}.{$extension}";
copy($logfile, $copyFilePath);
}
}