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
65
66
67
68
69
70
71
72
|
<?php
if(empty($argv[1]))
die("please specify solr-worksrc\n");
$strGitLabDir = $argv[1];
if(!is_dir($strGitLabDir))
die("given path is not a dir: $strGitLabDir\n");
if(!is_readable($strGitLabDir))
die("given path is not readable: $strGitLabDir\n");
// remove last slash of path if given to easy
// path handling later
if(strrpos($strGitLabDir, '/') == (strlen($strGitLabDir) - 1))
$strGitLabDir = substr($strGitLabDir, 0, strlen($strGitLabDir) - 1);
$objDir = new RecursiveDirectoryIterator($strGitLabDir);
$objDir = new RecursiveIteratorIterator($objDir);
$arrFiles = array();
// iterate through complete given work-dir
foreach($objDir AS $objFile) {
// skip dirs, we only want files
if(!$objFile->isFile())
continue;
// skip unwanted files
if(in_array($objFile->getExtension(),
array('orig', 'bak', 'gitkeep', 'gitignore')))
continue;
// skip lock file, it shoud be generated when GitLab is started
if('Gemfile.lock' === $objFile->getFilename())
continue;
// strip given dir - we just want the aim-dir
$intEndPosOfDir = strpos($objFile->getRealPath(), $strGitLabDir) + strlen($strGitLabDir);
$strFilePath = substr($objFile->getRealPath(), $intEndPosOfDir);
// list of config files to ignore
$arrConfigFiles = array('/etc/solr.in.sh.sample',
'/var/db/solr/solr.xml.sample');
// skip config files
if(in_array($strFilePath, $arrConfigFiles))
continue;
$arrFiles[] = "solr$strFilePath";
}
sort($arrFiles);
// go through the files and print them
foreach($arrFiles AS $strFile) {
print "$strFile\n";
}
// at least print static block of dirs and config files
print "@dir(solr,solr) /var/db/solr
@dir(solr,solr) /var/log/solr
@sample etc/solr.in.sh.sample
@sample(solr,solr) /var/db/solr/solr.xml.sample
%%JTS%%solr/server/solr-webapp/webapp/WEB-INF/lib/jts-core.jar
";
print "\n";
|