mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
add option maxsize
This commit is contained in:
parent
7995fcac45
commit
80f7ad1494
|
@ -13,6 +13,7 @@ function usage() { /* {{{ */
|
|||
echo " -v, --version: print version and exit.\n";
|
||||
echo " --config: set alternative config file.\n";
|
||||
echo " --folder: set start folder.\n";
|
||||
echo " --maxsize: maximum size of files to be include in output.\n";
|
||||
} /* }}} */
|
||||
|
||||
function wrapWithCData($text) { /* {{{ */
|
||||
|
@ -24,7 +25,7 @@ function wrapWithCData($text) { /* {{{ */
|
|||
|
||||
$version = "0.0.1";
|
||||
$shortoptions = "hv";
|
||||
$longoptions = array('help', 'version', 'config:', 'folder:');
|
||||
$longoptions = array('help', 'version', 'config:', 'folder:', 'maxsize:');
|
||||
if(false === ($options = getopt($shortoptions, $longoptions))) {
|
||||
usage();
|
||||
exit(0);
|
||||
|
@ -52,6 +53,13 @@ if(isset($options['config'])) {
|
|||
if(isset($settings->_extraPath))
|
||||
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
|
||||
|
||||
/* Set alternative config file */
|
||||
if(isset($options['maxsize'])) {
|
||||
$maxsize = intval($maxsize);
|
||||
} else {
|
||||
$maxsize = 100000;
|
||||
}
|
||||
|
||||
require_once("SeedDMS/Core.php");
|
||||
|
||||
if(isset($options['folder'])) {
|
||||
|
@ -250,6 +258,11 @@ function tree($folder, $parent=null, $indent='') { /* {{{ */
|
|||
echo $indent." <attr name=\"owner\">".$owner->getId()."</attr>\n";
|
||||
echo $indent." <attr name=\"comment\">".wrapWithCData($file->getComment())."</attr>\n";
|
||||
echo $indent." <attr name=\"orgfilename\">".wrapWithCData($file->getOriginalFileName())."</attr>\n";
|
||||
echo $indent." <data length=\"".filesize($dms->contentDir . $file->getPath())."\">\n";
|
||||
if(filesize($dms->contentDir . $file->getPath()) < 1000000) {
|
||||
echo chunk_split(base64_encode(file_get_contents($dms->contentDir . $file->getPath())), 76, "\n");
|
||||
}
|
||||
echo $indent." </data>\n";
|
||||
echo $indent." </file>\n";
|
||||
}
|
||||
echo $indent." </files>\n";
|
||||
|
@ -404,7 +417,7 @@ if($attrdefs) {
|
|||
}
|
||||
echo "\">\n";
|
||||
echo " <attr name=\"name\">".$attrdef->getName()."</attr>\n";
|
||||
echo " <attr name=\"multiple\">".$attrdef->hasMultipleValues()."</attr>\n";
|
||||
echo " <attr name=\"multiple\">".$attrdef->getMultipleValues()."</attr>\n";
|
||||
echo " <attr name=\"valueset\">".$attrdef->getValueSet()."</attr>\n";
|
||||
echo " <attr name=\"type\">".$attrdef->getType()."</attr>\n";
|
||||
echo " <attr name=\"minvalues\">".$attrdef->getMinValues()."</attr>\n";
|
||||
|
|
Loading…
Reference in New Issue
Block a user