-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate.php
65 lines (55 loc) · 1.83 KB
/
create.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* @package Molajo
* @copyright 2013 Amy Stephen. All rights reserved.
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*/
$ignore = array();
$ignore[] = '.buildpath' . "\n";
$ignore[] = '.DS_Store' . "\n";
$ignore[] = '.idea' . "\n";
$ignore[] = '.project' . "\n";
$ignore[] = '.settings' . "\n";
$ignore[] = '.gitignore' . "\n";
$ignore[] = '.gitattributes' . "\n";
$ignore[] = 'composer.phar' . "\n";
$ignore[] = 'composer.lock' . "\n";
$current_path = __DIR__;
$objects = new RecursiveIteratorIterator
(new RecursiveDirectoryIterator($current_path),
RecursiveIteratorIterator::SELF_FIRST);
$dirRead = dir(__DIR__);
$path = $dirRead->path;
while ($entry = $dirRead->read()) {
if ($entry == '.' || $entry == '..' || $entry == '.git') {
} else {
if (is_dir($path . '/' . $entry)) {
} else {
$item = $path . '/' . $entry;
$ignore[] = substr($item, strlen($current_path) + 1, 99999) . "\n";
}
}
}
$dirRead->close();
foreach ($objects as $name => $object) {
if ($object->isDir()) {
if (basename($name) == '.' || basename($name) == '..' || basename($name) == '.git') {
} else {
$test = substr(substr($name, strlen($current_path) + 1, 9999), 0, 4);
if ($test == '.git') {
} else {
$dirRead = dir($name);
$path = $dirRead->path;
while ($entry = $dirRead->read()) {
if (is_dir($path . '/' . $entry)) {
} else {
$item = $path . '/' . $entry;
$ignore[] = substr($item, strlen($current_path) + 1, 99999) . "\n";
}
}
$dirRead->close();
}
}
}
}
file_put_contents('gitignore.txt', $ignore);