mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
do some logging
This commit is contained in:
parent
83f0cfff8d
commit
65299463f4
|
@ -140,7 +140,7 @@ if(isset($_GET['setfolderdate']) && $_GET["setfolderdate"]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_folder($dirname, $folder, $setfiledate, $setfolderdate, $metadata) { /* {{{ */
|
function import_folder($dirname, $folder, $setfiledate, $setfolderdate, $metadata) { /* {{{ */
|
||||||
global $user, $doccount, $foldercount;
|
global $user, $doccount, $foldercount, $logger;
|
||||||
|
|
||||||
$d = dir($dirname);
|
$d = dir($dirname);
|
||||||
$sequence = 1;
|
$sequence = 1;
|
||||||
|
@ -169,7 +169,9 @@ function import_folder($dirname, $folder, $setfiledate, $setfolderdate, $metadat
|
||||||
$comment = !empty($metadata[$path]['comment']) ? $metadata[$path]['comment'] : '';
|
$comment = !empty($metadata[$path]['comment']) ? $metadata[$path]['comment'] : '';
|
||||||
$owner = !empty($metadata[$path]['owner']) ? $metadata[$path]['owner'] : $user;
|
$owner = !empty($metadata[$path]['owner']) ? $metadata[$path]['owner'] : $user;
|
||||||
|
|
||||||
echo $mimetype." - ".$filetype." - ".$path."<br />\n";
|
// echo $mimetype." - ".$filetype." - ".$path."<br />\n";
|
||||||
|
if($logger)
|
||||||
|
$logger->log('ImportFS: importing \''.$path.'\' '.(!empty($metadata[$path]['attributes']) ? 'with' : 'without').' metadata', PEAR_LOG_INFO);
|
||||||
if($res = $folder->addDocument($docname, $comment, $expires, $owner, $keywords,
|
if($res = $folder->addDocument($docname, $comment, $expires, $owner, $keywords,
|
||||||
!empty($metadata[$path]['category']) ? $metadata[$path]['category'] : array(), $filetmp, $name,
|
!empty($metadata[$path]['category']) ? $metadata[$path]['category'] : array(), $filetmp, $name,
|
||||||
$filetype, $mimetype, $sequence, $reviewers,
|
$filetype, $mimetype, $sequence, $reviewers,
|
||||||
|
@ -182,10 +184,11 @@ function import_folder($dirname, $folder, $setfiledate, $setfolderdate, $metadat
|
||||||
$lc = $newdoc->getLatestContent();
|
$lc = $newdoc->getLatestContent();
|
||||||
$lc->setDate(filemtime($path));
|
$lc->setDate(filemtime($path));
|
||||||
}
|
}
|
||||||
|
if($logger)
|
||||||
|
$logger->log('ImportFS: imported \''.$path.'\' as document '.$res[0]->getId(), PEAR_LOG_INFO);
|
||||||
} else {
|
} else {
|
||||||
echo "Error importing ".$path."<br />";
|
if($logger)
|
||||||
echo "<pre>".print_r($res, true)."</pre>";
|
$logger->log('ImportFS: importing \''.$path.'\' failed.', PEAR_LOG_ERR);
|
||||||
// return false;
|
|
||||||
}
|
}
|
||||||
set_time_limit(30);
|
set_time_limit(30);
|
||||||
} elseif(is_dir($path)) {
|
} elseif(is_dir($path)) {
|
||||||
|
@ -195,10 +198,13 @@ function import_folder($dirname, $folder, $setfiledate, $setfolderdate, $metadat
|
||||||
if($setfolderdate) {
|
if($setfolderdate) {
|
||||||
$newfolder->setDate(filemtime($path));
|
$newfolder->setDate(filemtime($path));
|
||||||
}
|
}
|
||||||
|
if($logger)
|
||||||
|
$logger->log('ImportFS: creating folder \''.$path.'\' as folder '.$newfolder->getId(), PEAR_LOG_INFO);
|
||||||
if(!import_folder($path, $newfolder, $setfiledate, $setfolderdate, $metadata))
|
if(!import_folder($path, $newfolder, $setfiledate, $setfolderdate, $metadata))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// return false;
|
if($logger)
|
||||||
|
$logger->log('ImportFS: creating folder \''.$path.'\' failed.', PEAR_LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sequence++;
|
$sequence++;
|
||||||
|
@ -208,19 +214,27 @@ function import_folder($dirname, $folder, $setfiledate, $setfolderdate, $metadat
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
$foldercount = $doccount = 0;
|
$foldercount = $doccount = 0;
|
||||||
if($_GET['createfolder']) {
|
if(!empty($_GET['createfolder'])) {
|
||||||
if($newfolder = $folder->addSubFolder($_GET["dropfolderfileform1"], '', $user, 1)) {
|
if($newfolder = $folder->addSubFolder($_GET["dropfolderfileform1"], '', $user, 1)) {
|
||||||
if($setfolderdate) {
|
if($setfolderdate) {
|
||||||
$newfolder->setDate(filemtime($dirname));
|
$newfolder->setDate(filemtime($dirname));
|
||||||
}
|
}
|
||||||
|
if($logger)
|
||||||
|
$logger->log('ImportFS: creating folder \''.$_GET["dropfolderfileform1"].'\' as folder '.$newfolder->getId(), PEAR_LOG_INFO);
|
||||||
} else {
|
} else {
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
|
if($logger)
|
||||||
|
$logger->log('ImportFS: creating folder \''.$_GET["dropfolderfileform1"].'\' failed.', PEAR_LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$newfolder = $folder;
|
$newfolder = $folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($newfolder) {
|
if($newfolder) {
|
||||||
|
if($logger) {
|
||||||
|
$logger->log('ImportFS: importing into folder '.$newfolder->getId(), PEAR_LOG_INFO);
|
||||||
|
if($metadata)
|
||||||
|
$logger->log('ImportFS: using metadata for '.count($metadata).' files from file \''.$metadatafile.'\'', PEAR_LOG_INFO);
|
||||||
|
}
|
||||||
if(!import_folder($dirname, $newfolder, $setfiledate, $setfolderdate, $metadata))
|
if(!import_folder($dirname, $newfolder, $setfiledate, $setfolderdate, $metadata))
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
|
||||||
else {
|
else {
|
||||||
|
@ -231,6 +245,8 @@ if($newfolder) {
|
||||||
}
|
}
|
||||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_importfs', array('docs'=>$doccount, 'folders'=>$foldercount))));
|
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_importfs', array('docs'=>$doccount, 'folders'=>$foldercount))));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location:../out/out.ViewFolder.php?folderid=".$newfolder->getID());
|
header("Location:../out/out.ViewFolder.php?folderid=".$newfolder->getID());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user