forked from Br3nda/legislation_pull
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyright.php
56 lines (40 loc) · 1.16 KB
/
copyright.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
<?php
require('../governments.inc.php');
require('../acts.inc.php');
do_command("rm -rf ./.git ./*");
do_command("git init");
$legislation = get_legislation();
foreach($legislation as $act) {
getNext($act['date'], $act['url'], $act['act']);
}
do_command('git filter-branch --commit-filter \'
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE";
git commit-tree "$@";
\' HEAD
');
function getNext($date, $url, $act) {
mkdir($act);
chdir($act);
print "$data $url\n";
do_command("wget $url");
do_command("mv *.pdf $act.pdf");
do_command("rm *.txt");
do_command("ls -la");
do_command("pdftotext *.pdf");
do_command("ls -la");
do_command("rm *.pdf");
do_command("git add $act*.txt");
$time = strtotime($date);
$year = date('Y', $time);
$government = government($year);
if(!$government) $government = 'Victoria';
chdir('..');
do_command("git add $act");
do_command("git commit -a --date=\"". $time .'" -m "'. $act .' Act at '. $date .'" --author="' . $government . ' <[email protected]>"');
do_command("git status");
}
function do_command($command) {
echo getcwd()."\$ $command\n";
passthru($command);
# sleep(1);
}