-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·37 lines (28 loc) · 1.14 KB
/
build.sh
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
#!/usr/bin/env bash
echo "" > "dna.min"
filesList=( "./lib/author.php" "./lib/owner.php" "./lib/node_extend.php" "./lib/package_conf.php" "./lib/fileSystem.php" "./lib/dna.php" "./lib/dna_messages.php" "./lib/dna_conf.php" "./dna" );
for i in "${filesList[@]}"
do
mini=`php -w $i`
mini=${mini/"<?php"/""}
echo $mini >> "dna.min"
done
php -r '
function delete_all_between($beginning, $end, $string) {
$beginningPos = strpos($string, $beginning);
$endPos = strpos($string, $end, $beginningPos);
if ($beginningPos === false || $endPos === false) {
return $string;
}
$textToDelete = substr($string, $beginningPos, ($endPos + strlen($end)) - $beginningPos);
return delete_all_between($beginning, $end, str_replace($textToDelete, "", $string));
}
$handle = fopen("dna.min", "rb");
$contents = fread($handle, filesize("dna.min"));
fclose($handle);
$temp="#!/usr/bin/php \n<?php \n ";
$temp .= delete_all_between("require_once" ,";",$contents);
$myfile = fopen("dna.min", "w") or die("Unable to open file!");
fwrite($myfile, $temp);
fclose($myfile);
'