merge with 1.0.2
This commit is contained in:
parent
73ac07339f
commit
c589a43a35
12 changed files with 117 additions and 56 deletions
|
@ -37,7 +37,6 @@ package="StorageAdmin"
|
|||
reldir=`dirname $0`/..
|
||||
basedir=`cd $reldir; pwd;`
|
||||
test -z "$basedir" && basedir=.
|
||||
usrdir=`cd $basedir/../../../usr; pwd;`
|
||||
|
||||
bindir=$basedir/bin
|
||||
etcdir=$basedir/etc
|
||||
|
|
|
@ -36,14 +36,17 @@
|
|||
#-------------------------------------------------------------------------------
|
||||
|
||||
reldir=`dirname $0`/..
|
||||
basedir=`cd $reldir/var; pwd`
|
||||
phpdir=`cd $reldir/var; pwd`
|
||||
phpdir=ls_storageAdmin_phppart_dir
|
||||
if [ "$phpdir" == "ls_storageAdmin_phppart_dir" ]
|
||||
then
|
||||
phpdir=`cd $reldir/var; pwd`
|
||||
fi
|
||||
mkdir -p $reldir/tmp
|
||||
tmpmaindir=`cd $reldir/tmp; pwd`
|
||||
dbxml="db.xml"
|
||||
datestr=`date '+%Y%m%d%H%M%S'`
|
||||
tarfile0="xmls.tar"
|
||||
tarfile="storage$datestr.tar"
|
||||
xmltar="xmls.tar"
|
||||
destfile="storage$datestr.tar"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Print the usage information for this script.
|
||||
|
@ -94,7 +97,7 @@ destdir=`cd $destdir; pwd`
|
|||
|
||||
tmpdir=`mktemp -d $tmpmaindir/tmp.XXXXXX`
|
||||
|
||||
echo "Backuping to $destdir/$tarfile :"
|
||||
echo "Backuping to $destdir/$destfile :"
|
||||
echo "Dumping database ..."
|
||||
cd $phpdir
|
||||
php -q backup.php > $tmpdir/$dbxml
|
||||
|
@ -102,14 +105,14 @@ echo "Packaging stored files ..."
|
|||
cd $phpdir
|
||||
storpath=`php -q getStorPath.php`
|
||||
cd $storpath/..
|
||||
find stor -name "*.xml" -print | tar cf $tmpdir/$tarfile0 -T -
|
||||
find stor ! -name "*.xml" -a -type f -print | tar cf $tmpdir/$tarfile -T -
|
||||
find stor -name "*.xml" -print | tar cf $tmpdir/$xmltar -T -
|
||||
find stor ! -name "*.xml" -a -type f -print | tar cf $tmpdir/$destfile -T -
|
||||
cd $tmpdir
|
||||
tar rf $tarfile0 $dbxml --remove-files
|
||||
tar rf $xmltar $dbxml --remove-files
|
||||
echo "Compressing XML part ..."
|
||||
bzip2 $tarfile0
|
||||
tar rf $tarfile $tarfile0.bz2 --remove-files
|
||||
mv $tarfile "$destdir"
|
||||
bzip2 $xmltar
|
||||
tar rf $destfile $xmltar.bz2 --remove-files
|
||||
mv $destfile "$destdir"
|
||||
rmdir $tmpdir
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
|
|
@ -36,7 +36,11 @@
|
|||
#-------------------------------------------------------------------------------
|
||||
|
||||
reldir=`dirname $0`/..
|
||||
phpdir=`cd $reldir/var; pwd`
|
||||
phpdir=ls_storageAdmin_phppart_dir
|
||||
if [ "$phpdir" == "ls_storageAdmin_phppart_dir" ]
|
||||
then
|
||||
phpdir=`cd $reldir/var; pwd`
|
||||
fi
|
||||
filelistpathname=.
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
|
|
@ -36,7 +36,11 @@
|
|||
#-------------------------------------------------------------------------------
|
||||
|
||||
reldir=`dirname $0`/..
|
||||
phpdir=`cd $reldir/var; pwd`
|
||||
phpdir=ls_storageAdmin_phppart_dir
|
||||
if [ "$phpdir" == "ls_storageAdmin_phppart_dir" ]
|
||||
then
|
||||
phpdir=`cd $reldir/var; pwd`
|
||||
fi
|
||||
filelistpathname=.
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -70,10 +74,12 @@ while true; do
|
|||
case "$1" in
|
||||
-d|--directory)
|
||||
srcdir=$2;
|
||||
test -d $srcdir || { echo "Directory not found ($srcdir)."; exit 1; }
|
||||
srcabsdir=`cd "$srcdir"; pwd`
|
||||
shift; shift;;
|
||||
-l|--list)
|
||||
filelist=$2;
|
||||
test -f $filelist || { echo "File not found ($filelist)."; exit 1; }
|
||||
filelistbasename=`basename "$filelist"`
|
||||
filelistdir=`dirname "$filelist"`
|
||||
filelistabsdir=`cd "$filelistdir"; pwd`
|
||||
|
|
|
@ -36,14 +36,15 @@
|
|||
#-------------------------------------------------------------------------------
|
||||
|
||||
reldir=`dirname $0`/..
|
||||
basedir=`cd $reldir/var; pwd`
|
||||
phpdir=`cd $reldir/var; pwd`
|
||||
phpdir=ls_storageAdmin_phppart_dir
|
||||
if [ "$phpdir" == "ls_storageAdmin_phppart_dir" ]
|
||||
then
|
||||
phpdir=`cd $reldir/var; pwd`
|
||||
fi
|
||||
mkdir -p $reldir/tmp
|
||||
tmpmaindir=`cd $reldir/tmp; pwd`
|
||||
dbxml="db.xml"
|
||||
#datestr=`date '+%Y%m%d%H%M%S'`
|
||||
tarfile0="xmls.tar"
|
||||
#tarfile="storage$datestr.tar"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Print the usage information for this script.
|
||||
|
|
|
@ -57,6 +57,7 @@ BASE_DIR = .
|
|||
DOC_DIR = ${BASE_DIR}/doc
|
||||
DOXYGEN_DIR = ${DOC_DIR}/doxygen
|
||||
ETC_DIR = ${BASE_DIR}/etc
|
||||
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
|
||||
INCLUDE_DIR = ${BASE_DIR}/include
|
||||
LIB_DIR = ${BASE_DIR}/lib
|
||||
SRC_DIR = ${BASE_DIR}/src
|
||||
|
@ -67,30 +68,21 @@ BIN_DIR = ${BASE_DIR}/bin
|
|||
prefix = @prefix@
|
||||
|
||||
USR_DIR = ${prefix}
|
||||
USR_INCLUDE_DIR = ${USR_DIR}/include
|
||||
USR_VAR_DIR = ${USR_DIR}/var
|
||||
|
||||
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
|
||||
DEST_DIR = ${USR_DIR}
|
||||
PHPPART_DIR = ${prefix}/var/LiveSupport/storageAdmin/var
|
||||
STORAGE_SERVER = @STORAGE_SERVER@
|
||||
|
||||
PHP_DIR = ${VAR_DIR}
|
||||
#TEST_RUNNER = ${PHP_DIR}/tests/index.php
|
||||
PHPPART_DIR_S=$(shell ${ECHO} ${PHPPART_DIR} | ${SED} -e "s/\//\\\\\\\\\//g")
|
||||
STORAGE_SERVER_S=$(shell ${ECHO} ${STORAGE_SERVER} | ${SED} -e "s/\//\\\\\\\\\//g")
|
||||
|
||||
#DEST_DIR = ${USR_VAR_DIR}/LiveSupport/storageAdmin/var
|
||||
DEST_DIR = ${USR_DIR}/usr
|
||||
|
||||
USR_VAR_DIR_S=$(shell ${ECHO} ${USR_VAR_DIR} | ${SED} -e "s/\//\\\\\\\\\//g")
|
||||
|
||||
REPLACE_SED_STRING="s/ls_var_dir/${USR_VAR_DIR_S}/;"
|
||||
SED_STORAGE_SERVER="s/ls_storageServer/${STORAGE_SERVER_S}/;"
|
||||
SED_PHPPART_DIR="s/phpdir=ls_storageAdmin_phppart_dir/phpdir=${PHPPART_DIR_S}/;"
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Configuration parameters
|
||||
#-------------------------------------------------------------------------------
|
||||
#CPPFLAGS = @CPPFLAGS@
|
||||
#CXXFLAGS = @CXXFLAGS@ @DEFS@ -I${USR_INCLUDE_DIR} -I${INCLUDE_DIR} -I${TMP_DIR}\
|
||||
# -pedantic -Wall
|
||||
#LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} -L${LIB_DIR}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Dependencies
|
||||
|
@ -126,18 +118,24 @@ dist: all
|
|||
distclean: clean docclean
|
||||
# ${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te*
|
||||
|
||||
#check: all ${TEST_RUNNER}
|
||||
# ${TEST_RUNNER}
|
||||
check: all
|
||||
|
||||
install:
|
||||
${MKDIR} ${DEST_DIR}/bin
|
||||
${CP} ${BIN_DIR}/*.sh ${DEST_DIR}/bin
|
||||
${RM} ${DEST_DIR}/bin/autogen.sh
|
||||
${MKDIR} ${DEST_DIR}/var
|
||||
${CP} ${VAR_DIR}/*.php ${DEST_DIR}/var
|
||||
${CAT} ${VAR_DIR}/conf.php.template | ${SED} -e ${REPLACE_SED_STRING} \
|
||||
> ${DEST_DIR}/var/conf.php
|
||||
${CAT} ${BIN_DIR}/import.sh | ${SED} -e ${SED_PHPPART_DIR} \
|
||||
> ${DEST_DIR}/bin/import.sh
|
||||
${CAT} ${BIN_DIR}/backup.sh | ${SED} -e ${SED_PHPPART_DIR} \
|
||||
> ${DEST_DIR}/bin/backup.sh
|
||||
${CAT} ${BIN_DIR}/restore.sh | ${SED} -e ${SED_PHPPART_DIR} \
|
||||
> ${DEST_DIR}/bin/restore.sh
|
||||
${CAT} ${BIN_DIR}/dumpDbSchema.sh | ${SED} -e ${SED_PHPPART_DIR} \
|
||||
> ${DEST_DIR}/bin/dumpDbSchema.sh
|
||||
${MKDIR} ${PHPPART_DIR}
|
||||
${CP} ${VAR_DIR}/*.php ${PHPPART_DIR}
|
||||
${CAT} ${VAR_DIR}/conf.php.template | ${SED} -e ${SED_STORAGE_SERVER} \
|
||||
> ${PHPPART_DIR}/conf.php
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
|
|
@ -39,6 +39,41 @@ AC_REVISION($Revision$)
|
|||
|
||||
AC_CONFIG_SRCDIR(../var/getStorPath.php)
|
||||
|
||||
dnl-----------------------------------------------------------------------------
|
||||
dnl specify directory with php parts of scripts
|
||||
dnl-----------------------------------------------------------------------------
|
||||
AC_SUBST(PHPPART_DIR)
|
||||
|
||||
AC_ARG_WITH([phppart-dir],
|
||||
AC_HELP_STRING([--with-phppart-dir],
|
||||
[directory with php parts of scripts]),
|
||||
[PHPPART_DIR=${withval}], [PHPPART_DIR=${prefix}/var/LiveSupport/storageAdmin/var])
|
||||
|
||||
AC_MSG_RESULT([directory with php parts of scripts: ${PHPPART_DIR}])
|
||||
|
||||
dnl-----------------------------------------------------------------------------
|
||||
dnl specify storageServer directory
|
||||
dnl-----------------------------------------------------------------------------
|
||||
AC_SUBST(STORAGE_SERVER)
|
||||
|
||||
AC_ARG_WITH([storage-server],
|
||||
AC_HELP_STRING([--with-storage-server],
|
||||
[use storageServer in given directory]),
|
||||
[STORAGE_SERVER=${withval}], [STORAGE_SERVER=${prefix}/var/LiveSupport/storageServer])
|
||||
|
||||
AC_MSG_RESULT([using storageServer at: ${STORAGE_SERVER}])
|
||||
|
||||
dnl-----------------------------------------------------------------------------
|
||||
dnl msg notice
|
||||
dnl-----------------------------------------------------------------------------
|
||||
AC_MSG_NOTICE(
|
||||
[using the following configuration settings:
|
||||
|
||||
storageServer directory: ${STORAGE_SERVER}
|
||||
php parts directory: ${PHPPART_DIR}
|
||||
|
||||
])
|
||||
|
||||
|
||||
AC_CONFIG_FILES(../Makefile:../etc/Makefile.in)
|
||||
|
||||
|
|
0
livesupport/src/modules/storageAdmin/tmp/.keepme
Normal file
0
livesupport/src/modules/storageAdmin/tmp/.keepme
Normal file
|
@ -122,7 +122,7 @@ function admDumpGroup(&$bs, $gid, $ind=''){
|
|||
));
|
||||
}
|
||||
$garr = $bs->listGroup($gid);
|
||||
if(PEAR::isError($farr)){ echo $farr->getMessage(); exit; }
|
||||
if(PEAR::isError($garr)){ echo $garr->getMessage(); exit; }
|
||||
$res = '';
|
||||
foreach($garr as $i =>$member){
|
||||
$fid2 = $member['id'];
|
||||
|
|
|
@ -28,5 +28,5 @@
|
|||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
$storageServerPath = 'ls_var_dir/LiveSupport/storageServer';
|
||||
$storageServerPath = 'ls_storageServer';
|
||||
?>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
ini_set('memory_limit', '64M');
|
||||
header("Content-type: text/plain");
|
||||
echo "\n#StorageServer import script:\n";
|
||||
//echo date('H:i:s')."\n";
|
||||
|
@ -45,7 +46,7 @@ if(PEAR::isError($dbc)){ echo "ERROR: ".$dbc->getMessage()." ".$dbc->getUserInfo
|
|||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
$gb = &new GreenBox($dbc, $config);
|
||||
|
||||
$testonly = ($argv[1] == '-n');
|
||||
$testonly = (isset($argv[1]) && $argv[1] == '-n');
|
||||
#$testonly = TRUE;
|
||||
|
||||
$errors=0;
|
||||
|
@ -61,7 +62,13 @@ $flds = array(
|
|||
'mime_type' => 'dc:format',
|
||||
'bitrate' => 'ls:bitrate',
|
||||
'playtime_seconds' => 'dcterms:extent',
|
||||
'tags' => array(
|
||||
/*
|
||||
'id3v1' => array(
|
||||
'title' => 'dc:title',
|
||||
'artist' => 'dc:creator',
|
||||
),
|
||||
*/
|
||||
'id3v2' => array(
|
||||
'TT2' => 'dc:title',
|
||||
'TIT2' => 'dc:title',
|
||||
'TP1' => 'dc:creator',
|
||||
|
@ -95,6 +102,8 @@ $flds = array(
|
|||
);
|
||||
|
||||
$titleKey = 'dc:title';
|
||||
$enc = 'iso-8859-1';
|
||||
#$enc = 'UTF-8';
|
||||
|
||||
$r = $gb->getObjId('import', $gb->storId);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n"; exit(1); }
|
||||
|
@ -104,16 +113,16 @@ if(is_null($r)){
|
|||
}
|
||||
$parid = $r;
|
||||
|
||||
function addMdata($key, $val){
|
||||
function addMdata($key, $val, $iEnc='iso-8859-1'){
|
||||
global $mdata, $titleHaveSet, $titleKey;
|
||||
#echo "$key($iEnc): $val\n";
|
||||
if(!is_null($val)){
|
||||
$mdata[$key] = $val;
|
||||
/*
|
||||
$iEnc = 'UTF-8';
|
||||
$oEnc = 'ISO-8859-1';
|
||||
$oEnc = 'UTF-8';
|
||||
$mdata[$key] = iconv($iEnc, $oEnc, $mdata[$key]);
|
||||
*/
|
||||
if(function_exists('iconv')){
|
||||
$mdata[$key] = $r = @iconv($iEnc, $oEnc, $mdata[$key]);
|
||||
if($r === FALSE) die("Recoding metadata to unicode failed.");
|
||||
}
|
||||
if($key == $titleKey) $titleHaveSet = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -131,18 +140,23 @@ while($filename = fgets($stdin, 2048)){
|
|||
$mdata = array();
|
||||
$titleHaveSet = FALSE;
|
||||
foreach($flds as $k1=>$fn1){
|
||||
if($testonly) echo"#$k1, $fn1\n";
|
||||
if(is_null($fn1)) continue;
|
||||
if(!isset($infoFromFile[$k1])) continue;
|
||||
list($fn, $v) = array($fn1, $infoFromFile[$k1]);
|
||||
if(is_array($fn1)){
|
||||
$k0 = $k1;
|
||||
//if($k0=='tags') $k1=$infoFromFile['tags'][0];
|
||||
$k1 = 'id3v2';
|
||||
//$k1 = 'id3v2';
|
||||
if(!isset($infoFromFile[$k1])) continue;
|
||||
list($fn, $v) = array($fn1, $infoFromFile[$k1]);
|
||||
foreach($fn1 as $k2=>$fn2){
|
||||
if($testonly) echo" #$k2, $fn2\n";
|
||||
if(is_null($fn2)) continue;
|
||||
if(!isset($infoFromFile[$k1][$k2])) continue;
|
||||
switch($k0){
|
||||
case"tags":
|
||||
case"id3v2":
|
||||
list($fn, $v) = array($fn2, $infoFromFile[$k1][$k2]['data']);
|
||||
$enc = $infoFromFile[$k1][$k2]['encoding'];
|
||||
if($enc != 'UTF-8' && $enc != 'ISO-8859-1'){
|
||||
|
@ -155,7 +169,8 @@ while($filename = fgets($stdin, 2048)){
|
|||
default;
|
||||
list($fn, $v) = array($fn2, $infoFromFile[$k1][$k2]);
|
||||
}
|
||||
addMdata($fn, $v);
|
||||
if($testonly) echo" - $v\n";
|
||||
addMdata($fn, $v, $enc);
|
||||
}
|
||||
}else{
|
||||
switch($fn){
|
||||
|
@ -165,10 +180,10 @@ while($filename = fgets($stdin, 2048)){
|
|||
default:
|
||||
list($fn, $v) = array($fn1, $infoFromFile[$k1]);
|
||||
}
|
||||
addMdata($fn, $v);
|
||||
addMdata($fn, $v, $enc);
|
||||
}
|
||||
}
|
||||
if(!$titleHaveSet || trim($mdata[$titleKey])=='') addMdata($titleKey, basename($filename)." X");
|
||||
if(!$titleHaveSet || trim($mdata[$titleKey])=='') addMdata($titleKey, basename($filename));
|
||||
// unset($mdata['dc:title']);
|
||||
|
||||
if(!$testonly){
|
||||
|
|
|
@ -75,7 +75,7 @@ function ls_restore_restoreObject($obj, $parid, $reallyInsert=TRUE){
|
|||
$r = $bs->bsCreateFolder($parid, $obj['name']);
|
||||
ls_restore_checkErr($r, __LINE__);
|
||||
}else $r=$parid;
|
||||
if(is_array($obj['children'])){
|
||||
if(isset($obj['children']) && is_array($obj['children'])){
|
||||
foreach($obj['children'] as $i=>$ch){
|
||||
ls_restore_restoreObject($ch, $r);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ foreach($subjArr as $i=>$el){
|
|||
'pass' => $el->attrs['pass']->val,
|
||||
# 'realname' => $el->attrs['realname']->val,
|
||||
'realname' => '',
|
||||
'prefs' => $el->children[0]->children,
|
||||
'prefs' => (isset($el->children[0]) ? $el->children[0]->children : NULL),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue