#1604 some exceptions catching added

This commit is contained in:
tomash 2006-03-22 15:20:27 +00:00
parent 3a939c1e0f
commit d381976633

View file

@ -982,22 +982,24 @@ class BasicStor extends Alib{
$res = `cd $tmpd; tar xf $fname`; $res = `cd $tmpd; tar xf $fname`;
// clips: // clips:
$d = dir($tmpdc); $entries=array(); $gunids=array(); $d = dir($tmpdc); $entries=array(); $gunids=array();
while (false !== ($entry = $d->read())) { if($d !== false){
if(preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)){ while (false !== ($entry = $d->read())) {
list(,$gunid, $ext) = $va; if(preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)){
switch($ext){ list(,$gunid, $ext) = $va;
case"xml": switch($ext){
$entries[$gunid]['metadata'] = $entry; case"xml":
break; $entries[$gunid]['metadata'] = $entry;
default: break;
$entries[$gunid]['rawMedia'] = $entry; default:
$entries[$gunid]['rawMediaExt'] = $ext; $entries[$gunid]['rawMedia'] = $entry;
$gunids[$entry] = $gunid; $entries[$gunid]['rawMediaExt'] = $ext;
break; $gunids[$entry] = $gunid;
break;
}
} }
} }
$d->close();
} }
$d->close();
$res = TRUE; $res = TRUE;
foreach($entries as $gunid=>$it){ foreach($entries as $gunid=>$it){
$rawMedia = "$tmpdc/{$it['rawMedia']}"; $rawMedia = "$tmpdc/{$it['rawMedia']}";
@ -1014,19 +1016,21 @@ class BasicStor extends Alib{
// playlists: // playlists:
require_once"Playlist.php"; require_once"Playlist.php";
$d = dir($tmpdp); $d = dir($tmpdp);
while ((!PEAR::isError($res)) && false !== ($entry = $d->read())) { if($d !== false){
if(preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)){ while ((!PEAR::isError($res)) && false !== ($entry = $d->read())) {
list(,$gunid, $ext) = $va; if(preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)){
$res = $this->bsImportPlaylistRaw($parid, $gunid, list(,$gunid, $ext) = $va;
$tmpdp, $entry, $ext, $gunids, $subjid); $res = $this->bsImportPlaylistRaw($parid, $gunid,
unlink("$tmpdp/$entry"); $tmpdp, $entry, $ext, $gunids, $subjid);
if(PEAR::isError($res)) break; unlink("$tmpdp/$entry");
} if(PEAR::isError($res)) break;
}
}
$d->close();
} }
$d->close();
//@rmdir($tmpdc); @rmdir($tmpdp); @rmdir($tmpd); //@rmdir($tmpdc); @rmdir($tmpdp); @rmdir($tmpd);
system("rm -rf $tmpdc"); system("rm -rf $tmpdp"); system("rm -rf $tmpd"); @system("rm -rf $tmpdc"); @system("rm -rf $tmpdp"); @system("rm -rf $tmpd");
unlink($tmpn); @unlink($tmpn);
return $res; return $res;
} }