Update of /cvsroot/tslogparser/tslogparser/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2354/admin
Modified Files:
index.php
Log Message:
Simplify tar archives usage (experimental)
Index: index.php
===================================================================
RCS file: /cvsroot/tslogparser/tslogparser/admin/index.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- index.php 7 Feb 2005 15:31:54 -0000 1.9
+++ index.php 14 Mar 2005 14:43:50 -0000 1.10
@@ -194,7 +194,7 @@
$tmpdir = $root."ts/".time();
- if (!$tar->extractModify($tmpdir, "ts"))
+ if (!$tar->extractModify($tmpdir))
{
echo "<b>Archive extraction failed.</b>\n";
@@ -203,6 +203,40 @@
die();
}
+ /* Find directory name from inside archive, if any */
+ /* 1 - check the files are inside a subdirectory */
+ if (!is_dir($tmpdir."/conformance/interface"))
+ {
+ /* 2 - open the directory where files were extracted */
+ if ($dh = opendir($tmpdir))
+ {
+ /* 3 - list the files. We assume there is only 1 directory here */
+ while (($file = readdir($dh)) !== false)
+ {
+ if (($file == ".") || ($file == ".."))
+ continue;
+ if (is_dir($tmpdir."/".$file))
+ {
+ $tmpdir .= "/".$file;
+ break;
+ }
+ echo "<b>Unexpected entry in archive: $file</b>";
+ db_fini();
+ require($root."footer.inc.php");
+ die();
+ }
+ /* 4 - close the directory */
+ closedir($dh);
+ }
+ else
+ {
+ echo "<b>Unable to open temporary directory $tmpdir</b>";
+ db_fini();
+ require($root."footer.inc.php");
+ die();
+ }
+ }
+
/* Here we're in step 2 in process: ready to proceed */
echo "<pre>\n";
@@ -264,7 +298,7 @@
<td><textarea name="ts_descr" rows="3" cols="79"><?php echo $_GET["ts_descr"]; ?></textarea></td>
</tr>
<tr>
- <td>New release archive (tar.gz expanding in 'ts' directory):</td>
+ <td>New release archive (tar.gz format):</td>
<td><input name="tsarchive" type="file"></td>
</tr>
<tr>
|