From a29d9d5c66c54f56e16b62b7fc78d2aefc85b5e7 Mon Sep 17 00:00:00 2001 From: konrad Date: Tue, 13 Jul 2010 06:46:44 +0000 Subject: [PATCH] bring debian stuff more up to date git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@563 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- debian/README.server | 88 ++++++++++++++++++++++++++++++++++------------- debian/rules | 10 ++++- www/config.php.template | 13 +++++++ 3 files changed, 85 insertions(+), 26 deletions(-) diff --git a/debian/README.server b/debian/README.server index c9f70b7..30b17d7 100644 --- a/debian/README.server +++ b/debian/README.server @@ -1,7 +1,7 @@ MagicSmoke Server Installation on Debian ========================================= -Unfortunately this does not work entirely automaticly. +Unfortunately this does not work entirely automatically. 1 - DocumentRoot and Web Server -------------------------------- @@ -12,19 +12,21 @@ DocumentRoot is somewhere else or you want a different name. MagicSmoke runs with any web server that can execute PHP 5 scripts. Please be aware that the client does enforce SSL encryption, so the web server must be -configured accordingly. +configured accordingly in order to work with the Qt based client. 2 - Database ------------- -Connect to your MySQL server using a client of your choice (I'll assume the -command line client below). +MagicSmoke can work with MySQL or Postgres. -Create a MySQL user - I'll assume it is called "smoke" and uses "verysecret" +Connect to your database server using a client of your choice (I'll assume the +command line mysql client below, commands should be similar for other clients). + +Create a database user - I'll assume it is called "smoke" and uses "verysecret" as password. mysql> CREATE USER smoke IDENTIFIED BY PASSWORD 'verysecret'; -Create a MySQL database - I'll assume it is called "smoke". +Create a database - I'll assume it is called "smoke". mysql> CREATE DATABASE smoke; Give the user all rights on this database. @@ -35,15 +37,19 @@ default), so you can use an existing database or even use the same database for multiple installations or different programs (assuming the other programs are as tolerant as MagicSmoke). -MagicSmoke2 can be installed in parallel to the old MagicSmoke packages, but it -cannot access the same tables. +MagicSmoke2 can be installed in parallel to the old MagicSmoke 1.0 packages, but it +cannot access the same tables (upgrade is possible though). 3 - Configuring MagicSmoke --------------------------- -Go to /usr/lib/magicsmoke-server and copy config.php.template to config.php. +Execute /usr/share/magicsmoke-server/install.sh with your target directory +as parameter. + +Now edit the config.php file, it is pretty self-explanatory. -Now edit it, the config template is pretty self-explanatory. +Make sure you have the right database configuration inside the config.php +file. You will find examples for MySQL and for Postgres inside. 4 - Creating the Database Content ---------------------------------- @@ -51,36 +57,70 @@ Now edit it, the config template is pretty self-explanatory. Open a browser and direct it to admin.php in your MagicSmoke installation (usually something like http://localhost/magicsmoke/admin.php). -The default user name is "Admin" and the password is "SmokeInMyEye". +The default user name is "Admin" and the password is "SmokeInMyEye" - or +whatever you have configured. Click the create database button. +4.1 Initial Installation +- - - - - - - - - - - - - + Create an initial administrator user. +Done. + +4.2 Upgrade from MagicSmoke 1.0 +- - - - - - - - - - - - - - - - - + +MagicSmoke2 is not able to import old MagicSmoke Backups, you need to +import those with an old installation and then convert them as described +below. + +If you have set up the $olddb variable in your configuration MagicSmoke will +offer to migrate data. Do not attempt migration if your new database already +has some data stored. + +Please make sure that the old and new database do not share tables - at the +very least the database name or the table prefix should be different. + +Simply enter "upgrade" into the input line and click the button. + +The upgrade may take some time - you should make sure that PHP scripts do +not abort too soon. On a normal workstation this will take about 2-4 minutes +for a database with a few thousand orders. If it fails you should recreate +the new database and start over. + +The format of customers in the database has changed significantly. +The upgrade process tries to guess what part of customer names and customer +address belong to which detail. This heuristic may fail in some cases, you +should go through your customer list and correct any mistakes afterwards. + +When you are done comment out the $olddb configuration to avoid initializing it +for every call of a script. + +The migration process does not touch the old tables + +4.3 Both +- - - - - + Comment out the "setAdminPassCode" line in config.php, so that noone else can abuse this interface. From now on you can access it with the MagicSmoke client. Your URL for the client ends in machine.php (eg. http://localhost/magicsmoke/machine.php). -Note: MagicSmoke2 is not able to import old MagicSmoke Backups, you need to -import those with an old installation and then convert them. (See below.) 5 - Templates -------------- -MagicSmoke comes with really simplistic (and ugly looking) templates for the -web pages visible to web users. +MagicSmoke comes with templates for the web pages visible to web users. +It uses the Twig template engine for this. You will find some documentation +for writing templates in the usr/share/doc/magicsmoke-server/Twig-doc . -They are installed in /usr/share/magicsmoke-server/template . +The templates are installed in /usr/share/magicsmoke-server/template . +The install.sh script will put a copy into your target directory. -Copy this directory, install magicsmoke-doc and read the chapter about web -templates. +Hint: install magicsmoke-doc and read the chapter about web templates. -When you are ready redirect the server to your now template directory by +When you are ready redirect the server to your new template directory by editing the $template variable in config.php . - -Appendix A - Converting an old Database ----------------------------------------- - -To be written. diff --git a/debian/rules b/debian/rules index 917c427..489555e 100755 --- a/debian/rules +++ b/debian/rules @@ -32,7 +32,7 @@ build-stamp: configure-stamp @echo '********************' @echo Building... dh_testdir - make -f Makefile.unix + #make -f Makefile.unix touch $@ clean: @@ -41,7 +41,7 @@ clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp - $(MAKE) -f Makefile.unix distclean + #$(MAKE) -f Makefile.unix distclean dh_clean install: install-base install-client install-doc install-server @@ -93,13 +93,19 @@ SERVER=$(CURDIR)/debian/magicsmoke2-server install-server: @echo '********************' @echo Install Server... + #create docu dir mkdir -p $(SERVER)/usr/share/doc/magicsmoke2-server + #copy and link scripts cp -rL www $(SERVER)/usr/share/magicsmoke2-server mkdir -p $(SERVER)/var/www ln -sf ../../usr/share/magicsmoke2-server $(SERVER)/var/www/magicsmoke2 + #clean up rm -rf `find $(SERVER) -name .svn` rm -f $(SERVER)/usr/share/magicsmoke2-server/config.php + #copy in docu cp -L README COPYING* $(SERVER)/usr/share/doc/magicsmoke2-server + mkdir -p $(SERVER)/usr/share/doc/magicsmoke2-server/Twig-doc + cp -L twig/doc/* $(SERVER)/usr/share/doc/magicsmoke2-server/Twig-doc gzip `ls $(SERVER)/usr/share/doc/magicsmoke2-server/* |grep -v .gz` gzip $(SERVER)/usr/share/doc/magicsmoke2-server/README.Debian-Install.gz diff --git a/www/config.php.template b/www/config.php.template index dbc26d7..b794aaa 100644 --- a/www/config.php.template +++ b/www/config.php.template @@ -10,6 +10,7 @@ //// //MySQL +/* // create engine: server, user, password $db = new MysqlEngine("localhost","smoke",""); // set database name @@ -20,7 +21,19 @@ $db->setPrefix("smoke2_"); $db->setStorageEngine("InnoDB"); //set default character set $db->setCharacterSet("utf8"); +*/ + +//// +//PGSQL +/* +// create engine: connection string +$db = new PGsqlEngine("dbname='smoke' user='smoke'"); +// set table-prefix (must be non-empty) +$db->setPrefix("smoke2_"); +//set this only if you want debug messages on error: +//$db->setDebugMode(); +*/ //////////// // DB Administration -- 1.7.2.5