CC-1309 Rationalize the Network Hub storage and Local Storage: put all the archiveServer functionality into the local storage. Removed install of separate archiveServer directories and database tables. Checked in some other minor tweaks.

This commit is contained in:
paul.baranowski 2010-09-07 16:15:05 -04:00
parent aa9528b9fd
commit 956056747c
48 changed files with 643 additions and 3733 deletions

View File

@ -168,7 +168,7 @@ mkdir -p $etc_tmpdir/apache
# Copy the modules and tools
#-------------------------------------------------------------------------------
#cp -pPR $modules_dir/* $modules_tmpdir
for it in alib getid3 storageServer storageAdmin archiveServer; do
for it in alib getid3 storageServer storageAdmin; do
cp -pPR $modules_dir/$it $modules_tmpdir
done
for it in pear; do

View File

@ -182,7 +182,7 @@ fi
www_port=80
echo "Installing Campcaster network hub (archiveServer).";
echo "Installing Campcaster network hub.";
echo "";
echo "Using the following installation parameters:";
echo "";
@ -386,15 +386,6 @@ echo "Configuring modules ...";
cd $tools_dir/pear && ./configure --prefix=$installdir
cd $modules_dir/alib && ./configure --prefix=$installdir
cd $modules_dir/archiveServer && \
./configure --prefix=$installdir \
--with-hostname=$hostname \
--with-www-port=$www_port \
--with-database-server=$dbserver \
--with-database=$database \
--with-database-user=$dbuser \
--with-database-password=$dbpassword \
--with-url-prefix=$url_prefix
cd $modules_dir/getid3 && ./configure --prefix=$installdir
#cd $modules_dir/htmlUI && ./configure --prefix=$installdir \
# --with-apache-group=$apache_group \
@ -429,7 +420,6 @@ make -C $modules_dir/alib install
make -C $modules_dir/getid3 install
make -C $modules_dir/storageServer install
make -C $modules_dir/storageAdmin install
make -C $modules_dir/archiveServer install
mkdir -p $install_var_ls/storageServer/var/tests
for it in ex1.mp3 ex2.wav; do
@ -453,25 +443,15 @@ ln -vs $install_var_ls $webentry
#-------------------------------------------------------------------------------
echo "Setting up directory permissions..."
chgrp $apache_group $install_var_ls/archiveServer/var/stor
chgrp $apache_group $install_var_ls/archiveServer/var/access
chgrp $apache_group $install_var_ls/archiveServer/var/trans
chgrp $apache_group $install_var_ls/archiveServer/var/stor/buffer
chgrp $apache_group $install_var_ls/storageServer/var/stor
chgrp $apache_group $install_var_ls/storageServer/var/access
chgrp $apache_group $install_var_ls/storageServer/var/trans
chgrp $apache_group $install_var_ls/storageServer/var/stor/buffer
chmod g+sw $install_var_ls/archiveServer/var/stor
chmod g+sw $install_var_ls/archiveServer/var/access
chmod g+sw $install_var_ls/archiveServer/var/trans
chmod g+sw $install_var_ls/archiveServer/var/stor/buffer
#chgrp $apache_group $install_var_ls/storageServer/var/stor
#chgrp $apache_group $install_var_ls/storageServer/var/access
#chgrp $apache_group $install_var_ls/storageServer/var/trans
#chgrp $apache_group $install_var_ls/storageServer/var/stor/buffer
#chmod g+sw $install_var_ls/storageServer/var/stor
#chmod g+sw $install_var_ls/storageServer/var/access
#chmod g+sw $install_var_ls/storageServer/var/trans
#chmod g+sw $install_var_ls/storageServer/var/stor/buffer
chmod g+sw $install_var_ls/storageServer/var/stor
chmod g+sw $install_var_ls/storageServer/var/access
chmod g+sw $install_var_ls/storageServer/var/trans
chmod g+sw $install_var_ls/storageServer/var/stor/buffer
#chgrp $apache_group $install_var_ls/htmlUI/var/templates_c
#chgrp $apache_group $install_var_ls/htmlUI/var/html/img
@ -486,7 +466,7 @@ chmod g+sw $install_var_ls/archiveServer/var/stor/buffer
echo "Initializing database...";
# create PHP-related database tables
cd $install_var_ls/archiveServer/var/install
cd $install_var_ls/storageServer/var/install
php -q install.php || exit 1;
cd -

View File

@ -293,16 +293,6 @@ fi
#-------------------------------------------------------------------------------
echo "Setting up directory permissions..."
chgrp $apache_group $install_var_ls/archiveServer/var/stor
chgrp $apache_group $install_var_ls/archiveServer/var/access
chgrp $apache_group $install_var_ls/archiveServer/var/trans
chgrp $apache_group $install_var_ls/archiveServer/var/stor/buffer
chmod g+sw $install_var_ls/archiveServer/var/stor
chmod g+sw $install_var_ls/archiveServer/var/access
chmod g+sw $install_var_ls/archiveServer/var/trans
chmod g+sw $install_var_ls/archiveServer/var/stor/buffer
if [ "$storage_is_local" = "yes" ]; then
chgrp $apache_group $install_var_ls/storageServer/var/stor
chgrp $apache_group $install_var_ls/storageServer/var/access
@ -396,8 +386,6 @@ if [ "$storage_is_local" = "yes" ]; then
cd -
fi
# create PHP-related database tables
cd $install_var_ls/archiveServer/var/install
# workaround for ticket #2059; restore to "exit 1" after the ticket is closed
php -q install.php || exit 1;
#php -q install.php || true

View File

@ -217,10 +217,6 @@ if [ "$storage_is_local" = "yes" ]; then
rm -rf $installdir/var/storageServer/var/access/*
rm -rf $installdir/var/storageServer/var/trans/*
fi
rm -rf $installdir/var/archiveServer/var/stor/*
rm -rf $installdir/var/archiveServer/var/access/*
rm -rf $installdir/var/archiveServer/var/trans/*
#-------------------------------------------------------------------------------
# Remove the ODBC data source and driver

View File

@ -200,7 +200,6 @@ replace_sed_string="s/ls_install_dir/$installdir_s/; \
s/ls_alib_xmlRpcPrefix/$ls_alib_xmlRpcPrefix_s/; \
s/ls_php_host/$ls_php_host/; \
s/ls_php_port/$ls_php_port/; \
s/ls_archiveUrlPath/\/$ls_php_urlPrefix_s\/archiveServer\/var/; \
s/ls_scheduler_urlPrefix/$ls_scheduler_urlPrefix_s/; \
s/ls_scheduler_xmlRpcPrefix/$ls_scheduler_xmlRpcPrefix_s/; \
s/ls_scheduler_host/$ls_scheduler_host/; \
@ -252,10 +251,6 @@ cat $modules_dir/storageServer/var/conf_only.php.template \
| sed -e "$replace_sed_string" \
> $configdir/storageServer.conf.php
cat $modules_dir/archiveServer/var/conf_only.php.template \
| sed -e "$replace_sed_string" \
> $configdir/archiveServer.conf.php
cat $modules_dir/authentication/etc/webAuthentication.xml.template \
| sed -e "$replace_sed_string" \
> $configdir/webAuthentication.xml
@ -319,7 +314,6 @@ ln -s $modules_dir $htmldir/campcaster
echo "Setting up storageServer..."
make -C $modules_dir/storageServer storage || exit 1
make -C $modules_dir/archiveServer storage || exit 1
#-------------------------------------------------------------------------------
@ -343,16 +337,6 @@ php $modules_dir/storageServer/var/install/campcaster-user.php --addupdate sched
#-------------------------------------------------------------------------------
echo "Setting up directory permissions..."
chgrp $apache_group $modules_dir/archiveServer/var/stor
chgrp $apache_group $modules_dir/archiveServer/var/access
chgrp $apache_group $modules_dir/archiveServer/var/trans
chgrp $apache_group $modules_dir/archiveServer/var/stor/buffer
chmod g+sw $modules_dir/archiveServer/var/stor
chmod g+sw $modules_dir/archiveServer/var/access
chmod g+sw $modules_dir/archiveServer/var/trans
chmod g+sw $modules_dir/archiveServer/var/stor/buffer
chgrp $apache_group $modules_dir/storageServer/var/stor
chgrp $apache_group $modules_dir/storageServer/var/access
chgrp $apache_group $modules_dir/storageServer/var/trans

View File

@ -115,7 +115,6 @@ EVENT_SCHEDULER_DIR = ${MODULES_DIR}/eventScheduler
SCHEDULER_CLIENT_DIR = ${MODULES_DIR}/schedulerClient
WIDGETS_DIR = ${MODULES_DIR}/widgets
ALIB_DIR = ${MODULES_DIR}/alib
ARCHIVE_SERVER_DIR = ${MODULES_DIR}/archiveServer
GETID3_DIR = ${MODULES_DIR}/getid3
HTML_UI_DIR = ${MODULES_DIR}/htmlUI
STORAGE_ADMIN_DIR = ${MODULES_DIR}/storageAdmin
@ -222,15 +221,6 @@ modules_setup: ${TMP_DIR}/modules_setup.stamp
${TMP_DIR}/modules_setup.stamp:
cd ${ALIB_DIR} && ./configure --prefix=${prefix} \
PACKAGE_VERSION=${PACKAGE_VERSION}
cd ${ARCHIVE_SERVER_DIR} && \
./configure --prefix=${prefix} \
--with-hostname=${HOSTNAME} \
--with-www-port=${WWW_PORT} \
--with-database-server=${DB_SERVER} \
--with-database=${DATABASE} \
--with-database-user=${DB_USER} \
--with-database-password=${DB_PASSWORD} \
PACKAGE_VERSION=${PACKAGE_VERSION}
cd ${GETID3_DIR} && ./configure --prefix=${prefix} \
PACKAGE_VERSION=${PACKAGE_VERSION}
cd ${HTML_UI_DIR} && ./configure --prefix=${prefix} \
@ -341,7 +331,6 @@ depclean:
${MAKE} -C ${WIDGETS_DIR} depclean
${MAKE} -C ${SCHEDULER_DIR} depclean
${MAKE} -C ${GLIVESUPPORT_DIR} depclean
-${MAKE} -C ${ARCHIVE_SERVER_DIR} depclean
-${MAKE} -C ${STORAGE_SERVER_DIR} depclean
compile: ${TMP_DIR}/compile.stamp
@ -369,7 +358,6 @@ check:
# -${MAKE} -C ${WIDGETS_DIR} check # no tests defined
# -${MAKE} -C ${SCHEDULER_DIR} check # has database issues
# -${MAKE} -C ${GLIVESUPPORT_DIR} check # has database issues
# -${MAKE} -C ${ARCHIVE_SERVER_DIR} check # no tests defined
# -${MAKE} -C ${STORAGE_SERVER_DIR} check # has database issues
@ -417,7 +405,6 @@ setup_install_dirs:
install_modules:
${MAKE} -C ${ALIB_DIR} install
${MAKE} -C ${ARCHIVE_SERVER_DIR} install
${MAKE} -C ${GETID3_DIR} install
${MAKE} -C ${HTML_UI_DIR} install
${MAKE} -C ${STORAGE_ADMIN_DIR} install

View File

@ -282,10 +282,6 @@ dnl set up the alib module
AC_CONFIG_COMMANDS([../src/modules/alib/tmp/configure],
[../src/modules/alib/bin/autogen.sh])
dnl set up the archive server module
AC_CONFIG_COMMANDS([../src/modules/archiveServer/tmp/configure],
[../src/modules/archiveServer/bin/autogen.sh])
dnl set up the getid3 module
AC_CONFIG_COMMANDS([../src/modules/getid3/tmp/configure],
[../src/modules/getid3/bin/autogen.sh])

View File

@ -433,7 +433,6 @@ INPUT = src/modules/core/include src/modules/core/src \
# src/modules/alib/var \
# src/modules/alib/var/xmlrpc \
# src/modules/getid3/var \
# src/modules/archiveServer/var \
# src/modules/storageServer/var \
# src/modules/storageServer/var/xmlrpc \
# src/modules/storageAdmin/var

View File

@ -415,7 +415,6 @@ WARN_LOGFILE =
# with spaces.
INPUT = src/products/scheduler/src \
src/modules/archiveServer/var/xmlrpc/XR_Archive.php \
src/modules/storageServer/var/xmlrpc/XR_LocStor.php
# If the value of the INPUT tag contains directories, you can use the

View File

@ -1,12 +0,0 @@
DirectoryIndex index.php
Options +FollowSymLinks -Indexes
<IfModule mod_mime.c>
<IfModule mod_php4.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc On
php_flag register_globals Off
</IfModule>
</IfModule>

View File

@ -1,89 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this to set up the build system: configure, makefiles, etc.
# (based on the version in enlightenment's cvs)
#-------------------------------------------------------------------------------
package="ArchiveServer"
# assume we're in $basedir/bin
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
bindir=$basedir/bin
etcdir=$basedir/etc
tmpdir=$basedir/tmp
cd "$tmpdir"
DIE=0
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
fi
echo "Generating configuration files for $package, please wait...."
configure_ac=${etcdir}/configure.ac
configure=${tmpdir}/configure
aclocal_m4=${tmpdir}/aclocal.m4
# copy over configure.ac and acinlclude.m4 from etc to tmp,
# as aclocal >= 1.8 is sooo unbelivably stupid that it will simply try to
# look for configure.ac in the current directory, and include acinclude.m4
# in aclocal.m4 it without a directory path in front
#ACLOCAL_FLAGS="-I ${tmpdir} --acdir=${tmpdir} --output=${aclocal_m4}"
#echo " aclocal $ACLOCAL_FLAGS"
#cp -f ${configure_ac} ${tmpdir}
#cp -f ${etcdir}/acinclude.m4 ${tmpdir}
#aclocal $ACLOCAL_FLAGS
#echo " autoheader ${configure_ac}"
#autoheader ${configure_ac}
echo " autoconf -I ${tmpdir} -o ${configure} ${configure_ac}"
autoconf -I ${tmpdir} -o ${configure} ${configure_ac}

View File

@ -1,39 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script grabs string at suplied URL
#-------------------------------------------------------------------------------
URL=$1
RES=`curl -sf ${URL}` || \
{
ERN=$?;
if [ $ERN == 22 ] ; then
echo "ERROR: curl: 22 - wrong URL ($URL)";
else
echo "ERROR: $ERN - unknown";
fi;
exit 1;
}
echo $RES

View File

@ -1,55 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script does httpd writeable directories setup
#-------------------------------------------------------------------------------
WWW_ROOT=`cd var/install; php -q getWwwRoot.php` || exit $?
echo "# archiveServer root URL: $WWW_ROOT"
HTTP_GROUP=`bin/getUrl.sh $WWW_ROOT/install/getGname.php` || \
{
ERN=$?;
echo $HTTP_GROUP;
echo " -> Probably wrong setting in var/conf.php: URL configuration";
exit $ERN;
}
echo "# group running http daemon: $HTTP_GROUP"
for i in $*
do
echo "mkdir $i"
mkdir -p $i || exit $?
chown :$HTTP_GROUP $i || \
{
ERN=$?;
echo " -> You should have permissions to set group owner to group $HTTP_GROUP";
exit $ERN;
}
chmod g+sw $i || exit $?
done
echo "# Directories setup finished OK"
exit 0

View File

@ -1,47 +0,0 @@
#!/bin/sh
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this script to configure the environment.
#
# This script in effect calls the real automake / autoconf configure script
#-------------------------------------------------------------------------------
# assume we're in $basedir
reldir=`dirname $0`
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
bindir=$basedir/bin
tmpdir=$basedir/tmp
autogen=$bindir/autogen.sh
configure=$tmpdir/configure
if [ ! -x $configure ]; then
(cd $basedir && $autogen $*)
fi
(cd $tmpdir && $configure $*)

View File

@ -1,197 +0,0 @@
#-------------------------------------------------------------------------------
# ArchiveServer - central archive component
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
#
# Campcaster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# @configure_input@
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# General command definitions
#-------------------------------------------------------------------------------
SHELL = /bin/bash
MKDIR = mkdir -p
RM = rm -f
RMDIR = rm -rf
DOXYGEN = doxygen
CP = cp -f
SED = sed
ECHO = echo
CAT = cat
#-------------------------------------------------------------------------------
# Misc
#-------------------------------------------------------------------------------
MODULE_NAME = archiveServer
TAR_C = tar -cj --exclude .svn --exclude '*~' -C ${BASE_DIR} -f
DIST_EXT = .tgz
DATE = `date +%y%m%d`
#-------------------------------------------------------------------------------
# Basic directory and file definitions
#-------------------------------------------------------------------------------
#BASE_DIR = @builddir@
BASE_DIR = .
DOC_DIR = ${BASE_DIR}/doc
DOXYGEN_DIR = ${DOC_DIR}/doxygen
ETC_DIR = ${BASE_DIR}/etc
INCLUDE_DIR = ${BASE_DIR}/include
LIB_DIR = ${BASE_DIR}/lib
SRC_DIR = ${BASE_DIR}/src
TMP_DIR = ${BASE_DIR}/tmp
VAR_DIR = ${BASE_DIR}/var
prefix = @prefix@
USR_DIR = ${prefix}
USR_INCLUDE_DIR = ${USR_DIR}/include
USR_LIB_DIR = ${USR_DIR}/lib
USR_VAR_DIR = ${USR_DIR}/var
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
PHP_DIR = ${VAR_DIR}
INSTALL_DIR = ${PHP_DIR}/install
STOR_DIR = ${PHP_DIR}/stor
ACCESS_DIR = ${PHP_DIR}/access
TRANS_DIR = ${PHP_DIR}/trans
BUFF_DIR = ${STOR_DIR}/buffer
TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
DEST_DIR = ${USR_VAR_DIR}/Campcaster/archiveServer/var
HOSTNAME = @HOSTNAME@
WWW_PORT = @WWW_PORT@
DB_SERVER = @DB_SERVER@
DATABASE = @DATABASE@
DB_USER = @DB_USER@
DB_PASSWORD = @DB_PASSWORD@
PHP_URL_PREFIX = @URL_PREFIX@
USR_LIB_DIR_S=$(shell ${ECHO} ${USR_LIB_DIR} | ${SED} -e "s/\//\\\\\\\\\//g")
PHP_URL_PREFIX_S=$(shell ${ECHO} ${PHP_URL_PREFIX} | ${SED} -e "s/\//\\\\\\\\\//g")
REPLACE_SED_STRING="s/ls_lib_dir/${USR_LIB_DIR_S}/; \
s/ls_dbuser/${DB_USER}/; \
s/ls_dbpassword/${DB_PASSWORD}/; \
s/ls_dbserver/${DB_SERVER}/; \
s/ls_database/${DATABASE}/; \
s/ls_storageUrlPath/\/${PHP_URL_PREFIX_S}\/archiveServer\/var/; \
s/ls_php_host/${HOSTNAME}/; \
s/ls_php_port/${WWW_PORT}/; \
s/ls_archiveUrlPath/\/${PHP_URL_PREFIX_S}\/archiveServer\/var/;"
# explanation: on archive side, archive have the storage role =>
# ls_storageUrlPath shouldn't be replaced by string ending with
# 'storageServer/var'
#-------------------------------------------------------------------------------
# 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
#-------------------------------------------------------------------------------
#HELLO_LIB_OBJS = ${TMP_DIR}/Hello.o
#TEST_RUNNER_OBJS = ${TMP_DIR}/HelloTest.o ${TMP_DIR}/TestRunner.o
#-------------------------------------------------------------------------------
# Targets
#-------------------------------------------------------------------------------
.PHONY: all dir_setup doc clean docclean depclean distclean dist install
.PHONY: db_init db_clean testonly
all:
doc:
${DOXYGEN} ${DOXYGEN_CONFIG}
clean: db_clean
${RMDIR} ${STOR_DIR}
${RMDIR} ${ACCESS_DIR}
${RMDIR} ${TRANS_DIR}
docclean:
${RMDIR} ${DOXYGEN_DIR}/html
depclean: clean
dist:
${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} *
distclean: clean docclean
testonly: ${TEST_RUNNER}
${TEST_RUNNER}
check: all
#testonly
recheck: clean check
install:
${MKDIR} ${DEST_DIR}
${MKDIR} ${DEST_DIR}/access
${MKDIR} ${DEST_DIR}/install
${MKDIR} ${DEST_DIR}/stor
${MKDIR} ${DEST_DIR}/stor/buffer
${MKDIR} ${DEST_DIR}/trans
${MKDIR} ${DEST_DIR}/xmlrpc
${CP} ${VAR_DIR}/*.{php,template} ${DEST_DIR}
${CP} ${VAR_DIR}/install/*.php ${DEST_DIR}/install
${CP} ${VAR_DIR}/xmlrpc/*.php ${DEST_DIR}/xmlrpc
${CAT} ${VAR_DIR}/conf.php.template | ${SED} -e ${REPLACE_SED_STRING} \
> ${DEST_DIR}/conf.php
#-------------------------------------------------------------------------------
# Specific targets
#-------------------------------------------------------------------------------
storage: dir_setup db_init
dir_setup: ${DOXYGEN_DIR}
bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR}
db_init:
-cd var/install && php -q install.php
db_clean:
-cd var/install && php -q uninstall.php
${TMP_DIR}:
${MKDIR} ${TMP_DIR}
${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR}
${TEST_RUNNER}:
#-------------------------------------------------------------------------------
# Pattern rules
#-------------------------------------------------------------------------------
#${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
# ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<

View File

@ -1,147 +0,0 @@
dnl-----------------------------------------------------------------------------
dnl Copyright (c) 2010 Sourcefabric O.P.S.
dnl
dnl This file is part of the Campcaster project.
dnl http://campcaster.sourcefabric.org/
dnl
dnl Campcaster is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl Campcaster is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Campcaster; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl-----------------------------------------------------------------------------
dnl-----------------------------------------------------------------------------
dnl NOTE: Run all configure related scripts from the tmp directory of the
dnl project.
dnl This is due to the fact that configure spreads a lot of trash around,
dnl like atom4te cache directories, config.* files, etc. into the directory
dnl it is being run from. We clearly don't want these in our base directory.
dnl-----------------------------------------------------------------------------
AC_INIT(ArchiveServer, 0.0, support@sourcefabric.org)
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL])
AC_REVISION($Revision$)
AC_CONFIG_SRCDIR(../var/Archive.php)
dnl-----------------------------------------------------------------------------
dnl specify the FQDN
dnl-----------------------------------------------------------------------------
AC_SUBST(HOSTNAME)
AC_ARG_WITH([hostname],
AC_HELP_STRING([--with-hostname],
[use the specified hostname (guess)]),
[HOSTNAME=${withval}], [HOSTNAME=`hostname -f`])
AC_MSG_RESULT([using hostname: ${HOSTNAME}])
dnl-----------------------------------------------------------------------------
dnl specify the web server port
dnl-----------------------------------------------------------------------------
AC_SUBST(WWW_PORT)
AC_ARG_WITH([www-port],
AC_HELP_STRING([--with-www-port],
[use the specified www port (80)]),
[WWW_PORT=${withval}], [WWW_PORT=80])
AC_MSG_RESULT([using www port: ${WWW_PORT}])
dnl-----------------------------------------------------------------------------
dnl specify the database server name
dnl-----------------------------------------------------------------------------
AC_SUBST(DB_SERVER)
AC_ARG_WITH([database-server],
AC_HELP_STRING([--with-database-server],
[use the specified database server (localhost)]),
[DB_SERVER=${withval}], [DB_SERVER=localhost])
AC_MSG_RESULT([using database server: ${DB_SERVER}])
dnl-----------------------------------------------------------------------------
dnl get the name of the Campcaster database
dnl-----------------------------------------------------------------------------
AC_SUBST(DATABASE)
AC_ARG_WITH([database],
AC_HELP_STRING([--with-database],
[the name of the postgresql database to use (Campcaster)]),
[DATABASE=${withval}], [DATABASE=Campcaster])
AC_MSG_RESULT([using database: ${DATABASE}])
dnl-----------------------------------------------------------------------------
dnl specify the database server user
dnl-----------------------------------------------------------------------------
AC_SUBST(DB_USER)
AC_ARG_WITH([database-user],
AC_HELP_STRING([--with-database-user],
[use the specified database server user (campcaster)]),
[DB_USER=${withval}], [DB_USER=campcaster])
AC_MSG_RESULT([using database server user: ${DB_USER}])
dnl-----------------------------------------------------------------------------
dnl specify the database server user password
dnl-----------------------------------------------------------------------------
AC_SUBST(DB_PASSWORD)
AC_ARG_WITH([database-password],
AC_HELP_STRING([--with-database-password],
[use the specified database server user password (campcaster)]),
[DB_PASSWORD=${withval}], [DB_PASSWORD=campcaster])
AC_MSG_RESULT([using database server user password: ${DB_PASSWORD}])
dnl-----------------------------------------------------------------------------
dnl specify url prefix
dnl-----------------------------------------------------------------------------
AC_SUBST(URL_PREFIX)
AC_ARG_WITH([url-prefix],
AC_HELP_STRING([--with-url-prefix],
[use the specified url prefix (campcaster)]),
[URL_PREFIX=${withval}], [URL_PREFIX=campcaster])
AC_MSG_RESULT([using url prefix: ${URL_PREFIX}])
dnl display status info on what libraries will get compiled
AC_MSG_NOTICE(
[using the following configuration settings:
hostname: ${HOSTNAME}
www port: ${WWW_PORT}
database server: ${DB_SERVER}
database name: ${DATABASE}
database user: ${DB_USER}
database user password: ${DB_PASSWORD}
url prefix: ${URL_PREFIX}
])
AC_CONFIG_FILES(../Makefile:../etc/Makefile.in)
AC_OUTPUT()

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
DirectoryIndex index.php
Options +FollowSymLinks -Indexes
<IfModule mod_mime.c>
<IfModule mod_php4.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc On
php_flag register_globals Off
</IfModule>
</IfModule>

View File

@ -1,406 +0,0 @@
<?php
require_once(dirname(__FILE__)."/../../storageServer/var/xmlrpc/XR_LocStor.php");
require_once(dirname(__FILE__)."/../../storageServer/var/Transport.php");
/**
* Extension to StorageServer to act as ArchiveServer.
*
* @package Campcaster
* @subpackage ArchiveServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
class Archive extends XR_LocStor {
/**
* Open upload transport (from station to hub)
*
* @param string $sessid
* session id
* @param string $chsum
* checksum
* @return array
* hasharray with:
* url string: writable URL
* token string: PUT token
*/
function uploadOpen($sessid, $chsum)
{
$owner = Alib::GetSessUserId($sessid);
if (PEAR::isError($owner)) {
return $owner;
}
$res = $this->bsOpenPut($chsum, NULL, $owner);
if (PEAR::isError($res)) {
return $res;
}
return array('url'=>$res['url'], 'token'=>$res['token']);
}
/**
* Check uploaded file
*
* @param string $token
* transport token
* @return array
* (md5h string, size int, url string)
*/
function uploadCheck($token)
{
return $this->bsCheckPut($token);
}
/**
* Close upload transport
*
* @param string $token
* transport token
* @param string $trtype
* transport type
* @param array $pars
* transport parameters
* @return mixed
*/
function uploadClose($token, $trtype, $pars=array())
{
$res = $this->bsClosePut($token);
if (PEAR::isError($res)) {
return $res;
}
extract($res); // fname, owner
switch ($trtype) {
case "audioclip":
$mdtoken = $pars['mdpdtoken'];
$res = $this->bsClosePut($mdtoken);
if (PEAR::isError($res)) {
return $res;
}
$mdfname = $res['fname'];
if ($gunid == '') {
$gunid = NULL;
}
$values = array(
"filename" => $pars['name'],
"filepath" => $fname,
"metadata" => $mdfname,
"gunid" => $pars['gunid'],
"filetype" => "audioclip"
);
$storedFile = $this->bsPutFile($values);
if (PEAR::isError($storedFile)) {
return $storedFile;
}
$res = $storedFile->getId();
@unlink($fname);
@unlink($mdfname);
break;
case "playlist":
if ($gunid == '') {
$gunid = NULL;
}
$values = array(
"filename" => $pars['name'],
"metadata" => $fname,
"gunid" => $pars['gunid'],
"filetype" => "playlist"
);
$storedFile = $this->bsPutFile($values);
if (PEAR::isError($storedFile)) {
return $storedFile;
}
$res = $storedFile->getId();
@unlink($fname);
break;
case "playlistPkg":
$chsum = md5_file($fname);
// importPlaylistOpen:
$res = $this->bsOpenPut($chsum, NULL, $owner);
if (PEAR::isError($res)) {
return $res;
}
$dest = $res['fname'];
$token = $res['token'];
copy($fname, $dest);
$r = $this->importPlaylistClose($token);
if (PEAR::isError($r)) {
return $r;
}
@unlink($fname);
return $r;
break;
case "searchjob":
$crits = file_get_contents($fname);
$criteria = unserialize($crits);
@unlink($fname);
$results = $this->localSearch($criteria);
if (PEAR::isError($results)) {
return $results;
}
$realfile = tempnam($this->accessDir, 'searchjob_');
@chmod($realfile, 0660);
$len = file_put_contents($realfile, serialize($results));
$acc = BasicStor::bsAccess($realfile, '', NULL, 'download');
if (PEAR::isError($acc)) {
return $acc;
}
$url = BasicStor::GetUrlPart()."access/".basename($acc['fname']);
$chsum = md5_file($realfile);
$size = filesize($realfile);
$res = array(
'url'=>$url, 'token'=>$acc['token'],
'chsum'=>$chsum, 'size'=>$size,
'filename'=>$filename
);
return $res;
break;
case "metadata":
break;
default:
}
return $res;
}
/**
* Open download transport
*
* @param string $sessid
* session id
* @param string $trtype
* transport type
* @param array $pars
* transport parameters
* @return hasharray with:
* url string: writable URL
* token string: PUT token
*/
function downloadOpen($sessid, $trtype, $pars=array())
{
global $CC_CONFIG;
switch ($trtype) {
case "unknown":
case "audioclip":
case "metadata":
case "playlist":
case "playlistPkg":
if (!isset($pars['gunid'])) {
return PEAR::raiseError("Archive::downloadOpen: gunid not set");
}
break;
}
$gunid = $pars['gunid'];
// resolve trtype by object type:
if ( ($trtype == 'unknown') || ($trtype == 'playlistPkg') ) {
$trtype2 = BasicStor::GetType($gunid);
if (PEAR::isError($trtype2)) {
return $trtype2;
}
// required with content:
$trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ?
'playlistPkg' : $trtype2);
//return PEAR::raiseError("Archive::downloadOpen: TT=$trtype TT2=$trtype2 G=$gunid");
}
switch ($trtype) {
case "audioclip":
$res = $this->downloadRawAudioDataOpen($sessid, $gunid);
break;
case "metadata":
$res = $this->downloadMetadataOpen($sessid, $gunid);
break;
case "playlist":
$res = $this->accessPlaylist($sessid, $gunid);
break;
case "playlistPkg":
$res = $this->bsExportPlaylistOpen($gunid);
if (PEAR::isError($res)) {
return $res;
}
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
$plfpath = "$tmpn.lspl";
copy($res['fname'], $plfpath);
$res = $this->bsExportPlaylistClose($res['token']);
if (PEAR::isError($res)) {
return $res;
}
$fname = "transported_playlist.lspl";
$id = BasicStor::IdFromGunid($gunid);
$acc = BasicStor::bsAccess($plfpath, 'lspl', NULL, 'download');
if (PEAR::isError($acc)) {
return $acc;
}
$url = BasicStor::GetUrlPart()."access/".basename($acc['fname']);
$chsum = md5_file($plfpath);
$size = filesize($plfpath);
$res = array(
'url'=>$url, 'token'=>$acc['token'],
'chsum'=>$chsum, 'size'=>$size,
'filename'=>$fname
);
break;
case "searchjob":
$res = $pars;
break;
case "file":
$res = array();
break;
default:
return PEAR::raiseError("Archive::downloadOpen: NotImpl ($trtype)");
}
if (PEAR::isError($res)) {
return $res;
}
switch ($trtype) {
case "audioclip":
case "metadata":
case "playlist":
case "playlistPkg":
$title = $this->bsGetTitle(NULL, $gunid);
break;
case "searchjob":
$title = 'searchjob';
break;
case "file":
$title = 'regular file';
break;
default:
}
$res['title'] = $title;
$res['trtype'] = $trtype;
return $res;
}
/**
* Close download transport
*
* @param string $token
* transport token
* @param string $trtype
* transport type
* @return array
* hasharray with:
* url string: writable URL
* token string: PUT token
*/
function downloadClose($token, $trtype)
{
switch ($trtype) {
case "audioclip":
$res = $this->downloadRawAudioDataClose($token);
if (PEAR::isError($res)) {
return $res;
}
return $res;
case "metadata":
$res = $this->downloadMetadataClose($token);
return $res;
case "playlist":
$res = $this->releasePlaylist(NULL/*$sessid*/, $token);
return $res;
case "playlistPkg":
$res = BasicStor::bsRelease($token, 'download');
if (PEAR::isError($res)) {
return $res;
}
$realFname = $r['realFname'];
@unlink($realFname);
if (preg_match("|(plExport_[^\.]+)\.lspl$|", $realFname, $va)) {
list(,$tmpn) = $va;
$tmpn = $CC_CONFIG['transDir']."/$tmpn";
if (file_exists($tmpn)) {
@unlink($tmpn);
}
}
return $res;
case "searchjob":
$res = BasicStor::bsRelease($token, 'download');
return $res;
case "file":
return array();
default:
return PEAR::raiseError("Archive::downloadClose: NotImpl ($trtype)");
}
}
/**
* Prepare hub initiated transport
*
* @param string $target
* hostname of transport target
* @param string $trtype
* transport type
* @param string $direction
* 'up' | 'down'
* @param array $pars
* transport parameters
* @return mixed
*/
function prepareHubInitiatedTransfer(
$target, $trtype='file', $direction='up',$pars=array())
{
$tr = new Transport($this);
$trec = TransportRecord::create($tr, $trtype, $direction,
array_merge($pars, array('target'=>$target)));
if (PEAR::isError($trec)) {
return $trec;
}
return TRUE;
}
/**
* List hub initiated transports
*
* @param string $target
* hostname of transport target
* @param string $direction
* 'up' | 'down'
* @param string $trtok
* transport token
* @return mixed
*/
function listHubInitiatedTransfers(
$target=NULL, $direction=NULL, $trtok=NULL)
{
$tr = new Transport($this);
$res = $tr->getTransports($direction, $target, $trtok);
return $res;
}
/**
* Set state of hub initiated transport
*
* @param string $target
* hostname of transport target
* @param string $trtok
* transport token
* @param string $state
* transport state
* @return TransportRecord|PEAR_Error
*/
function setHubInitiatedTransfer($target, $trtok, $state)
{
$tr = new Transport($this);
$trec = TransportRecord::recall($tr, $trtok);
if (PEAR::isError($trec)) {
return $trec;
}
$r = $trec->setState($state);
if (PEAR::isError($r)) {
return $r;
}
return $trec;
}
/* ==================================================== auxiliary methods */
} // class Archive
?>

View File

@ -1,138 +0,0 @@
<?php
/**
* ArchiveServer configuration file
*/
include(dirname(__FILE__)."/../../storageServer/var/campcaster_version.php");
/**
* configuration structure:
*
* <dl>
* <dt>dsn<dd> datasource setting
* <dt>tblNamePrefix <dd>prefix for table names in the database
* <dt>authCookieName <dd>secret token cookie name
* <dt>storageDir <dd>main directory for storing binary media files
* <dt>bufferDir <dd>directory for temporary files
* <dt>transDir <dd>directory for incomplete transferred files
* <dt>accessDir <dd>directory for symlinks to accessed files
* <dt>isArchive <dd>local/central flag
* <dt>validate <dd>enable/disable validator
* <dt>useTrash <dd>enable/disable safe delete (move to trash)
* (FALSE on archiveServer)
* <dt>storageUrlPath<dd>path-URL-part of storageServer base dir
* (on central archive side: storage=archive)
* <dt>storageXMLRPC<dd>XMLRPC server script address relative to storageUrlPath
* <dt>storageUrlHost, storageUrlPort<dd>host and port of storageServer
* <dt>archiveUrlPath<dd>path-URL-part of archiveServer base dir
* <dt>archiveXMLRPC<dd>XMLRPC server script address relative to archiveUrlPath
* <dt>archiveUrlHost, archiveUrlPort<dd>host and port of archiveServer
* </dl>
*/
// these are the default values for the config
$CC_CONFIG = array(
/* ================================================== basic configuration */
'dsn' => array(
'username' => 'test',
'password' => 'test',
'hostspec' => 'localhost',
'phptype' => 'pgsql',
'database' => 'Campcaster-test',
),
'tblNamePrefix' => 'as_',
/* ================================================ storage configuration */
'authCookieName'=> 'assid',
'AdminsGr' => 'Admins',
'StationPrefsGr'=> '',
'AllGr' => 'All',
'storageDir' => dirname(__FILE__).'/../../archiveServer/var/stor',
'bufferDir' => dirname(__FILE__).'/../../archiveServer/var/stor/buffer',
'transDir' => dirname(__FILE__).'/../../archiveServer/var/trans',
'accessDir' => dirname(__FILE__).'/../../archiveServer/var/access',
'pearPath' => dirname(__FILE__).'/../../../../usr/lib/pear',
'isArchive' => TRUE,
'validate' => TRUE,
'useTrash' => FALSE,
/* ==================================================== URL configuration */
// on central archive side: archive is the storage !
'storageUrlPath' => '/campcasterArchiveServer',
'storageXMLRPC' => 'xmlrpc/xrArchive.php',
'storageUrlHost' => 'localhost',
'storageUrlPort' => 80,
// have to be another remote archive:
#'archiveUrlPath' => '/campcasterArchiveServer',
#'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
#'archiveUrlHost' => 'localhost',
#'archiveUrlPort' => 80,
/* ==================================== application-specific configuration */
'objtypes' => array(
'Storage' => array(/*'Folder',*/ 'File' /*, 'Replica'*/),
// 'Folder' => array('Folder', 'File', 'Replica'),
'File' => array(),
'audioclip' => array(),
'playlist' => array(),
// 'Replica' => array(),
),
'allowedActions'=> array(
// 'Folder' => array('editPrivs', 'write', 'read'),
'File' => array('editPrivs', 'write', 'read'),
'audioclip' => array('editPrivs', 'write', 'read'),
'playlist' => array('editPrivs', 'write', 'read'),
// 'Replica' => array('editPrivs', 'write', 'read'),
// '_class' => array('editPrivs', 'write', 'read'),
),
'allActions' => array(
'editPrivs', 'write', 'read', /*'classes',*/ 'subjects'
),
/* ============================================== auxiliary configuration */
'tmpRootPass' => 'q',
);
// Add database table names
$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'].'files';
$CC_CONFIG['mdataTable'] = $CC_CONFIG['tblNamePrefix'].'mdata';
$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'].'access';
$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'].'perms';
$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'].'sess';
$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'].'subjs';
$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'].'smemb';
$CC_CONFIG['transTable'] = $CC_CONFIG['tblNamePrefix'].'trans';
$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref';
$CC_CONFIG['sysSubjs'] = array(
'root', $CC_CONFIG['AdminsGr'], $CC_CONFIG['AllGr'], $CC_CONFIG['StationPrefsGr']
);
$old_ip = get_include_path();
set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'].PATH_SEPARATOR.$old_ip);
//
// See if a ~/.campcaster/archiveServer.conf.php exists, and
// overwrite the settings from there, if any.
//
$this_file = null;
if (isset($_SERVER["SCRIPT_FILENAME"])) {
$this_file = $_SERVER["SCRIPT_FILENAME"];
} elseif(isset($argv[0])) {
$this_file = $argv[0];
}
if (!is_null($this_file)) {
$fileowner_id = fileowner($this_file);
$fileowner_array = posix_getpwuid($fileowner_id);
$fileowner_homedir = $fileowner_array['dir'];
$home_conf = $fileowner_homedir . '/.campcaster/archiveServer.conf.php';
if (file_exists($home_conf)) {
$default_config = $CC_CONFIG;
include($home_conf);
$user_config = $CC_CONFIG;
$CC_CONFIG = $user_config + $default_config;
}
}
?>

View File

@ -1,120 +0,0 @@
<?php
/**
* ArchiveServer configuration file
*/
include(dirname(__FILE__)."/../../storageServer/var/campcaster_version.php");
/**
* configuration structure:
*
* <dl>
* <dt>dsn<dd> datasource setting
* <dt>tblNamePrefix <dd>prefix for table names in the database
* <dt>authCookieName <dd>secret token cookie name
* <dt>storageDir <dd>main directory for storing binary media files
* <dt>bufferDir <dd>directory for temporary files
* <dt>transDir <dd>directory for incomplete transferred files
* <dt>accessDir <dd>directory for symlinks to accessed files
* <dt>isArchive <dd>local/central flag
* <dt>validate <dd>enable/disable validator
* <dt>useTrash <dd>enable/disable safe delete (move to trash)
* (FALSE on archiveServer)
* <dt>storageUrlPath<dd>path-URL-part of storageServer base dir
* (on central archive side: storage=archive)
* <dt>storageXMLRPC<dd>XMLRPC server script address relative to storageUrlPath
* <dt>storageUrlHost, storageUrlPort<dd>host and port of storageServer
* <dt>archiveUrlPath<dd>path-URL-part of archiveServer base dir
* <dt>archiveXMLRPC<dd>XMLRPC server script address relative to archiveUrlPath
* <dt>archiveUrlHost, archiveUrlPort<dd>host and port of archiveServer
* </dl>
*/
// these are the default values for the config
$CC_CONFIG = array(
/* ================================================== basic configuration */
'dsn' => array(
'username' => 'ls_dbuser',
'password' => 'ls_dbpassword',
'hostspec' => 'ls_dbserver',
'phptype' => 'pgsql',
'database' => 'ls_database',
),
'tblNamePrefix' => 'as_',
/* ================================================ storage configuration */
'authCookieName'=> 'assid',
'AdminsGr' => 'Admins',
'StationPrefsGr'=> '',
'AllGr' => 'All',
'storageDir' => dirname(__FILE__).'/../../archiveServer/var/stor',
'bufferDir' => dirname(__FILE__).'/../../archiveServer/var/stor/buffer',
'transDir' => dirname(__FILE__).'/../../archiveServer/var/trans',
'accessDir' => dirname(__FILE__).'/../../archiveServer/var/access',
'pearPath' => 'ls_lib_dir/pear',
'isArchive' => TRUE,
'validate' => TRUE,
'useTrash' => FALSE,
/* ==================================================== URL configuration */
// on central archive side: archive is the storage !
'storageUrlPath' => 'ls_storageUrlPath',
'storageXMLRPC' => 'xmlrpc/xrArchive.php',
'storageUrlHost' => 'ls_php_host',
'storageUrlPort' => ls_php_port,
// have to be another remote archive:
#'archiveUrlPath' => 'ls_archiveUrlPath',
#'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
#'archiveUrlHost' => 'ls_php_host',
#'archiveUrlPort' => ls_php_port,
/* ==================================== aplication-specific configuration */
'objtypes' => array(
'RootNode' => array('Folder'),
'Storage' => array('Folder', 'File', 'Replica'),
'Folder' => array('Folder', 'File', 'Replica'),
'File' => array(),
'audioclip' => array(),
'playlist' => array(),
'Replica' => array(),
),
'allowedActions'=> array(
'RootNode' => array('classes', 'subjects'),
'Folder' => array('editPrivs', 'write', 'read'),
'File' => array('editPrivs', 'write', 'read'),
'audioclip' => array('editPrivs', 'write', 'read'),
'playlist' => array('editPrivs', 'write', 'read'),
'Replica' => array('editPrivs', 'write', 'read'),
'_class' => array('editPrivs', 'write', 'read'),
),
'allActions' => array(
'editPrivs', 'write', 'read', 'classes', 'subjects'
),
/* ============================================== auxiliary configuration */
'RootNode' => 'RootNode',
'tmpRootPass' => 'q',
);
// Add database table names
$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'].'files';
$CC_CONFIG['mdataTable'] = $CC_CONFIG['tblNamePrefix'].'mdata';
$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'].'access';
$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'].'perms';
$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'].'sess';
$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'].'subjs';
$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'].'smemb';
$CC_CONFIG['classTable'] = $CC_CONFIG['tblNamePrefix'].'classes';
$CC_CONFIG['cmembTable'] = $CC_CONFIG['tblNamePrefix'].'cmemb';
$CC_CONFIG['treeTable'] = $CC_CONFIG['tblNamePrefix'].'tree';
$CC_CONFIG['structTable'] = $CC_CONFIG['tblNamePrefix'].'struct';
$CC_CONFIG['transTable'] = $CC_CONFIG['tblNamePrefix'].'trans';
$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref';
$CC_CONFIG['sysSubjs'] = array(
'root', $CC_CONFIG['AdminsGr'], $CC_CONFIG['AllGr'], $CC_CONFIG['StationPrefsGr']
);
$old_ip = get_include_path();
set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'].PATH_SEPARATOR.$old_ip);
?>

View File

@ -1,50 +0,0 @@
<?php
/**
* ArchiveServer configuration file
*/
/**
* configuration structure:
*
* <dl>
* <dt>dsn<dd> datasource setting
* <dt>tblNamePrefix <dd>prefix for table names in the database
* <dt>authCookieName <dd>secret token cookie name
* <dt>storageDir <dd>main directory for storing binary media files
* <dt>bufferDir <dd>directory for temporary files
* <dt>transDir <dd>directory for incomplete transferred files
* <dt>accessDir <dd>directory for symlinks to accessed files
* <dt>isArchive <dd>local/central flag
* <dt>storageUrlPath<dd>path-URL-part of storageServer base dir
* (on central archive side: storage=archive)
* <dt>storageXMLRPC<dd>XMLRPC server script address relative to storageUrlPath
* <dt>storageUrlHost, storageUrlPort<dd>host and port of storageServer
* <dt>archiveUrlPath<dd>path-URL-part of archiveServer base dir
* <dt>archiveXMLRPC<dd>XMLRPC server script address relative to archiveUrlPath
* <dt>archiveUrlHost, archiveUrlPort<dd>host and port of archiveServer
* </dl>
*/
$CC_CONFIG = array(
/* ================================================== basic configuration */
'dsn' => array(
'username' => 'ls_dbuser',
'password' => 'ls_dbpassword',
'hostspec' => 'ls_dbserver',
'phptype' => 'pgsql',
'database' => 'ls_database',
),
/* ==================================================== URL configuration */
// on central archive side: archive is the storage !
'storageUrlPath' => 'ls_archiveUrlPath',
'storageXMLRPC' => 'xmlrpc/xrArchive.php',
'storageUrlHost' => 'ls_php_host',
'storageUrlPort' => ls_php_port,
// have to be another remote archive:
#'archiveUrlPath' => 'ls_archiveUrlPath',
#'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
#'archiveUrlHost' => 'ls_php_host',
#'archiveUrlPort' => ls_php_port,
);
?>

View File

@ -1,21 +0,0 @@
<?php
/**
* @package Campcaster
* @subpackage ArchiveServer
*/
header ("location: html/gbHtmlLogin.php");
exit;
/*
?>
<html><head>
<title>ArchiveServer module</title>
</head><body>
<h3>ArchiveServer module</h3>
<br>
<a href="../html/gbHtmlLogin.php" accesskey="H"><b>H</b>TML client</a><br>
<a href="../xmlrpc/" accesskey="X"><b>X</b>mlRpc test</a><br>
<a href="../tests/" accesskey="T"><b>T</b>est</a><br>
</body></html>
<?
*/
?>

View File

@ -1,10 +0,0 @@
<?php
/*------------------------------------------------------------------------------
* This (web-callable) script returns group running httpd
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
$egid = posix_getegid();
$info = posix_getgrgid($egid);
echo $info['name'];
?>

View File

@ -1,10 +0,0 @@
<?php
/*------------------------------------------------------------------------------
* This script returns storage root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require("../conf.php");
echo "http://{$CC_CONFIG['storageUrlHost']}:{$CC_CONFIG['storageUrlPort']}".
"{$CC_CONFIG['storageUrlPath']}";
?>

View File

@ -1,10 +0,0 @@
<?php
/*------------------------------------------------------------------------------
* This script returns storage XMLRPC root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require("../conf.php");
echo "http://{$CC_CONFIG['storageUrlHost']}:{$CC_CONFIG['storageUrlPort']}".
"{$CC_CONFIG['storageUrlPath']}/{$CC_CONFIG['storageXMLRPC']}";
?>

View File

@ -1,5 +0,0 @@
<?php
header ("location: ../index.php");
die;
?>

View File

@ -1,37 +0,0 @@
<?php
/**
* @package Campcaster
* @subpackage ArchiveServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*
*/
// no remote execution
$arr = array_diff_assoc($_SERVER, $_ENV);
if (isset($arr["DOCUMENT_ROOT"]) && $arr["DOCUMENT_ROOT"] != "") {
header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n";
exit(1);
}
echo "*************************\n";
echo "* ArchiveServer Install *\n";
echo "*************************\n";
require_once('../conf.php');
require_once('../../../storageServer/var/GreenBox.php');
require_once('../../../storageServer/var/install/installInit.php');
campcaster_db_connect();
require_once('../../../storageServer/var/install/installMain.php');
echo "**********************************\n";
echo "* ArchiveServer Install Complete *\n";
echo "**********************************\n";
?>

View File

@ -1,36 +0,0 @@
<?php
/**
* @package Campcaster
* @subpackage ArchiveServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
// Do not allow remote execution.
$arr = array_diff_assoc($_SERVER, $_ENV);
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n";
exit;
}
echo "***************************\n";
echo "* ArchiveServer Uninstall *\n";
echo "***************************\n";
require_once('../conf.php');
require_once('../../../storageServer/var/install/installInit.php');
campcaster_db_connect();
require_once('../../../storageServer/var/install/uninstallMain.php');
echo "************************************\n";
echo "* ArchiveServer Uninstall Complete *\n";
echo "************************************\n";
?>

View File

@ -1,222 +0,0 @@
<?php
/**
* @package Campcaster
* @subpackage ArchiveServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
require_once "../Archive.php";
/**
* XML-RPC interface for Archive.
*
* @package Campcaster
* @subpackage ArchiveServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
class XR_Archive extends Archive {
/**
* Simple ping method - return strtouppered string
*
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_ping($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = date("Ymd-H:i:s")." Network hub answer: {$r['par']}";
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_uploadOpen($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->uploadOpen($r['sessid'], $r['chsum']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_uploadOpen: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* Check state of file upload
*
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_uploadCheck($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->uploadCheck($r['token']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_uploadCheck: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_uploadClose($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->uploadClose($r['token'], $r['trtype'], $r['pars']);
if (PEAR::isError($res)) {
$code = 803;
// Special case for duplicate file - give back
// different error code so we can display nice user message.
if ($res->getCode() == GBERR_GUNID) {
$code = 888;
}
return new XML_RPC_Response(0, $code,
"xr_uploadClose: ".$res->getMessage().
" ".$res->getUserInfo()
);
}
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_downloadOpen($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->downloadOpen($r['sessid'], $r['trtype'], $r['pars']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_downloadOpen: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_downloadClose($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->downloadClose($r['token'], $r['trtype']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_downloadClose: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_prepareHubInitiatedTransfer($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
foreach (array('trtype'=>NULL, 'direction'=>'up', 'pars'=>array()) as $k => $dv) {
if (!isset($r[$k])) {
$r[$k] = $dv;
}
}
$res = $this->prepareHubInitiatedTransfer(
$r['target'], $r['trtype'], $r['direction'], $r['pars']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_prepareHubInitiatedTransfer: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_listHubInitiatedTransfers($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
foreach (array('target'=>NULL, 'direction'=>NULL, 'trtok'=>NULL) as $k=>$dv) {
if (!isset($r[$k])) {
$r[$k] = $dv;
}
}
$res = $this->listHubInitiatedTransfers(
$r['target'], $r['direction'], $r['trtok']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_listHubInitiatedTransfers: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_setHubInitiatedTransfer($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->setHubInitiatedTransfer(
$r['target'], $r['trtok'], $r['state']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_setHubInitiatedTransfer: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
}
?>

View File

@ -1,99 +0,0 @@
<?php
/**
* Store PUT data as temporary file.
*
* put.php is remote callable script through HTTP PUT method.
* Requires token returned by appropriate storageServer XMLRPC call.
* Appropriate closing XMLRPC call should follow.
*
* This script accepts following HTTP GET parameter:
* <ul>
* <li>token : string, put token returned by appropriate
* XMLRPC call</li>
* </ul>
*
* On success, returns HTTP return code 200.
*
* On errors, returns HTTP return code &gt;200
* The possible error codes are:
* <ul>
* <li> 400 - Incorrect parameters passed to method</li>
* <li> 403 - Access denied</li>
* <li> 500 - Application error</li>
* </ul>
*
* @see XR_LocStor
* @package Campcaster
* @subpackage ArchiveServer
*/
define('USE_FLOCK', TRUE);
require_once(dirname(__FILE__).'/../conf.php');
require_once('DB.php');
require_once(dirname(__FILE__).'/../Archive.php');
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = new Archive($CC_DBC, $CC_CONFIG);
function http_error($code, $err)
{
header("HTTP/1.1 $code");
header("Content-type: text/plain; charset=UTF-8");
echo "$err\r\n";
flush();
exit;
}
if (preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['token'])) {
$token = $_REQUEST['token'];
} else {
http_error(400, "Error on token parameter. ({$_REQUEST['token']})");
}
$tc = BasicStor::bsCheckToken($token, 'put');
if (PEAR::isError($tc)) {
http_error(500, $ex->getMessage());
}
if (!$tc) {
http_error(403, "put.php: Token not valid ($token).");
}
header("Content-type: text/plain");
$destfile = "{$CC_CONFIG['accessDir']}/{$token}";
/* PUT data comes in on the input stream */
$putdata = @fopen("php://input", "r") or
http_error(500, "put.php: Can't read input");
/* Open a file for writing */
$fp = @fopen($destfile, "ab") or
http_error(500, "put.php: Can't write to destination file (token=$token)");
if ( USE_FLOCK ) {
// lock the file
$lockres = flock($fp,LOCK_EX+LOCK_NB);
if ($lockres !== TRUE) {
http_error(409, "put.php: file locked (token=$token)");
}
}
/* Read the data 1 KB at a time and write to the file */
while ($data = fread($putdata, 1024)){
fwrite($fp, $data);
}
if ( USE_FLOCK ) {
// unlock the file
flock($fp,LOCK_UN);
}
/* Close the streams */
fclose($fp);
fclose($putdata);
header("HTTP/1.1 200");
?>

View File

@ -1,367 +0,0 @@
#!/bin/bash
#DEBUG=yes
#DEBUG_I=yes
COMM=$1
shift
GUNID=$1
#METADATA="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
#<metadata><title>ěščřžé</title></metadata>"
XMETADATA="<?xml version=\"1.0\"?>
<audioClip>
<metadata xmlns=\"http://www.streamonthefly.org/\"
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
xmlns:dcterms=\"http://purl.org/dc/terms/\">
<dc:title>clip 1</dc:title>
<dcterms:extent>00:00:11</dcterms:extent>
</metadata>
</audioClip>"
METADATA="<?xml version=\"1.0\"?>
<audioClip>
<metadata
xmlns=\"http://mdlf.org/campcaster/elements/1.0/\"
xmlns:ls=\"http://mdlf.org/campcaster/elements/1.0/\"
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
xmlns:dcterms=\"http://purl.org/dc/terms/\"
xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"
>
<dc:title>Media title testRunner</dc:title>
<dcterms:extent>00:00:03.000000</dcterms:extent>
</metadata>
</audioClip>"
METAREGEX="(<\\?xml version=\"1\\.0\"( encoding=\"UTF-8\")?\\?> )?\
<audioClip>\
<metadata\
xmlns=\"http://mdlf\\.org/campcaster/elements/1\\.0/\"\
xmlns:dc=\"http://purl\\.org/dc/elements/1\\.1/\"\
xmlns:dcterms=\"http://purl\\.org/dc/terms/\"\
xmlns:ls=\"http://mdlf\\.org/campcaster/elements/1\\.0/\"\
xmlns:xml=\"http://www\\.w3\\.org/XML/1998/namespace\"\
>\
<dc:title>Media title testRunner</dc:title>\
<dcterms:extent>00:00:03\\.000000</dcterms:extent>\
<ls:mtime>[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}([-+][0-9]{1,2}:[0-9]{2})?</ls:mtime>\
</metadata>\
</audioClip>"
echo ""
XRDIR=`dirname $0`
XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
echo "# storageServer XMLRPC URL: $XMLRPC"
cd $XRDIR
#XR_CLI="./xr_cli_test.py -s ${XMLRPC}"
XR_CLI="php -q xr_cli_test.php -s ${XMLRPC}"
login() {
echo -n "# login: "
SESSID=`$XR_CLI login root q` || \
{ ERN=$?; echo $SESSID; exit $ERN; }
echo "sessid: $SESSID"
}
test() {
echo "# test: "
$XR_CLI test $SESSID stringForUppercase || exit $?
}
existsAudioClip() {
echo -n "# existsAudioClip (${GUNID}): "
$XR_CLI existsAudioClip $SESSID $GUNID || exit $?
}
storeAudioClip() {
MEDIA=../../../storageServer/var/tests/ex1.mp3
MD5=`md5sum $MEDIA`; for i in $MD5; do MD5=$i; break; done
if [ $DEBUG_I ]; then echo "md5=$MD5"; fi
echo -n "# storeAudioClipOpen: "
RES=`$XR_CLI storeAudioClipOpen "$SESSID" '' "$METADATA" "stored file.mp3" "$MD5"` || \
{ ERN=$?; echo $RES; exit $ERN; }
unset URL
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
echo $TOKEN
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# curl (PUT): "
curl -C 0 -T $MEDIA $URL || { ERN=$?; echo $RGUNID; exit $ERN; }
echo "status: $?"
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# storeAudioClipClose: "
RGUNID=`$XR_CLI storeAudioClipClose "$SESSID" "$TOKEN"` || \
{ ERN=$?; echo $RGUNID; exit $ERN; }
echo $RGUNID
}
accessRawAudioData() {
echo -n "# accessRawAudioData: "
RES=`$XR_CLI accessRawAudioData $SESSID $GUNID` || \
{ ERN=$?; echo $RES; exit $ERN; }
unset URL
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
echo $TOKEN
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# releaseRawAudioData: "
$XR_CLI releaseRawAudioData $SESSID $TOKEN || exit $?
}
downloadRAD() {
echo -n "# downloadRawAudioDataOpen: "
RES=`$XR_CLI downloadRawAudioDataOpen $SESSID $GUNID` || \
{ ERN=$?; echo $RES; exit $ERN; }
unset URL
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
echo $TOKEN
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# curl: "
curl -Ifs $URL > /dev/null || { ERN=$?; echo $URL; exit $ERN; }
echo "status: $?"
echo -n "# downloadRawAudioDataClose: "
$XR_CLI downloadRawAudioDataClose $SESSID $TOKEN || exit $?
}
downloadMeta() {
echo -n "# downloadMetadataOpen: "
RES=`$XR_CLI downloadMetadataOpen $SESSID $GUNID` || \
{ ERN=$?; echo $RES; exit $ERN; }
unset URL
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
echo $TOKEN
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# curl: "
METAOUT=`curl -fs $URL;` || { ERN=$?; echo $RES; exit $ERN; }
echo "OK"
if [ $DEBUG_I ]; then echo $METAOUT; echo -n "Press enter ..."; read KEY; fi
echo -n "# metadata check:"
METAOUT=`echo $METAOUT | sed -e 's/\\n/ /g'`
if [[ "x$METAOUT" =~ "x$METAREGEX" ]]; then
echo " OK"
else
echo " NOT MATCH ($?)"
echo " Expected match to regex:"; echo $METAREGEX
echo " Downloaded:"; echo $METAOUT
exit 1
fi
echo -n "# downloadMetadataClose: "
$XR_CLI downloadMetadataClose $SESSID $TOKEN || exit $?
}
deleteAudioClip() {
echo -n "# deleteAudioClip: "
# disabled:
# $XR_CLI deleteAudioClip $SESSID $GUNID || exit $?
$XR_CLI deleteAudioClip $SESSID $GUNID 0
}
updateAudioClipMetadata() {
echo -n "#updateAudioClipMetadata: "
$XR_CLI updateAudioClipMetadata $SESSID $GUNID "$METADATA" || exit $?
}
getAudioClip() {
echo -n "#getAudioClip: "
$XR_CLI getAudioClip $SESSID $GUNID || exit $?
}
searchMetadata() {
echo -n "# searchMetadata: "
# $XR_CLI searchMetadata $SESSID '../tests/srch_cri1.xml' || exit $?
$XR_CLI searchMetadata $SESSID 'John %' || exit $?
}
PLID="123456789abcdef8"
createPlaylist() {
echo -n "# createPlaylist: "
$XR_CLI createPlaylist $SESSID $PLID "newPlaylist.xml" || exit $?
}
accessPlaylist() {
echo -n "# accessPlaylist: "
RES=`$XR_CLI accessPlaylist $SESSID $PLID` || \
{ ERN=$?; echo $RES; exit $ERN; }
unset URL
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
echo $TOKEN
if [ $DEBUG_I ]; then echo $URL; fi
echo "# curl: "
CURLOUT=`curl -fs $URL;` || { ERN=$?; echo $RES; exit $ERN; }
if [ $DEBUG ]; then echo $CURLOUT; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo "# status: $?"
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# releasePlaylist: "
$XR_CLI releasePlaylist $SESSID $TOKEN || exit $?
}
editPlaylist() {
DATE=`date '+%H:%M:%S'`
PLAYLIST="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<smil><head><metadata>
<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/metadata/dublin_core#\">
<dc:title>XY $DATE</dc:title>
</rdf:RDF>
</metadata></head><body><seq>
<audio src=\"123456789abcdefa\"/>
<audio src=\"123456789abcdefb\"/>
</seq></body></smil>"
echo -n "# editPlaylist: "
RES=`$XR_CLI editPlaylist $SESSID $PLID` || \
{ ERN=$?; echo $RES; exit $ERN; }
unset URL
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
echo $TOKEN
# deletePlaylist
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
if [ $DEBUG_I ]; then echo " Playlist:"; echo $PLAYLIST; fi
echo -n "# savePlaylist: "
$XR_CLI savePlaylist $SESSID $TOKEN "$PLAYLIST" || exit $?
}
existsPlaylist() {
echo -n "# existsPlaylist (${PLID}): "
$XR_CLI existsPlaylist $SESSID $PLID || exit $?
}
deletePlaylist() {
echo -n "# deletePlaylist (${PLID}): "
$XR_CLI deletePlaylist $SESSID $PLID
# || exit $?
echo "# status: $?"
}
prefTest() {
PREFKEY="testKey"
PREFVAL="test preference value"
echo -n "# savePref: "
$XR_CLI savePref $SESSID "$PREFKEY" "$PREFVAL"|| exit $?
echo -n "# loadPref: "
VAL=`$XR_CLI loadPref $SESSID "$PREFKEY"` || \
{ ERN=$?; echo $VAL; exit $ERN; }
echo "$VAL "
if [ "x$VAL" != "x$PREFVAL" ] ; then
echo " NOT MATCH"
echo " Expected:"; echo $PREFVAL
echo " Returned:"; echo $VAL
exit 1
else
echo "# pref value check: OK"
fi
echo -n "# delPref: "
$XR_CLI delPref $SESSID "$PREFKEY"|| exit $?
if [ $DEBUG ]; then
echo -n "# loadPref: "
VAL=`$XR_CLI loadPref $SESSID "$PREFKEY"` || echo $?
else
echo $VAL
fi
}
logout() {
echo -n "# logout: "
$XR_CLI logout $SESSID || exit $?
}
preferenceTest(){
echo "#XMLRPC preference test"
login
prefTest
logout
echo "#XMLRPC: preference: OK."
echo ""
}
playlistTest(){
echo "#XMLRPC playlists test"
login
existsPlaylist
deletePlaylist
createPlaylist
existsPlaylist
accessPlaylist
editPlaylist
accessPlaylist
deletePlaylist
existsPlaylist
logout
echo "#XMLRPC: playlists: OK."
echo ""
}
storageTest(){
echo "#XMLRPC: storage test"
login
storeAudioClip
GUNID=$RGUNID
existsAudioClip
accessRawAudioData
downloadRAD
downloadMeta
deleteAudioClip
existsAudioClip
logout
echo "#XMLRPC: storage: OK."
echo ""
}
usage(){
echo "Usage: $0 [<command>] [args]"
echo -e "commands:\n test\n existsAudioClip\n accessRawAudioData"
echo -e " storeAudioClip\n deleteAudioClip\n updateAudioClipMetadata"
echo -e " getAudioClip\n searchMetadata\n"
echo -e " preferences\n playlists\n storage\n"
}
if [ "$COMM" == "test" ]; then
login
test
logout
elif [ "$COMM" == "existsAudioClip" ]; then
login
existsAudioClip
logout
elif [ "$COMM" == "accessRawAudioData" ]; then
login
accessRawAudioData
logout
elif [ "$COMM" == "storeAudioClip" ]; then
login
storeAudioClip
logout
elif [ "$COMM" == "deleteAudioClip" ]; then
login
deleteAudioClip
logout
elif [ "$COMM" == "updateAudioClipMetadata" ]; then
login
updateAudioClipMetadata
logout
elif [ "$COMM" == "getAudioClip" ]; then
login
getAudioClip
logout
elif [ "$COMM" == "searchMetadata" ]; then
login
searchMetadata
logout
elif [ "$COMM" == "preferences" ]; then
preferenceTest
elif [ "$COMM" == "playlists" ]; then
playlistTest
elif [ "$COMM" == "storage" ]; then
storageTest
elif [ "x$COMM" == "x" ]; then
storageTest
# playlistTest
# preferenceTest
elif [ "$COMM" == "help" ]; then
usage
else
echo "Unknown command"
usage
fi

View File

@ -1,138 +0,0 @@
<?php
/**
* @package Campcaster
* @subpackage ArchiveServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
/* ====================================================== specific PHP config */
//error_reporting(0);
ini_set("html_errors", FALSE);
ini_set("error_prepend_string", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>804</int></value>
</member>
<member>
<name>faultString</name>
<value><string>");
ini_set("error_append_string", "</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>");
header("Content-type: text/xml");
/* ================================================================= includes */
require_once(dirname(__FILE__).'/../conf.php');
require_once('DB.php');
require_once("XML/RPC/Server.php");
require_once('XR_Archive.php');
/* ============================================ setting default error handler */
function errHndl($errno, $errmsg, $filename, $linenum, $vars)
{
switch ($errno) {
case E_WARNING:
case E_NOTICE:
case E_USER_WARNING:
case E_USER_NOTICE:
return;
break;
default:
$xr = new XML_RPC_Response(0, 805,
htmlspecialchars("ERROR:xrLocStor: $errno $errmsg ($filename:$linenum)"));
header("Content-type: text/xml");
echo $xr->serialize();
exit($errno);
}
}
$old_error_handler = set_error_handler("errHndl", E_ALL);
/* ============================================================= runable code */
$CC_DBC =& DB::connect($CC_CONFIG['dsn'], TRUE);
if (PEAR::isError($CC_DBC)) {
trigger_error("DB::connect: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo(),E_USER_ERROR);
}
$CC_DBC->setErrorHandling(PEAR_ERROR_RETURN);
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
$archive = new XR_Archive($CC_DBC, $CC_CONFIG);
$methods = array(
'test' => 'Tests toupper and checks sessid, params: '.
'teststring, sessid.',
'getVersion' => 'Dummy function for connection testing.',
'authenticate' => 'Checks authentication.',
'login' => 'Login to storage.',
'logout' => 'Logout from storage.',
'existsAudioClip' => 'Checks if an Audio clip with the specified '.
'id is stored in local storage.',
'storeAudioClipOpen' => 'Open channel for store a new audio clip '.
'or replace an existing one.',
'storeAudioClipClose' => 'Close channel for store a new audio clip'.
' or replace an existing one.',
'downloadRawAudioDataOpen'=> 'Create and return downloadable URL'.
'for audio file',
'downloadRawAudioDataClose'=>'Discard downloadable URL for audio file',
'downloadMetadataOpen' => 'Create and return downloadable URL'.
'for metadata',
'downloadMetadataClose' => 'Discard downloadable URL for metadata',
'openPut' => 'openPut',
'closePut' => 'closePut',
'deleteAudioClip' => 'Delete an existing Audio clip.',
'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '.
'stored in Local storage.',
'searchMetadata' => 'Search through the metadata of stored '.
'AudioClips, return all matching clip ids.',
'accessRawAudioData' => 'Get access to raw audio data.',
'releaseRawAudioData' => 'Release access to raw audio data.',
'getAudioClip' => 'Return the contents of an Audio clip.',
'resetStorage' => 'Reset storageServer for debugging.',
'createPlaylist' => 'Create a new Playlist metafile.',
'editPlaylist' => 'Open a Playlist metafile for editing.',
'savePlaylist' => 'Save a Playlist metafile.',
'deletePlaylist' => 'Delete a Playlist metafile.',
'accessPlaylist' => 'Open readable URL to a Playlist metafile.',
'releasePlaylist' => 'Release readable URL from accessPlaylist.',
'existsPlaylist' => 'Check whether a Playlist exists.',
'playlistIsAvailable' => 'Check whether a Playlist is available '.
'for editing.',
'uploadOpen' => 'Open file-layer upload',
'uploadCheck' => 'Check the checksum of uploaded file',
'uploadClose' => 'Close file-layer upload',
'downloadOpen' => 'Open file-layer download',
// 'downloadCheck' => 'Check the checksum of downloaded file',
'downloadClose' => 'Close file-layer download',
'prepareHubInitiatedTransfer' => 'Prepare hub initiated transfer',
'listHubInitiatedTransfers' => 'List hub initiated transfers',
'setHubInitiatedTransfer' => 'Set state of hub initiated transfers',
'ping' => 'Echo request',
);
$defs = array();
foreach($methods as $method => $description){
$defs["archive.$method"] = array(
"function" => array(&$archive, "xr_$method"),
# "function" => "\$GLOBALS['archive']->xr_$method",
"signature" => array(
array($GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_Struct'])
),
"docstring" => $description
);
}
$s = new XML_RPC_Server($defs);
?>

View File

@ -1,183 +0,0 @@
<?php
require_once dirname(__FILE__).'/../conf.php';
include_once "XML/RPC.php";
$pars = $argv;
array_shift($pars);
$verbose = FALSE;
#$verbose = TRUE;
if($pars[0] == '-v'){ $verbose = TRUE; array_shift($pars); }
if($pars[0] == '-s'){
array_shift($pars);
$serverPath = array_shift($pars);
}else{
$serverPath = 'http://localhost:80/campcasterArchiveServer/xmlrpc/xrArchive.php';
}
$url = parse_url($serverPath);
$client = new XML_RPC_Client($url['path'], $url['host']);
$method = array_shift($pars);
if($verbose){
echo "serverPath: $serverPath\n";
echo "host: {$url['host']}, path: {$url['path']}\n";
echo "method: $method\n";
echo "pars:\n";
var_dump($pars);
}
$infos = array(
"listMethods" => array('m'=>"system.listMethods", 'p'=>NULL),
"methodHelp" => array('m'=>"system.methodHelp", 'p'=>0),
"methodSignature" => array('m'=>"system.methodSignature", 'p'=>0),
"test" =>
array('m'=>"archive.test", 'p'=>array('sessid', 'teststring')),
"getVersion" => array('m'=>"archive.getVersion",
'p'=>array(), 'r'=>'version'),
"authenticate" => array('m'=>"archive.authenticate",
'p'=>array('login', 'pass'), 'r'=>'authenticate'),
"login" => array('m'=>"archive.login",
'p'=>array('login', 'pass'), 'r'=>'sessid'),
"logout" => array('m'=>"archive.logout",
'p'=>array('sessid'), 'r'=>'status'),
"storeAudioClipOpen" => array('m'=>"archive.storeAudioClipOpen",
'p'=>array('sessid', 'gunid', 'metadata', 'fname', 'chsum'),
'r'=>array('url', 'token')
),
"storeAudioClipClose" => array('m'=>"archive.storeAudioClipClose",
'p'=>array('sessid', 'token'), 'r'=>'gunid'),
"accessRawAudioData" => array('m'=>"archive.accessRawAudioData",
'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')),
"releaseRawAudioData" => array('m'=>"archive.releaseRawAudioData",
'p'=>array('sessid', 'token'), 'r'=>'status'),
"downloadRawAudioDataOpen" =>
array('m'=>"archive.downloadRawAudioDataOpen",
'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')),
"downloadRawAudioDataClose" =>
array('m'=>"archive.downloadRawAudioDataClose",
'p'=>array('sessid', 'token'), 'r'=>'gunid'),
"downloadMetadataOpen" => array('m'=>"archive.downloadMetadataOpen",
'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')),
"downloadMetadataClose" => array('m'=>"archive.downloadMetadataClose",
'p'=>array('sessid', 'token'), 'r'=>'gunid'),
"deleteAudioClip" =>
array('m'=>"archive.deleteAudioClip",
'p'=>array('sessid', 'gunid','forced'), 'r'=>'status'),
"existsAudioClip" => array('m'=>"archive.existsAudioClip",
'p'=>array('sessid', 'gunid'), 'r'=>'exists'),
"getAudioClip" => array('m'=>"archive.getAudioClip",
'p'=>array('sessid', 'gunid'), 'r'=>'metadata'),
"updateAudioClipMetadata" => array('m'=>"archive.updateAudioClipMetadata",
'p'=>array('sessid', 'gunid', 'metadata'), 'r'=>'status'),
"searchMetadata" => array('m'=>"archive.searchMetadata", 'p'=>NULL),
"resetStorage" => array('m'=>"archive.resetStorage", 'p'=>array()),
"createPlaylist" => array('m'=>"archive.createPlaylist",
'p'=>array('sessid', 'plid', 'fname'), 'r'=>'plid'),
"editPlaylist" => array('m'=>"archive.editPlaylist",
'p'=>array('sessid', 'plid'), 'r'=>array('url', 'token')),
"savePlaylist" => array('m'=>"archive.savePlaylist",
'p'=>array('sessid', 'token', 'newPlaylist'), 'r'=>'plid'),
"deletePlaylist" => array('m'=>"archive.deletePlaylist",
'p'=>array('sessid', 'plid'), 'r'=>'status'),
"accessPlaylist" => array('m'=>"archive.accessPlaylist",
'p'=>array('sessid', 'plid'), 'r'=>array('url', 'token')),
"releasePlaylist" => array('m'=>"archive.releasePlaylist",
'p'=>array('sessid', 'token'), 'r'=>'plid'),
"existsPlaylist" => array('m'=>"archive.existsPlaylist",
'p'=>array('sessid', 'plid'), 'r'=>'exists'),
"playlistIsAvailable" => array('m'=>"archive.playlistIsAvailable",
'p'=>array('sessid', 'plid'), 'r'=>'available'),
"loadPref" => array('m'=>"archive.loadPref",
'p'=>array('sessid', 'key'), 'r'=>'value'),
"savePref" => array('m'=>"archive.savePref",
'p'=>array('sessid', 'key', 'value'), 'r'=>'status'),
"delPref" => array('m'=>"archive.delPref",
'p'=>array('sessid', 'key'), 'r'=>'status'),
"openPut" => array('m'=>"archive.openPut", 'p'=>array()),
"closePut" => array('m'=>"archive.closePut", 'p'=>array()),
"ping" => array('m'=>"archive.ping", 'p'=>array('par')),
);
$fullmethod = $infos[$method]['m'];
$pinfo = $infos[$method]['p'];
if(is_null($pinfo)){
$parr = NULL;
}elseif(!is_array($pinfo)){
$parr = $pars[0];
#echo "pinfo not null and not array.\n"; exit;
}elseif(count($pinfo) == 0){
$parr = array();
}else{
$parr = array(); $i=0;
foreach($pinfo as $it){
$parr[$it] = $pars[$i++];
}
}
switch($method){
case 'searchMetadata':
$parr = array(
'sessid'=>$pars[0],
'criteria'=>array(
'filetype'=>'audioclip',
'operator'=>'and',
'limit'=> 0,
'offset'=> 0,
'conditions'=>array(
array('cat'=>$pars[1], 'op'=>'partial', 'val'=>$pars[2])
)
),
);
break;
case 'resetStorage':
$parr = array(
'loadSampleData'=>(boolean)$pars[0],
'filesOnly'=>(boolean)$pars[1],
);
break;
}
$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr)));
if($verbose){
echo "parr:\n";
var_dump($parr);
echo "message:\n";
echo $msg->serialize()."\n";
}
$res = $client->send($msg);
if($res->faultCode() > 0) {
echo "xr_cli_test.php: ".$res->faultString()." ".$res->faultCode()."\n";
exit(1);
}
if($verbose){
echo "result:\n";
echo $res->serialize();
}
$resp = XML_RPC_decode($res->value());
if(isset($infos[$method]['r'])){
$pom = $infos[$method]['r'];
if(is_array($pom)){
foreach($pom as $k=>$it) $pom[$k] = $resp[$it];
echo join(' ', $pom)."\n";
}else switch($pom){
case"status":
case"exists":
echo ($resp[$pom]=='1' ? "TRUE" : "FALSE" )."\n";
break;
default:
echo "{$resp[$pom]}\n";
}
}else{
print_r($resp);
# echo"\n";
}
?>

View File

@ -7,6 +7,10 @@ define('UI_VERBOSE', FALSE);
define('UI_WARNING', TRUE);
define('UI_ERROR', TRUE);
// Note: this needs to be a variable, not a define because other
// parts of the application do not read in this file.
$WHITE_SCREEN_OF_DEATH = FALSE;
if (UI_DEBUG) {
error_reporting(E_ALL);
}
@ -114,6 +118,9 @@ define('UI_PL_ELEM_FADEOUT', 'fadeOut');
define('UI_BACKUPTOKEN_KEY', 'backupToken');
define('UI_RESTORETOKEN_KEY', 'restoreToken');
if ($WHITE_SCREEN_OF_DEATH) {
echo __FILE__.':line '.__LINE__."<br>";
}
require_once(dirname(__FILE__).'/../../storageServer/var/conf.php');
define('UI_VERSION', CAMPCASTER_VERSION);
define('UI_VERSION_FULLNAME', 'Campcaster '.UI_VERSION);
@ -150,8 +157,17 @@ $CC_CONFIG = array_merge($CC_CONFIG,
)
);
if ($WHITE_SCREEN_OF_DEATH) {
echo __FILE__.':line '.__LINE__."<br>";
}
require_once(dirname(__FILE__).'/ui_base.inc.php');
if ($WHITE_SCREEN_OF_DEATH) {
echo __FILE__.':line '.__LINE__.": Loaded ui_base.inc.php<br>";
}
require_once(dirname(__FILE__).'/../../storageServer/var/GreenBox.php');
if ($WHITE_SCREEN_OF_DEATH) {
echo __FILE__.':line '.__LINE__.": Loaded GreenBox<br>";
}
require_once(dirname(__FILE__).'/formmask/generic.inc.php');
require_once('DB.php');

View File

@ -28,7 +28,7 @@
WWW_ROOT=`cd var/install; php -q getWwwRoot.php` || exit $?
echo " *** StorageServer bin/setupDirs.sh BEGIN"
echo " *** Root URL: $WWW_ROOT"
PHP_PWD=`bin/getUrl.sh $WWW_ROOT/install/getPwd.php` || \
PHP_PWD_COMMAND=`bin/getUrl.sh $WWW_ROOT/install/getPwd.php` || \
{
errno=$?
if [ $errno -eq 22 ]
@ -37,6 +37,13 @@ PHP_PWD=`bin/getUrl.sh $WWW_ROOT/install/getPwd.php` || \
fi
exit $errno
}
PHP_PWD=$PHP_PWD_COMMAND
# MOD_PHP may not be working, this command will tell us
if [ ${PHP_PWD_COMMAND:0:5} == '<?php' ]; then
echo "MOD_PHP is not working, the raw PHP file is being returned instead of result of the PHP code."
exit 1
fi
echo " *** Webspace mapping test:"
echo " *** mod_php : $PHP_PWD"
INSTALL_DIR="$PWD/var/install"

View File

@ -239,12 +239,6 @@ db_clean:
reset:
./bin/resetStorage.sh
archive:
$(MAKE) -C ../archiveServer all
archiveclean:
$(MAKE) -C ../archiveServer clean
transtest:
./var/tests/transTest.sh
# cd var/tests; php -q transTest.php

View File

@ -29,9 +29,7 @@ require_once("Transport.php");
* @license http://www.gnu.org/licenses/gpl.txt
* @see Alib
*/
//class BasicStor extends Alib {
class BasicStor {
//protected $rootId;
public $storId;

View File

@ -1,6 +1,12 @@
<?php
require_once("BasicStor.php");
if ($WHITE_SCREEN_OF_DEATH) {
echo __FILE__.':line '.__LINE__.": Loaded BasicStor<br>";
}
require_once("LocStor.php");
if ($WHITE_SCREEN_OF_DEATH) {
echo __FILE__.':line '.__LINE__.": Loaded LocStor<br>";
}
require_once('Prefs.php');
/**

View File

@ -1,5 +1,12 @@
<?php
require_once("BasicStor.php");
if ($WHITE_SCREEN_OF_DEATH) {
echo __FILE__.':line '.__LINE__.": Loaded BasicStor<br>";
}
require_once("Transport.php");
if ($WHITE_SCREEN_OF_DEATH) {
echo __FILE__.':line '.__LINE__.": Loaded Transport<br>";
}
/**
* LocStor class
@ -1376,5 +1383,377 @@ class LocStor extends BasicStor {
return CAMPCASTER_VERSION;
}
/**
* Open upload transport (from station to hub)
*
* @param string $sessid
* session id
* @param string $chsum
* checksum
* @return array
* hasharray with:
* url string: writable URL
* token string: PUT token
*/
function uploadOpen($sessid, $chsum)
{
$owner = Alib::GetSessUserId($sessid);
if (PEAR::isError($owner)) {
return $owner;
}
$res = $this->bsOpenPut($chsum, NULL, $owner);
if (PEAR::isError($res)) {
return $res;
}
return array('url'=>$res['url'], 'token'=>$res['token']);
}
/**
* Close upload transport
*
* @param string $token
* transport token
* @param string $trtype
* transport type
* @param array $pars
* transport parameters
* @return mixed
*/
function uploadClose($token, $trtype, $pars=array())
{
$res = $this->bsClosePut($token);
if (PEAR::isError($res)) {
return $res;
}
extract($res); // fname, owner
switch ($trtype) {
case "audioclip":
$mdtoken = $pars['mdpdtoken'];
$res = $this->bsClosePut($mdtoken);
if (PEAR::isError($res)) {
return $res;
}
$mdfname = $res['fname'];
if ($gunid == '') {
$gunid = NULL;
}
$values = array(
"filename" => $pars['name'],
"filepath" => $fname,
"metadata" => $mdfname,
"gunid" => $pars['gunid'],
"filetype" => "audioclip"
);
$storedFile = $this->bsPutFile($values);
if (PEAR::isError($storedFile)) {
return $storedFile;
}
$res = $storedFile->getId();
@unlink($fname);
@unlink($mdfname);
break;
case "playlist":
if ($gunid == '') {
$gunid = NULL;
}
$values = array(
"filename" => $pars['name'],
"metadata" => $fname,
"gunid" => $pars['gunid'],
"filetype" => "playlist"
);
$storedFile = $this->bsPutFile($values);
if (PEAR::isError($storedFile)) {
return $storedFile;
}
$res = $storedFile->getId();
@unlink($fname);
break;
case "playlistPkg":
$chsum = md5_file($fname);
// importPlaylistOpen:
$res = $this->bsOpenPut($chsum, NULL, $owner);
if (PEAR::isError($res)) {
return $res;
}
$dest = $res['fname'];
$token = $res['token'];
copy($fname, $dest);
$r = $this->importPlaylistClose($token);
if (PEAR::isError($r)) {
return $r;
}
@unlink($fname);
return $r;
break;
case "searchjob":
$crits = file_get_contents($fname);
$criteria = unserialize($crits);
@unlink($fname);
$results = $this->localSearch($criteria);
if (PEAR::isError($results)) {
return $results;
}
$realfile = tempnam($this->accessDir, 'searchjob_');
@chmod($realfile, 0660);
$len = file_put_contents($realfile, serialize($results));
$acc = BasicStor::bsAccess($realfile, '', NULL, 'download');
if (PEAR::isError($acc)) {
return $acc;
}
$url = BasicStor::GetUrlPart()."access/".basename($acc['fname']);
$chsum = md5_file($realfile);
$size = filesize($realfile);
$res = array(
'url'=>$url, 'token'=>$acc['token'],
'chsum'=>$chsum, 'size'=>$size,
'filename'=>$filename
);
return $res;
break;
case "metadata":
break;
default:
}
return $res;
}
/**
* Open download transport
*
* @param string $sessid
* session id
* @param string $trtype
* transport type
* @param array $pars
* transport parameters
* @return hasharray with:
* url string: writable URL
* token string: PUT token
*/
function downloadOpen($sessid, $trtype, $pars=array())
{
global $CC_CONFIG;
switch ($trtype) {
case "unknown":
case "audioclip":
case "metadata":
case "playlist":
case "playlistPkg":
if (!isset($pars['gunid'])) {
return PEAR::raiseError("Archive::downloadOpen: gunid not set");
}
break;
}
$gunid = $pars['gunid'];
// resolve trtype by object type:
if ( ($trtype == 'unknown') || ($trtype == 'playlistPkg') ) {
$trtype2 = BasicStor::GetType($gunid);
if (PEAR::isError($trtype2)) {
return $trtype2;
}
// required with content:
$trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ?
'playlistPkg' : $trtype2);
//return PEAR::raiseError("Archive::downloadOpen: TT=$trtype TT2=$trtype2 G=$gunid");
}
switch ($trtype) {
case "audioclip":
$res = $this->downloadRawAudioDataOpen($sessid, $gunid);
break;
case "metadata":
$res = $this->downloadMetadataOpen($sessid, $gunid);
break;
case "playlist":
$res = $this->accessPlaylist($sessid, $gunid);
break;
case "playlistPkg":
$res = $this->bsExportPlaylistOpen($gunid);
if (PEAR::isError($res)) {
return $res;
}
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
$plfpath = "$tmpn.lspl";
copy($res['fname'], $plfpath);
$res = $this->bsExportPlaylistClose($res['token']);
if (PEAR::isError($res)) {
return $res;
}
$fname = "transported_playlist.lspl";
$id = BasicStor::IdFromGunid($gunid);
$acc = BasicStor::bsAccess($plfpath, 'lspl', NULL, 'download');
if (PEAR::isError($acc)) {
return $acc;
}
$url = BasicStor::GetUrlPart()."access/".basename($acc['fname']);
$chsum = md5_file($plfpath);
$size = filesize($plfpath);
$res = array(
'url'=>$url, 'token'=>$acc['token'],
'chsum'=>$chsum, 'size'=>$size,
'filename'=>$fname
);
break;
case "searchjob":
$res = $pars;
break;
case "file":
$res = array();
break;
default:
return PEAR::raiseError("Archive::downloadOpen: NotImpl ($trtype)");
}
if (PEAR::isError($res)) {
return $res;
}
switch ($trtype) {
case "audioclip":
case "metadata":
case "playlist":
case "playlistPkg":
$title = $this->bsGetTitle(NULL, $gunid);
break;
case "searchjob":
$title = 'searchjob';
break;
case "file":
$title = 'regular file';
break;
default:
}
$res['title'] = $title;
$res['trtype'] = $trtype;
return $res;
}
/**
* Close download transport
*
* @param string $token
* transport token
* @param string $trtype
* transport type
* @return array
* hasharray with:
* url string: writable URL
* token string: PUT token
*/
function downloadClose($token, $trtype)
{
switch ($trtype) {
case "audioclip":
$res = $this->downloadRawAudioDataClose($token);
if (PEAR::isError($res)) {
return $res;
}
return $res;
case "metadata":
$res = $this->downloadMetadataClose($token);
return $res;
case "playlist":
$res = $this->releasePlaylist(NULL/*$sessid*/, $token);
return $res;
case "playlistPkg":
$res = BasicStor::bsRelease($token, 'download');
if (PEAR::isError($res)) {
return $res;
}
$realFname = $r['realFname'];
@unlink($realFname);
if (preg_match("|(plExport_[^\.]+)\.lspl$|", $realFname, $va)) {
list(,$tmpn) = $va;
$tmpn = $CC_CONFIG['transDir']."/$tmpn";
if (file_exists($tmpn)) {
@unlink($tmpn);
}
}
return $res;
case "searchjob":
$res = BasicStor::bsRelease($token, 'download');
return $res;
case "file":
return array();
default:
return PEAR::raiseError("Archive::downloadClose: NotImpl ($trtype)");
}
}
/**
* Prepare hub initiated transport
*
* @param string $target
* hostname of transport target
* @param string $trtype
* transport type
* @param string $direction
* 'up' | 'down'
* @param array $pars
* transport parameters
* @return mixed
*/
function prepareHubInitiatedTransfer(
$target, $trtype='file', $direction='up',$pars=array())
{
$tr = new Transport($this);
$trec = TransportRecord::create($tr, $trtype, $direction,
array_merge($pars, array('target'=>$target)));
if (PEAR::isError($trec)) {
return $trec;
}
return TRUE;
}
/**
* List hub initiated transports
*
* @param string $target
* hostname of transport target
* @param string $direction
* 'up' | 'down'
* @param string $trtok
* transport token
* @return mixed
*/
function listHubInitiatedTransfers(
$target=NULL, $direction=NULL, $trtok=NULL)
{
$tr = new Transport($this);
$res = $tr->getTransports($direction, $target, $trtok);
return $res;
}
/**
* Set state of hub initiated transport
*
* @param string $target
* hostname of transport target
* @param string $trtok
* transport token
* @param string $state
* transport state
* @return TransportRecord|PEAR_Error
*/
function setHubInitiatedTransfer($target, $trtok, $state)
{
$tr = new Transport($this);
$trec = TransportRecord::recall($tr, $trtok);
if (PEAR::isError($trec)) {
return $trec;
}
$r = $trec->setState($state);
if (PEAR::isError($r)) {
return $r;
}
return $trec;
}
/* ==================================================== auxiliary methods */
} // class LocStor
?>

View File

@ -836,11 +836,11 @@ class MetaData {
//$predns = strtolower($predns);
//$predicate = strtolower($predicate);
$subjns_sql = is_null($subjns) ? "NULL" : "'".pg_escape_string($subjns)."'";
$subject_sql = is_null($subject) ? "NULL" : "'".pg_escape_string($subject)."'";
$predns_sql = is_null($predns) ? "NULL" : "'".pg_escape_string($predns)."'";
$predicate_sql = is_null($predicate) ? "NULL" : "'".pg_escape_string($predicate)."'";
$objns_sql = is_null($objns) ? "NULL" : "'".pg_escape_string($objns)."'";
$object_sql = is_null($object) ? "NULL" : "'".pg_escape_string($object)."'";
$subject_sql = is_null($subject) ? "NULL" : "'".pg_escape_string($subject)."'";
$predns_sql = is_null($predns) ? "NULL" : "'".pg_escape_string($predns)."'";
$predicate_sql = is_null($predicate) ? "NULL" : "'".pg_escape_string($predicate)."'";
$objns_sql = is_null($objns) ? "NULL" : "'".pg_escape_string($objns)."'";
$object_sql = is_null($object) ? "NULL" : "'".pg_escape_string($object)."'";
$id = $CC_DBC->nextId($CC_CONFIG['mdataTable']."_id_seq");
if (PEAR::isError($id)) {
return $id;
@ -873,7 +873,7 @@ class MetaData {
{
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT id FROM ".$CC_CONFIG['mdataTable']."
WHERE subjns='_I' AND subject='{$p_id}' AND
WHERE subjns='_I' AND subject='{$p_id}' AND
gunid=x'{$this->gunid}'::bigint";
$rh = $CC_DBC->query($sql);
if (PEAR::isError($rh)) {
@ -887,7 +887,7 @@ class MetaData {
}
$rh->free();
$sql = "DELETE FROM ".$CC_CONFIG['mdataTable']."
WHERE id={$p_id} AND
WHERE id={$p_id} AND
gunid=x'{$this->gunid}'::bigint";
$res = $CC_DBC->query($sql);
if (PEAR::isError($res)) {

View File

@ -68,8 +68,8 @@ $CC_CONFIG = array(
'storageUrlPort' => 80,
/* ================================================ archive configuration */
'archiveUrlPath' => '/campcasterArchiveServer',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
'archiveUrlPath' => '/campcasterStorageServer',
'archiveXMLRPC' => 'xmlrpc/xrLocStor.php',
'archiveUrlHost' => 'localhost',
'archiveUrlPort' => 80,
'archiveAccountLogin' => 'root',

View File

@ -104,11 +104,11 @@ if ($access != 'write') {
foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) {
if (preg_match($old_regex, $line['command'])) {
echo " removing old entry\n";
echo " * Removing old entry: ".$line['command']."\n";
$cron->ct->delEntry($id);
}
}
echo " adding new entry\n";
echo " * Adding new entry: ".$command."\n";
$cron->ct->addCron($m, $h, $dom, $mon, $dow, $command);
$cron->closeCrontab();
echo " Done.\n";

View File

@ -98,42 +98,4 @@ if (camp_db_table_exists($CC_CONFIG['smembTable'])) {
echo " * Skipping: database table ".$CC_CONFIG['smembTable']."\n";
}
if (camp_db_table_exists($CC_CONFIG['classTable'])) {
echo " * Removing database table ".$CC_CONFIG['classTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['classTable'];
camp_install_query($sql);
} else {
echo " * Skipping: database table ".$CC_CONFIG['classTable']."\n";
}
if (camp_db_table_exists($CC_CONFIG['cmembTable'])) {
echo " * Removing database table ".$CC_CONFIG['cmembTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['cmembTable'];
camp_install_query($sql);
} else {
echo " * Skipping: database table ".$CC_CONFIG['cmembTable']."\n";
}
if (camp_db_table_exists($CC_CONFIG['structTable'])) {
echo " * Removing database table ".$CC_CONFIG['structTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['structTable'];
camp_install_query($sql, false);
$CC_DBC->dropSequence($CC_CONFIG['structTable']."_id_seq");
echo "done.\n";
} else {
echo " * Skipping: database table ".$CC_CONFIG['structTable']."\n";
}
if (camp_db_table_exists($CC_CONFIG['treeTable'])) {
echo " * Removing database table ".$CC_CONFIG['treeTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['treeTable'];
camp_install_query($sql, false);
$CC_DBC->dropSequence($CC_CONFIG['treeTable']."_id_seq");
echo "done.\n";
} else {
echo " * Skipping: database table ".$CC_CONFIG['treeTable']."\n";
}
?>

View File

@ -3592,6 +3592,204 @@ class XR_LocStor extends LocStor {
)));
}
/**
* Simple ping method - return strtouppered string
*
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_ping($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = date("Ymd-H:i:s")." Network hub answer: {$r['par']}";
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_uploadOpen($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->uploadOpen($r['sessid'], $r['chsum']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_uploadOpen: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* Check state of file upload
*
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_uploadCheck($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->uploadCheck($r['token']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_uploadCheck: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_uploadClose($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->uploadClose($r['token'], $r['trtype'], $r['pars']);
if (PEAR::isError($res)) {
$code = 803;
// Special case for duplicate file - give back
// different error code so we can display nice user message.
if ($res->getCode() == GBERR_GUNID) {
$code = 888;
}
return new XML_RPC_Response(0, $code,
"xr_uploadClose: ".$res->getMessage().
" ".$res->getUserInfo()
);
}
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_downloadOpen($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->downloadOpen($r['sessid'], $r['trtype'], $r['pars']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_downloadOpen: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_downloadClose($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->downloadClose($r['token'], $r['trtype']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_downloadClose: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_prepareHubInitiatedTransfer($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
foreach (array('trtype'=>NULL, 'direction'=>'up', 'pars'=>array()) as $k => $dv) {
if (!isset($r[$k])) {
$r[$k] = $dv;
}
}
$res = $this->prepareHubInitiatedTransfer(
$r['target'], $r['trtype'], $r['direction'], $r['pars']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_prepareHubInitiatedTransfer: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_listHubInitiatedTransfers($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
foreach (array('target'=>NULL, 'direction'=>NULL, 'trtok'=>NULL) as $k=>$dv) {
if (!isset($r[$k])) {
$r[$k] = $dv;
}
}
$res = $this->listHubInitiatedTransfers(
$r['target'], $r['direction'], $r['trtok']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_listHubInitiatedTransfers: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* @param XML_RPC_Message $input
* @return XML_RPC_Response
*/
function xr_setHubInitiatedTransfer($input)
{
list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) {
return $r;
}
$res = $this->setHubInitiatedTransfer(
$r['target'], $r['trtok'], $r['state']);
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_setHubInitiatedTransfer: ".$res->getMessage().
" ".$res->getUserInfo()
);
return new XML_RPC_Response(XML_RPC_encode($res));
}
/* ==================================================== "private" methods */
/**
* Check and convert struct of parameters

View File

@ -143,6 +143,16 @@ $methods = array(
'globalSearch' => 'Start search job on network hub',
'getSearchResults' => 'Get results from search job on network hub',
'uploadOpen' => 'Open file-layer upload',
'uploadCheck' => 'Check the checksum of uploaded file',
'uploadClose' => 'Close file-layer upload',
'downloadOpen' => 'Open file-layer download',
// 'downloadCheck' => 'Check the checksum of downloaded file',
'downloadClose' => 'Close file-layer download',
'prepareHubInitiatedTransfer' => 'Prepare hub initiated transfer',
'listHubInitiatedTransfers' => 'List hub initiated transfers',
'setHubInitiatedTransfer' => 'Set state of hub initiated transfers',
'ping' => 'Echo request',
);
$defs = array();

View File

@ -15,7 +15,7 @@ function printUsage()
$verbose = TRUE;
$parsedCommandLine = Console_Getopt::getopt($argv, "vs:o:h");
$options = null;
$cmdLineOptions = $parsedCommandLine[0];
if (count($parsedCommandLine[1]) == 0) {
@ -64,7 +64,7 @@ if ($verbose) {
echo "Host: {$url['host']}, path: {$url['path']}\n";
echo "Method: $method\n";
echo "Parameters:\n";
var_dump($pars);
var_dump($options);
}
$infos = array(
@ -283,7 +283,8 @@ switch ($method) {
} // switch
$fullmethod = $infos[$method]['m'];
$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr)));
$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($options)));
//$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr)));
if ($verbose) {
echo "parr:\n";