-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrebuildFile.php
More file actions
34 lines (26 loc) · 870 Bytes
/
rebuildFile.php
File metadata and controls
34 lines (26 loc) · 870 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
<?php
#break file fits the purpose of breaking large rdf files into smaller ones such that they can be imported without the process being killed by php
ini_set('display_errors',0);
if($_REQUEST['su3d'])
ini_set('display_errors',1);
$file= ($_REQUEST['file']!='')?$_REQUEST['file']:$argv[2];
if($file=='' || !is_file($file)) {
echo "Please specify the rdf/n3 file to restore";
exit;
}
rebuildFile($file);
function rebuildFile($file)
{
###
#find out in how many fractions this file was broken
$parts = file_get_contents($file.'_parts');
echo "Rebuilding file from fragments".chr(10);
for ($i=1; $i <= $parts; $i++) {
$data .= file_get_contents($file.'_'.$i.'clean');
$file2unlink = $file.'_'.$i.'clean';
echo unlink($file2unlink);
echo unlink($file.'_'.$i);
}
file_put_contents($file.'_clean', $data);
}
?>