Beispiel #1
0
 function merge_array_recursive($files, &$a, $k = null)
 {
     foreach ($files as $key => $file) {
         if (is_array($file)) {
             $key . merge_array_recursive($file, $a, ($k ? $k . DIRECTORY_SEPARATOR : '') . $key);
         } else {
             array_push($a, ($k ? $k . DIRECTORY_SEPARATOR : '') . $file);
         }
     }
 }
Beispiel #2
0
});
$files = array_map(function ($file) {
    return array('path' => $file, 'md5' => md5_file($file), 'uri' => preg_replace('/^(\\.\\.\\/)/', '', $file));
}, $files);
echo "\r ➜ " . color('列出即將上傳所有檔案', 'g') . color('(' . count($local_files = array_merge($local_files, $files)) . ')', 'g') . ' - ' . sprintf('% 3d%% ', 100 / $c * ++$i);
$files = array();
merge_array_recursive(directory_map('../font'), $files, '../font');
$files = array_filter($files, function ($file) {
    return in_array(pathinfo($file, PATHINFO_EXTENSION), array('eot', 'svg', 'ttf', 'woff'));
});
$files = array_map(function ($file) {
    return array('path' => $file, 'md5' => md5_file($file), 'uri' => preg_replace('/^(\\.\\.\\/)/', '', $file));
}, $files);
echo "\r ➜ " . color('列出即將上傳所有檔案', 'g') . color('(' . count($local_files = array_merge($local_files, $files)) . ')', 'g') . ' - ' . sprintf('% 3d%% ', 100 / $c * ++$i);
$files = array();
merge_array_recursive(directory_map('../img'), $files, '../img');
$files = array_filter($files, function ($file) {
    return in_array(pathinfo($file, PATHINFO_EXTENSION), array('png', 'jpg', 'jpeg', 'gif', 'svg'));
});
$files = array_map(function ($file) {
    return array('path' => $file, 'md5' => md5_file($file), 'uri' => preg_replace('/^(\\.\\.\\/)/', '', $file));
}, $files);
echo "\r ➜ " . color('列出即將上傳所有檔案', 'g') . color('(' . count($local_files = array_merge($local_files, $files)) . ')', 'g') . ' - ' . sprintf('% 3d%% ', 100 / $c * ++$i);
// // ========================================================================
// // ========================================================================
// // ========================================================================
echo ' ➜ ' . color('過濾需要上傳檔案', 'g');
$i = 0;
$c = count($local_files);
$upload_files = array_filter($local_files, function ($local_file) use($s3_files, &$i, $c) {
    foreach ($s3_files as $s3_file) {