From 801c35716eca08946b4349765d618cf26564ef77 Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Wed, 10 Feb 2016 22:15:53 +0100 Subject: [PATCH] preparations for better backup; some development towards seat plans; integrate DB upgrade functionality --- backupclient/backup.pro | 24 + backupclient/main.cpp | 41 + backupclient/main.h | 27 + doc/XMLSchema.xsd | 2424 ++++++++++++++++++++++++++++++++++++++++++++++ doc/seatplans.txt | 60 +- doc/seatplans.xsd | 94 ++ doc/sp-kabinett.xml | 14 + doc/sp-saal-normal.xml | 14 + doc/sp-salon.xml | 14 + hidapi | 2 +- pack | 2 +- wob/db/customer.wolf | 10 +- wob/db/db.wolf | 9 +- wob/db/event.wolf | 8 +- wob/db/order.wolf | 12 +- wob/db/template.wolf | 2 +- wob/magicsmoke.wolf | 7 +- wob/transact/backup.wolf | 52 + wob/transact/basics.wolf | 11 +- www/admin.php | 26 + www/config.php.template | 7 +- www/inc/db/autoload.php | 2 - www/inc/db/db_scheme.php | 10 - 23 files changed, 2801 insertions(+), 71 deletions(-) create mode 100644 backupclient/backup.pro create mode 100644 backupclient/main.cpp create mode 100644 backupclient/main.h create mode 100644 doc/XMLSchema.xsd create mode 100644 doc/seatplans.xsd create mode 100644 doc/sp-kabinett.xml create mode 100644 doc/sp-saal-normal.xml create mode 100644 doc/sp-salon.xml create mode 100644 wob/transact/backup.wolf delete mode 100644 www/inc/db/db_scheme.php diff --git a/backupclient/backup.pro b/backupclient/backup.pro new file mode 100644 index 0000000..1082c57 --- /dev/null +++ b/backupclient/backup.pro @@ -0,0 +1,24 @@ +#Project File for MagicSmoke Backup Client +# (c) Konrad Rosenbaum, 2015 +TEMPLATE = app + +TARGET = msmokebackup + +#main source files +SOURCES = main.cpp +#HEADERS = main.h +INCLUDEPATH += . + + +# Basic settings +include (../basics.pri) + +# MagicSmoke Interface +include (../iface/iface.pri) + +#make sure the correct Qt DLLs are used +QT += xml network +QT += widgets + +#make sure dependencies are found +DEPENDPATH += $$INCLUDEPATH diff --git a/backupclient/main.cpp b/backupclient/main.cpp new file mode 100644 index 0000000..618b4f8 --- /dev/null +++ b/backupclient/main.cpp @@ -0,0 +1,41 @@ +// +// C++ Implementation: Backup Client +// +// +// Author: Konrad Rosenbaum , (C) 2015 +// +// Copyright: See README/COPYING.GPL files that come with this distribution +// +// +#include + +#include "main.h" + +#include "msinterface.h" +#include "MIncludeAll" + +BLogin::BLogin() +{ + login(); +} + +void BLogin::login() +{ + accept(); + + qDebug()<login("backup.agent","backup"); +} + + +int main(int ac,char**av) +{ + QApplication app(ac,av); + //locate settings + app.setOrganizationName("MagicSmoke"); + app.setApplicationName("MagicSmoke2"); + + BLogin*l=new BLogin; + l->show(); + + return app.exec(); +} diff --git a/backupclient/main.h b/backupclient/main.h new file mode 100644 index 0000000..9c9e27c --- /dev/null +++ b/backupclient/main.h @@ -0,0 +1,27 @@ +// +// C++ Interface: Backup Client +// +// +// Author: Konrad Rosenbaum , (C) 2015 +// +// Copyright: See README/COPYING.GPL files that come with this distribution +// +// + + +#ifndef MSBAK_MAIN_H +#define MSBAK_MAIN_H + +#include + +class BLogin:public QDialog +{ + Q_OBJECT +public: + BLogin(); + +public slots: + void login(); +}; + +#endif diff --git a/doc/XMLSchema.xsd b/doc/XMLSchema.xsd new file mode 100644 index 0000000..4f1ad4f --- /dev/null +++ b/doc/XMLSchema.xsd @@ -0,0 +1,2424 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]> + + + + Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp + Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp + + + + + + The schema corresponding to this document is normative, + with respect to the syntactic constraints it expresses in the + XML Schema language. The documentation (within <documentation> elements) + below, is not normative, but rather highlights important aspects of + the W3C Recommendation of which this is a part + + + + + The simpleType element and all of its members are defined + towards the end of this schema document + + + + + + Get access to the xml: attribute groups for xml:lang + as declared on 'schema' and 'documentation' below + + + + + + + + This type is extended by almost all schema types + to allow attributes from other namespaces to be + added to user schemas. + + + + + + + + + + + + + This type is extended by all types which allow annotation + other than <schema> itself + + + + + + + + + + + + + + + + This group is for the + elements which occur freely at the top level of schemas. + All of their types are based on the "annotated" type by extension. + + + + + + + + + + + + + This group is for the + elements which can self-redefine (see <redefine> below). + + + + + + + + + + + + + A utility type, not for public use + + + + + + + + + + + A utility type, not for public use + + + + + + + + + + + A utility type, not for public use + + #all or (possibly empty) subset of {extension, restriction} + + + + + + + + + + + + + + + + + A utility type, not for public use + + + + + + + + + + + + + A utility type, not for public use + + #all or (possibly empty) subset of {extension, restriction, list, union} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + for maxOccurs + + + + + + + + + + + + for all particles + + + + + + + for element, group and attributeGroup, + which both define and reference + + + + + + + + 'complexType' uses this + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This branch is short for + <complexContent> + <restriction base="xs:anyType"> + ... + </restriction> + </complexContent> + + + + + + + + + + + + + + + Will be restricted to required or forbidden + + + + + + Not allowed if simpleContent child is chosen. + May be overriden by setting on complexContent child. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This choice is added simply to + make this a valid restriction per the REC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Overrides any setting on complexType parent. + + + + + + + + + + + + + + + This choice is added simply to + make this a valid restriction per the REC + + + + + + + + + + + + + + + + + No typeDefParticle group reference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A utility type, not for public use + + #all or (possibly empty) subset of {substitution, extension, + restriction} + + + + + + + + + + + + + + + + + + + + + + + + + The element element can be used either + at the top level to define an element-type binding globally, + or within a content model to either reference a globally-defined + element or type or declare an element-type binding locally. + The ref form is not allowed at the top level. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + group type for explicit groups, named top-level groups and + group references + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + group type for the three kinds of group + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This choice with min/max is here to + avoid a pblm with the Elt:All/Choice/Seq + Particle derivation constraint + + + + + + + + + + restricted max/min + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Only elements allowed inside + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + simple type for the value of the 'namespace' attr of + 'any' and 'anyAttribute' + + + + Value is + ##any - - any non-conflicting WFXML/attribute at all + + ##other - - any non-conflicting WFXML/attribute from + namespace other than targetNS + + ##local - - any unqualified non-conflicting WFXML/attribute + + one or - - any non-conflicting WFXML/attribute from + more URI the listed namespaces + references + (space separated) + + ##targetNamespace or ##local may appear in the above list, to + refer to the targetNamespace of the enclosing + schema or an absent targetNamespace respectively + + + + + + A utility type, not for public use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A subset of XPath expressions for use +in selectors + A utility type, not for public +use + + + + The following pattern is intended to allow XPath + expressions per the following EBNF: + Selector ::= Path ( '|' Path )* + Path ::= ('.//')? Step ( '/' Step )* + Step ::= '.' | NameTest + NameTest ::= QName | '*' | NCName ':' '*' + child:: is also allowed + + + + + + + + + + + + + + + + + + + + + + + A subset of XPath expressions for use +in fields + A utility type, not for public +use + + + + The following pattern is intended to allow XPath + expressions per the same EBNF as for selector, + with the following change: + Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest ) + + + + + + + + + + + + + + + + + + + + + + + + + + + The three kinds of identity constraints, all with + type of or derived from 'keybase'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A utility type, not for public use + + A public identifier, per ISO 8879 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + notations for use within XML Schema schemas + + + + + + + + + Not the real urType, but as close an approximation as we can + get in the XML representation + + + + + + + + + + First the built-in primitive datatypes. These definitions are for + information only, the real built-in definitions are magic. + + + + For each built-in datatype in this schema (both primitive and + derived) can be uniquely addressed via a URI constructed + as follows: + 1) the base URI is the URI of the XML Schema namespace + 2) the fragment identifier is the name of the datatype + + For example, to address the int datatype, the URI is: + + http://www.w3.org/2001/XMLSchema#int + + Additionally, each facet definition element can be uniquely + addressed via a URI constructed as follows: + 1) the base URI is the URI of the XML Schema namespace + 2) the fragment identifier is the name of the facet + + For example, to address the maxInclusive facet, the URI is: + + http://www.w3.org/2001/XMLSchema#maxInclusive + + Additionally, each facet usage in a built-in datatype definition + can be uniquely addressed via a URI constructed as follows: + 1) the base URI is the URI of the XML Schema namespace + 2) the fragment identifier is the name of the datatype, followed + by a period (".") followed by the name of the facet + + For example, to address the usage of the maxInclusive facet in + the definition of int, the URI is: + + http://www.w3.org/2001/XMLSchema#int.maxInclusive + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NOTATION cannot be used directly in a schema; rather a type + must be derived from it by specifying at least one enumeration + facet whose value is the name of a NOTATION declared in the + schema. + + + + + + + + + + Now the derived primitive types + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pattern specifies the content of section 2.12 of XML 1.0e2 + and RFC 3066 (Revised version of RFC 1766). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pattern matches production 7 from the XML spec + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pattern matches production 5 from the XML spec + + + + + + + + + + + + + + + pattern matches production 4 from the Namespaces in XML spec + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A utility type, not for public use + + + + + + + + + + + + + + + + + + + + + + #all or (possibly empty) subset of {restriction, union, list} + + + A utility type, not for public use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Can be restricted to required or forbidden + + + + + + + + + + + + + + + + + + Required at the top level + + + + + + + + + + + + + + + + + + + Forbidden when nested + + + + + + + + + + + + + + + + + + + We should use a substitution group for facets, but + that's ruled out because it would allow users to + add their own, which we're not ready for yet. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + base attribute and simpleType child are mutually + exclusive, but one or other is required + + + + + + + + + + + + + + + + itemType attribute and simpleType child are mutually + exclusive, but one or other is required + + + + + + + + + + + + + + + + + + memberTypes attribute must be non-empty or there must be + at least one simpleType child + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/seatplans.txt b/doc/seatplans.txt index 0382e3d..c3193e2 100644 --- a/doc/seatplans.txt +++ b/doc/seatplans.txt @@ -1,10 +1,12 @@ Seat-Plans =========== +Specification Version (YYYYnn): 201501 + Server Side Minimum: --------------------- - + @@ -27,7 +29,7 @@ In both cases seats are unnumbered (i.e. audience members can chose freely). To number seats by row add Row-elements to the Group tag: - + @@ -48,7 +50,7 @@ match the sum of row capacities. defines a single row of seats inside this group id - a free form ID for the row, must only contain letters and digits, - may be empty, but no spaces + may be empty, but no spaces, the default is empty capacity - number of seats in this row first - a number if counting does not start at 1 @@ -85,27 +87,29 @@ Graphical Seat Plans This part is never evaluated by the server, only by displays: - + - - - + + + + - + - + - + New Attributes: SeatPlan/size - relative canvas size, the actual canvas will be scaled to fit the display - Group/geo - geometry relative to the canvas, coordinates are: x-left, y-top, x-right, y-bottom + geo - coordinates "x y w h" - top left corner X and Y (canvas top left is 0,0), width and height + Group/geo - geometry relative to the canvas Row/geo - geometry relative to the Group - bgcolor - (Group/Row) background or fill color - fgcolor - (Group/Row) foreground or text color + bgcolor - (Plan/Group/Row) background or fill color + fgcolor - (Plan/Group/Row) foreground or text color + tkcolor - (Plan/Group/Row) fill color for seats that are taken (on Plan/Group it sets the default) linecolor - (Group/Row) the color of the outline; defaults to bgcolor linewidth - (Group/Row) the width of the outline; defaults to 1 pixel Group/angle - rotate the group (value in degrees) @@ -137,17 +141,24 @@ Additional Graphics The background of the seat plan can be defined in an additional element: - + + + + - - + + - - + + - + + + + + base64-encoded data Attributes: @@ -156,8 +167,11 @@ Attributes: linecolor/linewidth - see above geo - full size of the shape angle - rotation in degree - Text/fontsize - font size in relative points of the seat plan, automatically scaled - Text/content - textual content + Background:text/fontsize - font size in relative points of the seat plan, automatically scaled + Background:text/content - textual content + Background:image/image - link to an Image tag + Image - contains the actual image data base64 encoded + Image/name - link name of the image, usually derived from the original file name Specifying Seats in Orders --------------------------- @@ -201,4 +215,4 @@ Pattern syntax: "*" - match any value "" - match the empty value only! "s1|s2" - match s1 or s2 - "1-3" - match any value between 1 and 3 (including), only allowed for seat numbers \ No newline at end of file + "1-3" - match any value between 1 and 3 (including), only allowed for seat numbers diff --git a/doc/seatplans.xsd b/doc/seatplans.xsd new file mode 100644 index 0000000..f1e1bda --- /dev/null +++ b/doc/seatplans.xsd @@ -0,0 +1,94 @@ + + + + + This File exists to be able to easily validate MagicSmoke SeatPlan files. + + + + + + + + + + + + + A version number for the file format. It always consists of 4-digit year plus a 2-digit counter. + + + + + + + Two unsigned integers noting Width and Height. + + + + + + Two unsigned integers noting top left X,Y and Width,Height. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/sp-kabinett.xml b/doc/sp-kabinett.xml new file mode 100644 index 0000000..fc2ab6f --- /dev/null +++ b/doc/sp-kabinett.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/doc/sp-saal-normal.xml b/doc/sp-saal-normal.xml new file mode 100644 index 0000000..2161a97 --- /dev/null +++ b/doc/sp-saal-normal.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/doc/sp-salon.xml b/doc/sp-salon.xml new file mode 100644 index 0000000..fc2ab6f --- /dev/null +++ b/doc/sp-salon.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/hidapi b/hidapi index 1a42177..d17db57 160000 --- a/hidapi +++ b/hidapi @@ -1 +1 @@ -Subproject commit 1a42177fa5f3beddb8805cb676d50acbc5e8ed01 +Subproject commit d17db57b9d4354752e0af42f5f33007a42ef2906 diff --git a/pack b/pack index 4199dd9..25d6ab9 160000 --- a/pack +++ b/pack @@ -1 +1 @@ -Subproject commit 4199dd9f5fc6f0e7c0707bcfff731402ec9e7a01 +Subproject commit 25d6ab9bec2a94792a63a097dc86911484d1db7c diff --git a/wob/db/customer.wolf b/wob/db/customer.wolf index f0f0450..e0ba909 100644 --- a/wob/db/customer.wolf +++ b/wob/db/customer.wolf @@ -7,7 +7,7 @@ - see COPYING.AGPL for details --> - +
countries for addressesabbreviated form of the country name (eg. "de", "us")long form of the country name (e.g. "Germany", "United States of America") @@ -16,7 +16,7 @@
- +
customer data, base tableID for the customer @@ -36,7 +36,7 @@ additional tags for this customer, can be used by scripts; these cannot be manipulated or even seen by customers
- +
customer data: addresses @@ -55,10 +55,10 @@
- +
-
\ No newline at end of file + diff --git a/wob/db/db.wolf b/wob/db/db.wolf index 930d993..99059a2 100644 --- a/wob/db/db.wolf +++ b/wob/db/db.wolf @@ -1,12 +1,15 @@ - + Time at which the change was made. @@ -19,4 +22,4 @@ - \ No newline at end of file + diff --git a/wob/db/event.wolf b/wob/db/event.wolf index 73f2eba..3a6226f 100644 --- a/wob/db/event.wolf +++ b/wob/db/event.wolf @@ -15,7 +15,7 @@ filter flags: defines who can use this room for new events (ignored once it is attached to an event) - +
stores seating arrangements the room this seating arrangement belongs to @@ -51,7 +51,7 @@ internal tags: can be used by macros and printer routines to change behavior or output
- +
@@ -74,7 +74,7 @@
- +
@@ -83,4 +83,4 @@ filter: who can sell tickets in this category for this event internal tags: can be used by macros and printer routines to change behavior or output
- \ No newline at end of file + diff --git a/wob/db/order.wolf b/wob/db/order.wolf index 2ebddba..cadc567 100644 --- a/wob/db/order.wolf +++ b/wob/db/order.wolf @@ -26,7 +26,7 @@ - +
This table contains all orders and sales. @@ -76,7 +76,7 @@ Returns the vochers sold by this order Returns additional sold items for this order
- +
a 8-32 char code (code39: case-insensitive letters+digits) for the ticket; automatically generated @@ -116,7 +116,7 @@
- +
a 8-32 char code (code39: case-insensitive letters+digits) for the voucher @@ -142,7 +142,7 @@
- +
A saleable product other than tickets or vouchers (eg. merchandizing).This table represents stock. When a product is sold an entry is created in the table item. @@ -160,7 +160,7 @@ additional tags for this product, can be used by scripts
- +
A sold item other than a ticket or voucher. @@ -171,4 +171,4 @@ additional tags for this item, can be used by scripts
- \ No newline at end of file + diff --git a/wob/db/template.wolf b/wob/db/template.wolf index 3fe4fcd..98bc666 100644 --- a/wob/db/template.wolf +++ b/wob/db/template.wolf @@ -7,7 +7,7 @@ - see COPYING.AGPL for details --> - +
diff --git a/wob/magicsmoke.wolf b/wob/magicsmoke.wolf index fa0ede6..fe6adb4 100644 --- a/wob/magicsmoke.wolf +++ b/wob/magicsmoke.wolf @@ -2,18 +2,18 @@ These files describe the database schema and communication protocol of MagicSmoke. - &copy; Konrad Rosenbaum, 2009-2013 + &copy; Konrad Rosenbaum, 2009-2015 <br/>these files are protected under the GNU AGPLv3 or at your option any newer - + @@ -43,6 +43,7 @@ + diff --git a/wob/transact/backup.wolf b/wob/transact/backup.wolf new file mode 100644 index 0000000..0225a48 --- /dev/null +++ b/wob/transact/backup.wolf @@ -0,0 +1,52 @@ + + + + + This transaction allows to make a complete database backup. The backup file is replayed into the database via the admin.php interface. + This is the old-style backup interface, it is obsolete as of 2016. + + + + Contains the structured backup data. + + + + + This transaction is used to get meta data from the database in preparation of a backup. + + + + Contains the structured backup data. + + + + + This transaction is used to get data from the database during a backup. + + The name of the table to be backed up. + First integer element to back up. + Last integer element to back up. + List of string keys to back up. + + + + Contains the structured backup data. + + + + + This transaction is used to restore backup data into the database. + + Contains the structured backup data. + If true: attempt to update existing data, otherwise forces insert. + + + + + diff --git a/wob/transact/basics.wolf b/wob/transact/basics.wolf index c732dce..f1a368b 100644 --- a/wob/transact/basics.wolf +++ b/wob/transact/basics.wolf @@ -2,20 +2,11 @@ - - This transaction allows to make a complete database backup. The backup file is replayed into the database via the admin.php interface. - - - - Contains the structured backup data. - - - This transaction returns basic language and formatting settings from the server - it must be used before the client displays any times or monetary values, even if it does not indend to translate any strings. If the transaction fails on the first attempt (eg. because the language could not be found), the client MUST repeat the request with "C" as language to retrieve formatting rules - "C" as language MUST succeed on the server, regardless of any other settings. diff --git a/www/admin.php b/www/admin.php index f4b3b0c..40dbc37 100644 --- a/www/admin.php +++ b/www/admin.php @@ -36,11 +36,16 @@ if(isset($_GET["CreateDB"])){ print("Creating Database...

"); $db->createDb(); } +if(isset($_GET["UpgradeDB"])){ + print("Upgrading Database...

"); + $db->upgradeDb(); +} ?> canUseDb(); if($canUseDb){ + //DB exists, is usable, no strange buttons ?> Database exists and is usable.

@@ -50,6 +55,22 @@ Database exists and is usable.

canUseDb(false)?"t":"f")." ht ".($db->hasTable("config")?"yo":"na")." v ".$db->getConfig(WobSchema::configVersionRow())."

\n"); + $cversion=$db->getConfig(WobSchema::configVersionRow()); + $xversion=$db->needVersion(); + if($db->canUseDb(false) && substr($cversion,0,3)=="01."){ + //DB exists, but is wrong (sub-)version +?> +Database is wrong version (is , expecting ). Attempt automatic upgrade?
+(Warning: make a backup of the database before attempting this!)
+ + + + + + Database is not usable. Create?
@@ -57,6 +78,7 @@ Database is not usable. Create?
@@ -65,6 +87,10 @@ if(isset($_GET["ShowCreateDB"])){ print("Creating Database...

"); $db->showCreateDb(); } +if(isset($_GET["ShowUpgradeDB"])){ + print("Upgrading Database...

"); + $db->upgradeDb(false); +} //the stuff below does not work if DB unusable if(!$canUseDb) diff --git a/www/config.php.template b/www/config.php.template index 438a792..133bfad 100644 --- a/www/config.php.template +++ b/www/config.php.template @@ -11,10 +11,12 @@ //MySQL + //create engine: server-host, user, password $db = new MysqlEngine("localhost","smoke",""); //set database name -$db->setDbName("smoke2"); +//$db->setDbName("smoke2"); +$db->setDbName("DB396352"); //set table-prefix (must be non-empty, leave the default if in doubt) $db->setPrefix("smoke2_"); //set this to one of the supported MySQL storage engines for DB creation @@ -28,7 +30,7 @@ $db->setCharacterSet("utf8"); //// //PostgreSQL -/* + //create engine: connection string, the sub-parameters are: // dbname - name of the database // user - DB user that is used to log in to the DB server @@ -38,6 +40,7 @@ $db->setCharacterSet("utf8"); // for more see: // http://www.php.net/manual/en/function.pg-connect.php // http://www.postgresql.org/docs/8.4/interactive/libpq-connect.html +/* $db = new PGsqlEngine("dbname='smoke' user='smoke'"); //set table-prefix (must be non-empty, leave the default if in doubt) $db->setPrefix("smoke2_"); diff --git a/www/inc/db/autoload.php b/www/inc/db/autoload.php index c76d9f2..b65020d 100644 --- a/www/inc/db/autoload.php +++ b/www/inc/db/autoload.php @@ -6,8 +6,6 @@ wob_autoclass("BarcodeTable",'./inc/db/barcodetable.php'); wob_autoclass("DBUpgrade",'./inc/db/dbupgrade.php'); -include('./inc/db/db_scheme.php'); - //eof return; ?> diff --git a/www/inc/db/db_scheme.php b/www/inc/db/db_scheme.php deleted file mode 100644 index e4ffd74..0000000 --- a/www/inc/db/db_scheme.php +++ /dev/null @@ -1,10 +0,0 @@ - -- 1.7.2.5