Browse Source

99-final: changed sitebuilder from phpfiles.tar.gz to index.php

master
Nagy Karoly Gabriel 16 years ago
parent
commit
4cb8b45c34
4 changed files with 47 additions and 9 deletions
  1. +38
    -0
      99-final/index.php
  2. BIN
      99-final/phpfiles.tar.gz
  3. +8
    -8
      99-final/sitebuilder.sh
  4. +1
    -1
      pkg_99-final.conf

+ 38
- 0
99-final/index.php

@ -0,0 +1,38 @@
<?
ob_start();
$srv_host = "127.0.0.1" ;
$srv_port = "5432" ;
$srv_dbname = "webapp" ;
$srv_user = "postgres" ;
$srv_password = "" ;
$srv_connStr = " host = " . $srv_host . " port = " . $srv_port .
" dbname = " . $srv_dbname .
" user = " . $srv_user .
" password = " . $srv_password;
$srv_conn = pg_pconnect($srv_connStr) or die("Can not connect to PostgreSQL service server");
$first_code_loaded = '0.start';
$sql = "SELECT code FROM xweb_code WHERE nume = '" . $first_code_loaded . "'";
$rez = pg_query($sql) or die('postgres error: cannot execute: $sql');
$obj = pg_fetch_object($rez);
$code = $obj->code;
$file_name = $first_code_loaded.'.php';
$file_path = 'tmp/' . $file_name;
if (!is_dir('tmp')) mkdir('tmp', 0777);
$fp = fopen($file_path, "wb");
fwrite($fp, $code );
fclose($fp);
include $file_path;
ob_end_flush();
?>

BIN
99-final/phpfiles.tar.gz


+ 8
- 8
99-final/sitebuilder.sh

@ -20,19 +20,19 @@ DB_PORT="$4"
lighttpd_config="/etc/opt/lighttpd/lighttpd.conf" lighttpd_config="/etc/opt/lighttpd/lighttpd.conf"
DOC_ROOT=`grep 'simple-vhost.server-root' $lighttpd_config | awk {'print $3'} | sed 's,\",,g'` DOC_ROOT=`grep 'simple-vhost.server-root' $lighttpd_config | awk {'print $3'} | sed 's,\",,g'`
TEMPLATE="/usr/share/sitebuilder/phpfiles.tar.gz"
TEMPLATE="/usr/share/sitebuilder/index.php"
if [ "$SITE_ROOT" ]; then if [ "$SITE_ROOT" ]; then
if [ ! -d $DOC_ROOT/$SITE_ROOT ]; then if [ ! -d $DOC_ROOT/$SITE_ROOT ]; then
mkdir -p $DOC_ROOT/$SITE_ROOT/pages mkdir -p $DOC_ROOT/$SITE_ROOT/pages
cd $DOC_ROOT/$SITE_ROOT/pages cd $DOC_ROOT/$SITE_ROOT/pages
tar xzvf $TEMPLATE
db_to_replace=`grep '^\$dbname' $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$db_to_replace,$SITE_DB,g" -i $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php
ip_to_replace=`grep '^\$host' $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$ip_to_replace,$DB_IP,g" -i $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php
port_to_replace=`grep '^\$port' $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$port_to_replace,$DB_PORT,g" -i $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php
cp -av $TEMPLATE .
db_to_replace=`grep '^\$dbname' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$db_to_replace,$SITE_DB,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php
ip_to_replace=`grep '^\$host' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$ip_to_replace,$DB_IP,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php
port_to_replace=`grep '^\$port' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$port_to_replace,$DB_PORT,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php
else else
exit 1; exit 1;
fi fi

+ 1
- 1
pkg_99-final.conf

@ -21,7 +21,7 @@ mainfunction=install_stuff
install_stuff() { install_stuff() {
mkdir -p $root$datadir/sitebuilder mkdir -p $root$datadir/sitebuilder
cp -vf $base/target/tardiba/99-final/phpfiles.tar.gz $root$datadir/sitebuilder
cp -vf $base/target/tardiba/99-final/index.php $root$datadir/sitebuilder
cp -vf $base/target/tardiba/99-final/sitebuilder.sh $root$bindir cp -vf $base/target/tardiba/99-final/sitebuilder.sh $root$bindir
chmod +x $root$bindir/sitebuilder.sh chmod +x $root$bindir/sitebuilder.sh
cp -vf $base/target/tardiba/99-final/sshadminpg.cfg $root$sysconfdir cp -vf $base/target/tardiba/99-final/sshadminpg.cfg $root$sysconfdir

Loading…
Cancel
Save