forked from yiichou/aliyun-oss-support
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.php
More file actions
40 lines (35 loc) · 984 Bytes
/
build.php
File metadata and controls
40 lines (35 loc) · 984 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
31
32
33
34
35
36
37
38
39
40
<?php
/* =======================
打包 zip
======================= */
$zip = new ZipArchive();
$zip->open('aliyun-oss.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$packageDirs = ['languages', 'view', 'vendor', 'src'];
$packageFiles = [
'aliyun-oss.php',
'autoload.php',
'LICENSE.md',
'README.md',
'readme.txt',
'screenshot.png',
'uninstall.php'
];
foreach ($packageDirs as $dir) {
$dirPath = realpath($dir);
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dirPath),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file) {
if (!$file->isDir()) {
$relativePath = str_replace($dirPath, "{$dir}/", $file);
$zip->addFile($file, $relativePath);
}
}
}
foreach ($packageFiles as $file) {
$filePath = realpath($file);
$filePath && $zip->addFile($filePath, $file);
}
$zip->close();
echo "Finished aliyun-oss.zip\n";