Changes for less verbose and more robust setup process.

Some documentation added.
This commit is contained in:
tomas 2004-11-24 04:07:46 +00:00
parent 5998395646
commit 41af7984c1
24 changed files with 619 additions and 181 deletions

View File

@ -20,7 +20,7 @@
# #
# #
# Author : $Author: tomas $ # Author : $Author: tomas $
# Version : $Revision: 1.2 $ # Version : $Revision: 1.3 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/Attic/Makefile,v $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/Attic/Makefile,v $
# #
# @configure_input@ # @configure_input@
@ -62,17 +62,13 @@ USR_LIB_DIR = ${USR_DIR}/lib
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
GET_GNAME = install/getGname.php PHP_DIR = ${BASE_DIR}/var
WWW_ROOT := $(shell cd ../storageServer/var/install; php -q getWwwRoot.php) INSTALL_DIR = ${PHP_DIR}/install
HTTP_GROUP := $(shell curl -s ${WWW_ROOT}/${GET_GNAME}) STOR_DIR = ${PHP_DIR}/stor
ACCESS_DIR = ${PHP_DIR}/access
PHP_DIR = ${BASE_DIR}/var TRANS_DIR = ${PHP_DIR}/trans
INSTALL_DIR = ${PHP_DIR}/install BUFF_DIR = ${STOR_DIR}/buffer
STOR_DIR = ${PHP_DIR}/stor TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
ACCESS_DIR = ${PHP_DIR}/access
TRANS_DIR = ${PHP_DIR}/trans
BUFF_DIR = ${STOR_DIR}/buffer
TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Configuration parameters # Configuration parameters
@ -93,11 +89,13 @@ TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Targets # Targets
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
.PHONY: all dir_setup doc clean docclean depclean distclean dist db_init db_clean .PHONY: all dir_setup doc clean docclean depclean distclean dist \
db_init db_clean
all: dir_setup db_init all: dir_setup db_init
dir_setup: ${DOXYGEN_DIR} ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} dir_setup: ${DOXYGEN_DIR}
bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR}
doc: doc:
${DOXYGEN} ${DOXYGEN_CONFIG} ${DOXYGEN} ${DOXYGEN_CONFIG}
@ -120,7 +118,8 @@ distclean: clean docclean
#check: all ${TEST_RUNNER} #check: all ${TEST_RUNNER}
# ${TEST_RUNNER} # ${TEST_RUNNER}
check: all check: all
# $(MAKE) -C ../storageServer transtest
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Specific targets # Specific targets
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -136,25 +135,6 @@ ${TMP_DIR}:
${DOXYGEN_DIR}: ${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR} ${MKDIR} ${DOXYGEN_DIR}
${STOR_DIR}:
${MKDIR} ${STOR_DIR}
chown .${HTTP_GROUP} ${STOR_DIR}
chmod g+ws ${STOR_DIR}
${ACCESS_DIR}:
${MKDIR} ${ACCESS_DIR}
chown .${HTTP_GROUP} ${ACCESS_DIR}
chmod g+ws ${ACCESS_DIR}
${TRANS_DIR}:
${MKDIR} ${TRANS_DIR}
chown .${HTTP_GROUP} ${TRANS_DIR}
chmod g+ws ${TRANS_DIR}
${BUFF_DIR}:
${MKDIR} ${BUFF_DIR}
chmod g+w ${BUFF_DIR}
${TEST_RUNNER}: ${TEST_RUNNER}:
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@ -0,0 +1,44 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport 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.
#
# LiveSupport 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 LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/bin/getUrl.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# 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

@ -0,0 +1,59 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport 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.
#
# LiveSupport 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 LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/bin/setupDirs.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# 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

@ -5,7 +5,7 @@ Install steps for file uploading (do it with appropriate changes):
2) move put.cgi there from var subdir 2) move put.cgi there from var subdir
3) add to apache2 config (i.g. commonapache2.conf): 3) add to apache2 config (i.g. commonapache2.conf):
<Location /livesupport/modules/archiveServer/var/trans> <Location /livesupportArchiveServer/trans>
Script PUT /cgi-bin-put/put.cgi Script PUT /cgi-bin-put/put.cgi
</Location> </Location>
ScriptAlias /cgi-bin-put/ "/usr/local/apache2/cgi-bin-put/" ScriptAlias /cgi-bin-put/ "/usr/local/apache2/cgi-bin-put/"
@ -31,5 +31,9 @@ For running archiveServer on different HW then storageServer:
- check if include_path in php.ini points to PEAR too - check if include_path in php.ini points to PEAR too
(/usr/lib/php or /usr/local/lib/php) (/usr/lib/php or /usr/local/lib/php)
- setup var/conf.php - at least "basic configuration" part - setup var/conf.php - at least "basic configuration" part
- create symlink with name corresponding to "URL configuration" part
of var/conf.php file - example for default values:
http://localhost:80/livesupportArchiveServer/ should point to
<livesupport-cvs>/modules/archiveServer/var directory
- run 'make check' to: setup directories, create db tables and run test scripts - run 'make check' to: setup directories, create db tables and run test scripts
OR 'make all' without tests OR 'make all' without tests

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $ Author : $Author: tomas $
Version : $Revision: 1.3 $ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/conf.php,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/conf.php,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -65,12 +65,12 @@ $config = array(
/* ==================================================== URL configuration */ /* ==================================================== URL configuration */
// on central archive side: storage=archive ! // on central archive side: storage=archive !
'storageUrlPath' => '/livesupport/modules/archiveServer/var', 'storageUrlPath' => '/livesupportArchiveServer',
'storageXMLRPC' => 'xmlrpc/xrArchive.php', 'storageXMLRPC' => 'xmlrpc/xrArchive.php',
'storageUrlHost' => 'localhost', 'storageUrlHost' => 'localhost',
'storageUrlPort' => 80, 'storageUrlPort' => 80,
// only for returning right URLs: // only for returning right URLs:
'archiveUrlPath' => '/livesupport/modules/archiveServer/var', 'archiveUrlPath' => '/livesupportArchiveServer',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php', 'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
'archiveUrlHost' => 'localhost', 'archiveUrlHost' => 'localhost',
'archiveUrlPort' => 80, 'archiveUrlPort' => 80,

View File

@ -0,0 +1,39 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/getGname.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* 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

@ -0,0 +1,39 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/getWwwRoot.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require "../conf.php";
echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}".
"{$config['storageUrlPath']}";
?>

View File

@ -0,0 +1,39 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/getXrUrl.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage XMLRPC root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require "../conf.php";
echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}".
"{$config['storageUrlPath']}/{$config['storageXMLRPC']}";
?>

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $ Author : $Author: tomas $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/install.php,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/install.php,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -36,51 +36,53 @@ function errCallback($err)
if(assert_options(ASSERT_ACTIVE)==1) return; if(assert_options(ASSERT_ACTIVE)==1) return;
echo "ERROR:\n"; echo "ERROR:\n";
echo "request: "; print_r($_REQUEST); echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n"; echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
exit; "\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit(1);
} }
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n"); PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE); $dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){ if(PEAR::isError($dbc)){
echo "Database connection problem.\n"; echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n"; echo "Check if database '{$config['dsn']['database']}' exists".
echo "Database access is defined by 'dsn' values in conf.php.\n"; " with corresponding permissions.\n";
exit; echo "Database access is defined by 'dsn' values in var/conf.php.\n";
exit(1);
} }
$dbc->setFetchMode(DB_FETCHMODE_ASSOC); $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = &new GreenBox(&$dbc, $config); $gb = &new GreenBox(&$dbc, $config);
echo "Archive: Install ...\n"; echo "\n# archiveServer: Install ...\n";
$dbc->setErrorHandling(PEAR_ERROR_RETURN); $dbc->setErrorHandling(PEAR_ERROR_RETURN);
$gb->uninstall(); $gb->uninstall();
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n"); PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$gb->install(); $gb->install();
echo " Testing ...\n"; echo "# Testing ...\n";
$gb->test(); $gb->test();
$log = $gb->test_log; $log = $gb->test_log;
echo " TESTS:\n$log\n---\n"; echo " TESTS:\n{$log}";
#echo " Reinstall + testdata insert ...\n"; #echo "# Reinstall + testdata insert ...\n";
#$gb->reinstall(); #$gb->reinstall();
#$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']); #$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']);
#$gb->testData(); #$gb->testData();
#$gb->logout($gb->sessid); unset($gb->sessid); #$gb->logout($gb->sessid); unset($gb->sessid);
echo " TREE DUMP:\n"; #echo "# TREE DUMP:\n";
echo $gb->dumpTree(); #echo $gb->dumpTree();
echo " Delete test data ...\n"; echo "# Delete test data ...\n";
$gb->deleteData(); $gb->deleteData();
if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w'))) if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w')))
echo "\n<b>!!! make {$config['storageDir']} dir webdaemon-writeable !!!</b>\nand run install again\n\n"; echo "\n<b>make {$config['storageDir']} dir webdaemon-writeable</b>".
"\nand run install again\n\n";
else{ else{
fclose($fp); unlink($config['storageDir']."/_writeTest"); fclose($fp); unlink($config['storageDir']."/_writeTest");
echo "\nArchive is probably installed OK\n"; echo "#archiveServer install: OK\n\n";
} }
$dbc->disconnect(); $dbc->disconnect();

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $ Author : $Author: tomas $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/uninstall.php,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/uninstall.php,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -36,8 +36,9 @@ function errCallback($err)
if(assert_options(ASSERT_ACTIVE)==1) return; if(assert_options(ASSERT_ACTIVE)==1) return;
echo "ERROR:\n"; echo "ERROR:\n";
echo "request: "; print_r($_REQUEST); echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n"; echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
exit; "\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit(1);
} }
@ -45,16 +46,17 @@ PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE); $dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){ if(PEAR::isError($dbc)){
echo "Database connection problem.\n"; echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n"; echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in conf.php.\n"; echo "Database access is defined by 'dsn' values in conf.php.\n";
exit; exit(1);
} }
$dbc->setFetchMode(DB_FETCHMODE_ASSOC); $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = &new GreenBox(&$dbc, $config); $gb = &new GreenBox(&$dbc, $config);
# $dbc->setErrorHandling(PEAR_ERROR_RETURN); # $dbc->setErrorHandling(PEAR_ERROR_RETURN);
echo "Trying to uninstall Archive ...\n"; echo "# Trying to uninstall archiveServer ...\n";
$gb->uninstall(); $gb->uninstall();
$dbc->disconnect(); $dbc->disconnect();

View File

@ -23,7 +23,7 @@
# #
# #
# Author : $Author: tomas $ # Author : $Author: tomas $
# Version : $Revision: 1.1 $ # Version : $Revision: 1.2 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/xmlrpc/testRunner.sh,v $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/xmlrpc/testRunner.sh,v $
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -31,8 +31,8 @@ COMM=$1
shift shift
GUNID=$1 GUNID=$1
XMLRPC=http://localhost:80/livesupport/modules/archiveServer/var/xmlrpc/xrArchive.php XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
echo "XMLRPC server URL (check it in troubles):" echo " archiveServer XMLRPC URL:"
echo $XMLRPC echo $XMLRPC
TESTDIR=`dirname $0` TESTDIR=`dirname $0`

View File

@ -20,7 +20,7 @@
# #
# #
# Author : $Author: tomas $ # Author : $Author: tomas $
# Version : $Revision: 1.4 $ # Version : $Revision: 1.5 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/Attic/Makefile,v $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/Attic/Makefile,v $
# #
# @configure_input@ # @configure_input@
@ -62,17 +62,13 @@ USR_LIB_DIR = ${USR_DIR}/lib
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
GET_GNAME = install/getGname.php PHP_DIR = ${BASE_DIR}/var
WWW_ROOT := $(shell cd var/install; php -q getWwwRoot.php) INSTALL_DIR = ${PHP_DIR}/install
HTTP_GROUP := $(shell curl -s ${WWW_ROOT}/${GET_GNAME}) STOR_DIR = ${PHP_DIR}/stor
ACCESS_DIR = ${PHP_DIR}/access
PHP_DIR = ${BASE_DIR}/var TRANS_DIR = ${PHP_DIR}/trans
INSTALL_DIR = ${PHP_DIR}/install BUFF_DIR = ${STOR_DIR}/buffer
STOR_DIR = ${PHP_DIR}/stor TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
ACCESS_DIR = ${PHP_DIR}/access
TRANS_DIR = ${PHP_DIR}/trans
BUFF_DIR = ${STOR_DIR}/buffer
TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Configuration parameters # Configuration parameters
@ -97,9 +93,10 @@ TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
db_init db_clean transtest db_init db_clean transtest
all: dir_setup db_init all: dir_setup db_init
$(MAKE) -C ../archiveServer all # $(MAKE) -C ../archiveServer all
dir_setup: ${DOXYGEN_DIR} ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} dir_setup: ${DOXYGEN_DIR}
bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR}
doc: doc:
${DOXYGEN} ${DOXYGEN_CONFIG} ${DOXYGEN} ${DOXYGEN_CONFIG}
@ -113,7 +110,7 @@ docclean:
${RMDIR} ${DOXYGEN_DIR}/html ${RMDIR} ${DOXYGEN_DIR}/html
depclean: clean depclean: clean
$(MAKE) -C ../archiveServer clean # $(MAKE) -C ../archiveServer clean
dist: dist:
${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} * ${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} *
@ -122,19 +119,15 @@ distclean: clean docclean
check: all ${TEST_RUNNER} check: all ${TEST_RUNNER}
${TEST_RUNNER} ${TEST_RUNNER}
$(MAKE) transtest # $(MAKE) transtest
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Specific targets # Specific targets
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
transtest: transtest:
@echo "Transfer module test (needs ArchiveServer installed):"
cd var/tests; php -q transTest.php cd var/tests; php -q transTest.php
db_init: db_init:
@echo "Settings:"
@echo "Http daemon group: ${HTTP_GROUP}"
@echo "WWW root: ${WWW_ROOT}"
cd var/install; php -q install.php cd var/install; php -q install.php
db_clean: db_clean:
@ -146,29 +139,11 @@ ${TMP_DIR}:
${DOXYGEN_DIR}: ${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR} ${MKDIR} ${DOXYGEN_DIR}
${STOR_DIR}:
@echo "Http daemon group: ${HTTP_GROUP}"
@echo "You should be in this group for easy testing"
${MKDIR} ${STOR_DIR}
chown .${HTTP_GROUP} ${STOR_DIR}
chmod g+ws ${STOR_DIR}
${ACCESS_DIR}:
${MKDIR} ${ACCESS_DIR}
chown .${HTTP_GROUP} ${ACCESS_DIR}
chmod g+ws ${ACCESS_DIR}
${TRANS_DIR}:
${MKDIR} ${TRANS_DIR}
chown .${HTTP_GROUP} ${TRANS_DIR}
chmod g+ws ${TRANS_DIR}
${BUFF_DIR}:
${MKDIR} ${BUFF_DIR}
chmod g+w ${BUFF_DIR}
${TEST_RUNNER}: ${TEST_RUNNER}:
testonly: ${TEST_RUNNER}
${TEST_RUNNER}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Pattern rules # Pattern rules
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@ -0,0 +1,44 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport 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.
#
# LiveSupport 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 LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/bin/getUrl.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# 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

@ -0,0 +1,59 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport 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.
#
# LiveSupport 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 LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/bin/setupDirs.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script does httpd writeable directories setup
#-------------------------------------------------------------------------------
WWW_ROOT=`cd var/install; php -q getWwwRoot.php` || exit $?
echo "# storageServer 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

@ -6,6 +6,10 @@
- setup var/conf.php - at least "basic configuration" part - setup var/conf.php - at least "basic configuration" part
(follow comments in the source - or use doxygen and its output) (follow comments in the source - or use doxygen and its output)
- setup archiveServer/var/conf.php too - test scripts will use archive - setup archiveServer/var/conf.php too - test scripts will use archive
- create symlink with name corresponding to "URL configuration" part
of var/conf.php file - example for default values:
http://localhost:80/livesupportStorageServer/ should point to
<livesupport-cvs>/modules/storageServer/var directory
- configure apache for archiveServer file upload - configure apache for archiveServer file upload
(as described in archiveServer/doc/INSTALL) (as described in archiveServer/doc/INSTALL)
- run 'make check' to: setup directories, create db tables and run test scripts - run 'make check' to: setup directories, create db tables and run test scripts

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $ Author : $Author: tomas $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -48,7 +48,7 @@ require_once "Transport.php";
* LiveSupport file storage module * LiveSupport file storage module
* *
* @author $Author: tomas $ * @author $Author: tomas $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
* @see Alib * @see Alib
*/ */
class GreenBox extends Alib{ class GreenBox extends Alib{
@ -717,7 +717,7 @@ class GreenBox extends Alib{
$ac =& StoredFile::recallFromLink(&$this, $acf['tmplink'], $sessid); $ac =& StoredFile::recallFromLink(&$this, $acf['tmplink'], $sessid);
$ac->releaseRawMediaData($sessid); $ac->releaseRawMediaData($sessid);
} }
parent::logout($sessid); return parent::logout($sessid);
} }
/** /**
@ -1000,7 +1000,7 @@ class GreenBox extends Alib{
"; ";
$this->test_dump = $this->dumpTree($this->storId); $this->test_dump = $this->dumpTree($this->storId);
if($this->test_dump==$this->test_correct) if($this->test_dump==$this->test_correct)
{ $this->test_log.="Storage: OK\n"; return true; } { $this->test_log.="storageServer: OK\n"; return true; }
else PEAR::raiseError('GreenBox::test:', 1, PEAR_ERROR_DIE, '%s'. else PEAR::raiseError('GreenBox::test:', 1, PEAR_ERROR_DIE, '%s'.
"<pre>\ncorrect:\n.{$this->test_correct}.\n". "<pre>\ncorrect:\n.{$this->test_correct}.\n".
"dump:\n.{$this->test_dump}.\n</pre>\n"); "dump:\n.{$this->test_dump}.\n</pre>\n");

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $ Author : $Author: tomas $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/conf.php,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/conf.php,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -63,13 +63,13 @@ $config = array(
'accessDir' => dirname(getcwd()).'/access', 'accessDir' => dirname(getcwd()).'/access',
/* ==================================================== URL configuration */ /* ==================================================== URL configuration */
'storageUrlPath' => '/livesupport/modules/storageServer/var', 'storageUrlPath' => '/livesupportStorageServer',
'storageXMLRPC' => 'xmlrpc/xrLocStor.php', 'storageXMLRPC' => 'xmlrpc/xrLocStor.php',
'storageUrlHost' => 'localhost', 'storageUrlHost' => 'localhost',
'storageUrlPort' => 80, 'storageUrlPort' => 80,
/* ================================================ archive configuration */ /* ================================================ archive configuration */
'archiveUrlPath' => '/livesupport/modules/archiveServer/var', 'archiveUrlPath' => '/livesupportArchiveServer',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php', 'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
'archiveUrlHost' => 'localhost', 'archiveUrlHost' => 'localhost',
'archiveUrlPort' => 80, 'archiveUrlPort' => 80,

View File

@ -1,6 +1,38 @@
<? <?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/getGname.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This (web-callable) script returns group running httpd
*----------------------------------------------------------------------------*/
header("Content-type: text/plain"); header("Content-type: text/plain");
# $gid = posix_getgid();
$egid = posix_getegid(); $egid = posix_getegid();
$info = posix_getgrgid($egid); $info = posix_getgrgid($egid);
echo $info['name']; echo $info['name'];

View File

@ -1,4 +1,37 @@
<? <?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/getWwwRoot.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain"); header("Content-type: text/plain");
require "../conf.php"; require "../conf.php";
echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}". echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}".

View File

@ -1,4 +1,37 @@
<? <?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/getXrUrl.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage XMLRPC root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain"); header("Content-type: text/plain");
require "../conf.php"; require "../conf.php";
echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}". echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}".

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $ Author : $Author: tomas $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/install.php,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/install.php,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -36,57 +36,60 @@ function errCallback($err)
if(assert_options(ASSERT_ACTIVE)==1) return; if(assert_options(ASSERT_ACTIVE)==1) return;
echo "ERROR:\n"; echo "ERROR:\n";
echo "request: "; print_r($_REQUEST); echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n"; echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
exit; "\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit(1);
} }
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n"); PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE); $dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){ if(PEAR::isError($dbc)){
echo "Database connection problem.\n"; echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n"; echo "Check if database '{$config['dsn']['database']}' exists".
echo "Database access is defined by 'dsn' values in conf.php.\n"; " with corresponding permissions.\n";
exit; echo "Database access is defined by 'dsn' values in var/conf.php.\n";
exit(1);
} }
$dbc->setFetchMode(DB_FETCHMODE_ASSOC); $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = &new GreenBox(&$dbc, $config); $gb = &new GreenBox(&$dbc, $config);
echo "Storage: Install ...\n"; echo "\n# storageServer: Install ...\n";
$dbc->setErrorHandling(PEAR_ERROR_RETURN); $dbc->setErrorHandling(PEAR_ERROR_RETURN);
$gb->uninstall(); $gb->uninstall();
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n"); PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$gb->install(); $gb->install();
echo " Testing ...\n"; echo "# Testing ...\n";
$gb->test(); $gb->test();
$log = $gb->test_log; $log = $gb->test_log;
echo " TESTS:\n$log\n---\n"; echo " TESTS:\n{$log}";
#echo " Reinstall + testdata insert ...\n"; #echo "# Reinstall + testdata insert ...\n";
#$gb->reinstall(); #$gb->reinstall();
#$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']); #$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']);
#$gb->testData(); #$gb->testData();
#$gb->logout($gb->sessid); unset($gb->sessid); #$gb->logout($gb->sessid); unset($gb->sessid);
echo " TREE DUMP:\n"; #echo "# TREE DUMP:\n";
echo $gb->dumpTree(); #echo $gb->dumpTree();
echo " Delete test data ...\n"; echo "# Delete test data ...\n";
$gb->deleteData(); $gb->deleteData();
if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w'))) if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w')))
echo "\n<b>!!! make {$config['storageDir']} dir webdaemon-writeable !!!</b>\nand run install again\n\n"; echo "\n<b>make {$config['storageDir']} dir webdaemon-writeable</b>".
"\nand run install again\n\n";
else{ else{
fclose($fp); unlink($config['storageDir']."/_writeTest"); fclose($fp); unlink($config['storageDir']."/_writeTest");
echo "\nStorage is probably installed OK\n"; echo "#storageServer install: OK\n\n";
} }
echo "Install Transport submodule ...\n"; echo "# Install Transport submodule\n";
require_once "../Transport.php"; require_once "../Transport.php";
$tr =& new Transport(&$dbc, $config); $tr =& new Transport(&$dbc, $config);
$r = $tr->install(); $r = $tr->install();
echo "\n";
$dbc->disconnect(); $dbc->disconnect();
?> ?>

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $ Author : $Author: tomas $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/uninstall.php,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/uninstall.php,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -36,8 +36,9 @@ function errCallback($err)
if(assert_options(ASSERT_ACTIVE)==1) return; if(assert_options(ASSERT_ACTIVE)==1) return;
echo "ERROR:\n"; echo "ERROR:\n";
echo "request: "; print_r($_REQUEST); echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n"; echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
exit; "\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit(1);
} }
@ -45,19 +46,20 @@ PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE); $dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){ if(PEAR::isError($dbc)){
echo "Database connection problem.\n"; echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n"; echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in conf.php.\n"; echo "Database access is defined by 'dsn' values in conf.php.\n";
exit; exit(1);
} }
$dbc->setFetchMode(DB_FETCHMODE_ASSOC); $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = &new GreenBox(&$dbc, $config); $gb = &new GreenBox(&$dbc, $config);
# $dbc->setErrorHandling(PEAR_ERROR_RETURN); # $dbc->setErrorHandling(PEAR_ERROR_RETURN);
echo "Trying to uninstall storageServer ...\n"; echo "# Trying to uninstall storageServer ...\n";
$gb->uninstall(); $gb->uninstall();
echo "Uninstall Tranport submodule ...\n"; echo "# Uninstall Tranport submodule ...\n";
require_once "../Transport.php"; require_once "../Transport.php";
$tr =& new Transport(&$dbc, $config); $tr =& new Transport(&$dbc, $config);
$r = $tr->uninstall(); $r = $tr->uninstall();

View File

@ -1,6 +1,34 @@
<? <?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/tests/transTest.php,v $
------------------------------------------------------------------------------*/
header("Content-type: text/plain"); header("Content-type: text/plain");
echo "\nTransport test\n\n"; echo "\n# archiveServer transport test:\n";
require_once '../conf.php'; require_once '../conf.php';
require_once 'DB.php'; require_once 'DB.php';
@ -16,22 +44,38 @@ $gunid = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
$mediaFile = '../tests/ex1.mp3'; $mediaFile = '../tests/ex1.mp3';
$mdataFile = '../tests/mdata1.xml'; $mdataFile = '../tests/mdata1.xml';
echo"login: ".($sessid = $gb->login('root', 'q'))."\n"; echo"# Login: ".($sessid = $gb->login('root', 'q'))."\n";
echo"Store:\n"; echo"# Store: ";
$r = $gb->storeAudioClip($sessid, $gunid, $mediaFile, $mdataFile); var_dump($r); $r = $gb->storeAudioClip($sessid, $gunid, $mediaFile, $mdataFile);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo "$r\n";
echo"Upload:\n"; $r = $gb->uploadFile('', $gunid, $sessid); var_dump($r); echo"# Upload: "; $r = $gb->uploadFile('', $gunid, $sessid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo join(', ',$r)."\n";
echo"Cron:\n"; $r = $gb->cronJob(); var_dump($r); echo"# Cron: "; list($r1, $r2) = $gb->cronJob();
if(PEAR::isError($r1)){ echo "ERROR: ".$r1->getMessage()."\n"; exit(1); }
if(PEAR::isError($r2)){ echo "ERROR: ".$r2->getMessage()."\n"; exit(1); }
echo "$r1, $r2\n";
echo"Delete:\n"; $r = $gb->deleteAudioClip($sessid, $gunid); var_dump($r); echo"# Delete: "; $r = $gb->deleteAudioClip($sessid, $gunid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo "$r\n";
echo"Download:\n"; $r = $gb->downloadFile($gunid, $sessid); var_dump($r); echo"# Download: "; $r = $gb->downloadFile($gunid, $sessid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo join(', ',$r)."\n";
echo"Cron:\n"; $r = $gb->cronJob(); var_dump($r); echo"# Cron: "; $r = $gb->cronJob();
if(PEAR::isError($r1)){ echo "ERROR: ".$r1->getMessage()."\n"; exit(1); }
if(PEAR::isError($r2)){ echo "ERROR: ".$r2->getMessage()."\n"; exit(1); }
echo "$r1, $r2\n";
echo"logout: ".($r = $gb->logout($sessid))."\n"; echo"# logout: "; $r = $gb->logout($sessid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo "$r\n";
echo"\n"; echo "#Transport test: OK.\n\n"
?> ?>

View File

@ -23,7 +23,7 @@
# #
# #
# Author : $Author: tomas $ # Author : $Author: tomas $
# Version : $Revision: 1.4 $ # Version : $Revision: 1.5 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -31,74 +31,73 @@ COMM=$1
shift shift
GUNID=$1 GUNID=$1
#XMLRPC=http://localhost:80/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php echo ""
XMLRPC=`cd var/install; php -q getXrUrl.php` XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
echo "XMLRPC server URL (check it in troubles):" echo "# storageServer XMLRPC URL: $XMLRPC"
echo $XMLRPC
TESTDIR=`dirname $0` TESTDIR=`dirname $0`
XR_CLI="$TESTDIR/xr_cli_test.py -s $XMLRPC" XR_CLI="$TESTDIR/xr_cli_test.py -s ${XMLRPC}"
login() { login() {
echo "login:" echo -n "# login: "
SESSID=`$XR_CLI login root q` SESSID=`$XR_CLI login root q` || exit $?
echo "sessid: $SESSID" echo "sessid: $SESSID"
} }
test() { test() {
echo "test:" echo "# test: "
$XR_CLI test $SESSID stringForUppercase $XR_CLI test $SESSID stringForUppercase || exit $?
} }
existsAudioClip() { existsAudioClip() {
echo "existsAudioClip:" echo "# existsAudioClip: "
$XR_CLI existsAudioClip $SESSID $GUNID $XR_CLI existsAudioClip $SESSID $GUNID || exit $?
} }
accessRawAudioData() { accessRawAudioData() {
echo "accessRawAudioData:" echo "# accessRawAudioData: "
FPATH=`$XR_CLI accessRawAudioData $SESSID $GUNID` FPATH=`$XR_CLI accessRawAudioData $SESSID $GUNID` || exit $?
FPATH="<?echo urldecode(\"$FPATH\")?>" FPATH="<?echo urldecode(\"$FPATH\")?>"
FPATH=`echo "$FPATH" | php -q` FPATH=`echo "$FPATH" | php -q`
echo $FPATH echo $FPATH
ls -l $FPATH # ls -l $FPATH
echo "releaseRawAudioData:" echo -n "# releaseRawAudioData: "
$XR_CLI releaseRawAudioData $SESSID $FPATH $XR_CLI releaseRawAudioData $SESSID $FPATH || exit $?
#$XR_CLI getAudioClip $SESSID $GUNID #$XR_CLI getAudioClip $SESSID $GUNID
} }
storeAudioClip() { storeAudioClip() {
echo "storeAudioClip:" echo -n "# storeAudioClip: "
MEDIA=../tests/ex1.mp3 MEDIA=../tests/ex1.mp3
METADATA=../tests/testStorage.xml METADATA=../tests/testStorage.xml
RGUNID=`$XR_CLI storeAudioClip "$SESSID" '' "$MEDIA" "$METADATA"` RGUNID=`$XR_CLI storeAudioClip "$SESSID" '' "$MEDIA" "$METADATA"` || exit $?
echo $RGUNID echo $RGUNID
} }
deleteAudioClip() { deleteAudioClip() {
echo "deleteAudioClip:" echo -n "# deleteAudioClip: "
$XR_CLI deleteAudioClip $SESSID $GUNID $XR_CLI deleteAudioClip $SESSID $GUNID || exit $?
} }
updateAudioClipMetadata() { updateAudioClipMetadata() {
echo "updateAudioClipMetadata:" echo -n "#updateAudioClipMetadata: "
$XR_CLI updateAudioClipMetadata $SESSID $GUNID '../tests/mdata3.xml' $XR_CLI updateAudioClipMetadata $SESSID $GUNID '../tests/mdata3.xml' || exit $?
} }
getAudioClip() { getAudioClip() {
echo "getAudioClip:" echo -n "#getAudioClip: "
$XR_CLI getAudioClip $SESSID $GUNID | $TESTDIR/urldecode $XR_CLI getAudioClip $SESSID $GUNID | $TESTDIR/urldecode || exit $?
} }
searchMetadata() { searchMetadata() {
echo "searchMetadata:" echo -n "# searchMetadata: "
# $XR_CLI searchMetadata $SESSID '../tests/srch_cri1.xml' # $XR_CLI searchMetadata $SESSID '../tests/srch_cri1.xml' || exit $?
$XR_CLI searchMetadata $SESSID 'John %' $XR_CLI searchMetadata $SESSID 'John %' || exit $?
} }
logout() { logout() {
echo "logout:" echo -n "# logout: "
$XR_CLI logout $SESSID $XR_CLI logout $SESSID || exit $?
} }
usage(){ usage(){
@ -147,6 +146,8 @@ elif [ "x$COMM" == "x" ]; then
accessRawAudioData accessRawAudioData
deleteAudioClip deleteAudioClip
logout logout
echo "#XMLRPC tests: OK."
echo ""
elif [ "$COMM" == "help" ]; then elif [ "$COMM" == "help" ]; then
usage usage
else else