Mercurial > hg > fapweb
annotate managedb.php @ 533:f872843ae396
Add file path to compo data.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 12 Dec 2013 00:26:50 +0200 |
parents | ddbc84031a7b |
children | ab08640b4302 |
rev | line source |
---|---|
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 #!/usr/bin/php |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 <? |
175
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
3 require_once "mconfig.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
4 require_once "msite.inc.php"; |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 |
479
86ee2b42a995
Move CLI helper functions to msitegen, again.
Matti Hamalainen <ccr@tnsp.org>
parents:
426
diff
changeset
|
6 stCheckCLIExec(); |
50
184a4188555c
Move CLI helper functions to createdb.php, as they are now only used there.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
7 |
506
d29166d97b46
Change some database field sizes.
Matti Hamalainen <ccr@tnsp.org>
parents:
505
diff
changeset
|
8 $dbVersion = 11; |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
9 |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
10 $dbMeta = array( |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
11 "dbVersion" => array(VT_INT, $dbVersion, "Database version"), |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
12 ); |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
13 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 |
499 | 15 // |
515 | 16 // Site settings and defaults we put in |
499 | 17 // |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 $siteDefaults = array( |
268
feed47a72df4
Update some setting descriptions.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
19 "maxAttendeesHard" => array(VT_INT, 60, "Maximum attendees (HARD limit, <= 0 means no limit)"), |
feed47a72df4
Update some setting descriptions.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
20 "maxAttendeesSoft" => array(VT_INT, 50, "Maximum attendees (soft limit, <= 0 means no limit)"), |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
21 |
158
96aae4beb558
Clean up some references to entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
22 "userTimeout" => array(VT_INT, 120, "User pages (voting) timeout in minutes"), |
32 | 23 "admTimeout" => array(VT_INT, 15, "Administration interface timeout in minutes"), |
27
b27204653615
Work on adding support for entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
24 |
62
101cde58b267
Add a new setting for ASCII vs. HTML table output for compo results.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
25 "showAdmin" => array(VT_BOOL, false, "Always show administration interface link on the menu"), |
119
99e7569c9f4f
Change the default of some boolean settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
113
diff
changeset
|
26 "showAttendees" => array(VT_BOOL, true, "Show attendees list"), |
11
c10bf196390f
Improve database initialization script.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
27 "allowRegister" => array(VT_BOOL, false, "Enable event registration"), |
27
b27204653615
Work on adding support for entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
28 "allowVoting" => array(VT_BOOL, false, "Enable voting (individual compos must be enabled as well)"), |
b27204653615
Work on adding support for entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
29 |
11
c10bf196390f
Improve database initialization script.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
30 "showResults" => array(VT_BOOL, false, "Enable results page"), |
119
99e7569c9f4f
Change the default of some boolean settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
113
diff
changeset
|
31 "showResAuthors" => array(VT_BOOL, true, "Show entry authors on results page"), |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 |
16 | 33 "requireEMail" => array(VT_BOOL, false, "Require e-mail address in registrations"), |
34 | |
123
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
35 "showNews" => array(VT_BOOL, true, "Enable News link on main menu"), |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
36 "showNewsOnAbout" => array(VT_BOOL, true, "Show latest news item on About page"), |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
37 |
16 | 38 "registerInfoText" => array(VT_TEXT, "<p> |
39 Only your <b>handle</b> and the answer to the botcheck are strictly required. | |
40 If you plan on joining the IRC channel | |
63 | 41 (<a href=\"irc://#fap2013@ircnet\">#fap2013 @ IRCNet</a>) or staying up to date by other means, |
16 | 42 <b>e-mail</b> is not required either. |
43 </p>", "Registration page info text"), | |
44 | |
182
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
45 "registerPostText" => array(VT_TEXT, " |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
46 <h1>Registration successful</h1> |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
47 <p>Now go make a demo about it!</p>", |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
48 "Successful post-registration note text"), |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
49 |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
50 "registerLimitExceeded" => array(VT_TEXT, " |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
51 <h1>Sorry, registration disabled!</h1> |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
52 <p> |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
53 Registration to the event is not available at this time due to |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
54 number of attendees limit having been reached. <b>:(</b> |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
55 </p> |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
56 ", |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
57 "Registration attendee limit exceeded note text"), |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
58 |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
59 "registerNotEnabled" => array(VT_TEXT, " |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
60 <h1>Sorry, registration disabled!</h1> |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
61 <p> |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
62 Registration to the event is not enabled at this time. |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
63 </p> |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
64 ", |
e227e6a3d46b
Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
65 "Registration not enabled note text"), |
16 | 66 |
67 "registerPostNoEmail" => array(VT_TEXT, " | |
68 <h2>By the way ...</h2> | |
69 <p>As you did not specify an e-mail contact address, you'll have to get updates | |
70 and information about the location (if you don't already know it) by | |
71 some other means (IRC, for example.)</p> | |
72 ", "No e-mail address registration note"), | |
73 | |
74 "eventDescription" => array(VT_TEXT, " | |
75 <h1>Event program & schedule</h1> | |
76 <ul> | |
77 <li><b>Aegis</b> of DSS and FAG will be performing a DJ gig.</li> | |
78 <li>.. and possible additional live acts. More info to come.</li> | |
79 </ul> | |
80 | |
81 <h2>Friday 30.11.</h2> | |
82 <ul> | |
83 <li><b>18:00</b> - <i>Doors open</i>.</li> | |
84 <li><b>22:00</b> - DJ set by Aegis.</li> | |
85 </ul> | |
86 | |
87 <h2>Saturday 1.12.</h2> | |
88 <ul> | |
89 <li><b>14:00</b> - Deadline for remote entries.</li> | |
90 <li><b>18:00</b> - Deadline for the entries delivered on location.</li> | |
91 <li><b>20:00</b> - Competitions start.</li> | |
92 </ul> | |
93 | |
94 Competition schedule and voting deadline will depend on number of entries. | |
95 | |
96 <h2>Sunday 2.12.</h2> | |
97 <ul> | |
98 <li><b>12:00</b> - Party over?</li> | |
99 </ul> | |
100 ", "Event general description / timetables etc."), | |
101 | |
102 | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
103 "compoDescription" => array(VT_TEXT, " |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
104 <h1>General</h1> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
105 <p class=\"notice\"> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
106 YOU <b>MUST</b> HAVE AT LEAST ONE ENTRY TO COMPETITIONS IF YOU COME TO THE PARTY. |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
107 </p> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
108 |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
109 <p class=\"note\"> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
110 If there are enough entries, then AGA/OCS/ECS demos will be run in separate compos. |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
111 <br /> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
112 Remote entries are welcome! |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
113 </p> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
114 |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
115 <p> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
116 The compo machine will be an <b>A1200 with an 060/50 and lots of |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
117 RAM</b>. An <b>A500 1.3 512k/512k</b> will also be available if your |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
118 prod is not AGA compatible. |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
119 </p> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
120 |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
121 <h1>Compos</h1> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
122 ", "Compo general description"), |
16 | 123 |
124 | |
125 "siteInfoText" => array(VT_TEXT, " | |
150
4b91002a9900
Fix default header image link.
Matti Hamalainen <ccr@tnsp.org>
parents:
148
diff
changeset
|
126 <a href=\"about\"> |
47 | 127 <img src=\"img/fapsm.png\" alt=\"Finnish Amiga Party 2013\" class=\"logo\" /></a> |
16 | 128 <div id=\"date\"> |
47 | 129 5.-8.12.2013<br /> |
16 | 130 Helsinki, Finland<br /> |
131 @ old location<br /> | |
47 | 132 <span class=\"notice\">Entry 15 EUR + prod</span> |
16 | 133 </div>", "Site header text"), |
134 | |
135 | |
123
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
136 "newsHeader" => array(VT_TEXT, "", "News page header text"), |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
137 |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
138 |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
139 "aboutDescription" => array(VT_TEXT, " |
9
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
140 <div style=\"text-align: center;\"> |
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
141 <img src=\"img/fap.png\" alt=\"FAP\" /> |
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
142 <p> |
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
143 Pure Amiga demoscene party, all traditional Amiga compos and purely Amiga-oriented program. |
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
144 <br /> |
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
145 <span class=\"notice\"> |
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
146 YOU <b>MUST</b> HAVE AT LEAST ONE ENTRY TO COMPETITIONS IF YOU COME TO THE PARTY. |
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
147 </span> |
fa9b66f596bb
More work on settings storage.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
148 </p> |
11
c10bf196390f
Improve database initialization script.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
149 </div>", |
123
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
150 "About page text"), |
29 | 151 |
224
0daedbef5678
Add informational text setting for "voted" situations.
Matti Hamalainen <ccr@tnsp.org>
parents:
220
diff
changeset
|
152 "voteFinishedText" => array(VT_TEXT, " |
0daedbef5678
Add informational text setting for "voted" situations.
Matti Hamalainen <ccr@tnsp.org>
parents:
220
diff
changeset
|
153 <h1>Yay, you have voted!</h1> |
0daedbef5678
Add informational text setting for "voted" situations.
Matti Hamalainen <ccr@tnsp.org>
parents:
220
diff
changeset
|
154 <p>Now go FAP some more! And make a demo about it.</p>", |
0daedbef5678
Add informational text setting for "voted" situations.
Matti Hamalainen <ccr@tnsp.org>
parents:
220
diff
changeset
|
155 "Message shown after successful voting."), |
0daedbef5678
Add informational text setting for "voted" situations.
Matti Hamalainen <ccr@tnsp.org>
parents:
220
diff
changeset
|
156 |
104 | 157 "siteMenuHeader" => array(VT_TEXT, "<div>13.FAP:> <span class=\"mblink\">■</span></div>", "Site menu header text"), |
47 | 158 "siteMenuFooter" => array(VT_TEXT, "", "Site menu footer text"), |
106
324f3a415237
Add extra HTML + sponsors box to layout.
Matti Hamalainen <ccr@tnsp.org>
parents:
104
diff
changeset
|
159 "siteExtraHTML" => array(VT_TEXT, "<div id=\"sponsors\">Gentle Eye</div>", "Extra global HTML code (f.e. sponsors box)"), |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
160 ); |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
161 |
515 | 162 |
163 // | |
164 // | |
165 // | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
166 $sqlTables = array( |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
167 // Database metadata |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
168 "dbmeta" => array( |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
169 array("key" , "VARCHAR(32)", "PRIMARY KEY"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
170 array("vtype" , "INT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
171 array("vstr" , "VARCHAR(128)"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
172 array("vtext" , "TEXT"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
173 array("vint" , "INT"), |
519 | 174 array("sdesc" , "VARCHAR(128)"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
175 ), |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
176 |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
177 // Site settings |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
178 "settings" => array( |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
179 array("key" , "VARCHAR(32)", "PRIMARY KEY"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
180 array("vtype" , "INT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
181 array("vstr" , "VARCHAR(128)"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
182 array("vtext" , "TEXT"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
183 array("vint" , "INT"), |
519 | 184 array("sdesc" , "VARCHAR(128)"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
185 ), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
186 |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
187 "news" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
188 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
189 array("utime" , "INT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
190 array("title" , "VARCHAR(".SET_LEN_NEWS_TITLE.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
191 array("text" , "VARCHAR(".SET_LEN_NEWS_TEXT.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
192 array("author" , "VARCHAR(".SET_LEN_NEWS_AUTHOR.")"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
193 array("persist" , "INT", "DEFAULT 0"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
194 ), |
73 | 195 |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
196 "compos" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
197 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
198 array("name" , "VARCHAR(".SET_LEN_COMPO_NAME.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
199 array("description" , "VARCHAR(".SET_LEN_COMPO_DESC.")"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
200 array("visible" , "INT", "DEFAULT 0"), |
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
201 array("voting" , "INT", "DEFAULT 0"), |
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
202 array("showAuthors" , "INT", "DEFAULT 0"), |
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
203 array("type" , "INT", "DEFAULT 0"), |
533
f872843ae396
Add file path to compo data.
Matti Hamalainen <ccr@tnsp.org>
parents:
529
diff
changeset
|
204 array("path" , "VARCHAR(".SET_LEN_COMPO_PATH.")"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
205 ), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
206 |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
207 "entries" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
208 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
209 array("show_id" , "INT", "DEFAULT 0"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
210 array("name" , "VARCHAR(".SET_LEN_ENTRY_NAME.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
211 array("author" , "VARCHAR(".SET_LEN_ENTRY_AUTHOR.")"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
212 array("compo_id" , "INT", "DEFAULT 0"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
213 array("filename" , "VARCHAR(".SET_LEN_ENTRY_FILENAME.")", "DEFAULT NULL"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
214 array("info" , "VARCHAR(".SET_LEN_ENTRY_INFO.")", "DEFAULT NULL"), |
527
d6726a4883a6
Add "notes" field for entries, to contain notes private to organizers.
Matti Hamalainen <ccr@tnsp.org>
parents:
525
diff
changeset
|
215 array("notes" , "VARCHAR(".SET_LEN_ENTRY_NOTES.")", "DEFAULT NULL"), |
528
dd5c5577c495
Add preview file and file type fields for entry, for screenshots etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
527
diff
changeset
|
216 array("preview_file" , "VARCHAR(".SET_LEN_ENTRY_PREVIEW_FILE.")", "DEFAULT NULL"), |
dd5c5577c495
Add preview file and file type fields for entry, for screenshots etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
527
diff
changeset
|
217 array("preview_type" , "INT", "DEFAULT 0"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
218 array("flags" , "INT", "DEFAULT 0"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
219 ), |
73 | 220 |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
221 "attendees" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
222 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
223 array("regtime" , "INT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
224 array("name" , "VARCHAR(".SET_LEN_USERNAME.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
225 array("groups" , "VARCHAR(".SET_LEN_GROUPS.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
226 array("oneliner" , "VARCHAR(".SET_LEN_ONELINER.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
227 array("email" , "VARCHAR(".SET_LEN_EMAIL.")"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
228 array("key_id" , "INT", "DEFAULT NULL"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
229 ), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
230 |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
231 "votekeys" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
232 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
233 array("key" , "VARCHAR(".SET_LEN_VOTEKEY.")"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
234 array("active" , "INT", "DEFAULT 0"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
235 ), |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
236 |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
237 "votes" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
238 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
239 array("entry_id" , "INT", "DEFAULT NULL"), |
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
240 array("key_id" , "INT", "DEFAULT 0"), |
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
241 array("value" , "INT", "DEFAULT 0"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
242 ), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
243 |
515 | 244 |
245 // Party information system tables | |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
246 "displayVars" => array( |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
247 array("key" , "VARCHAR(32)", "PRIMARY KEY"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
248 array("vtype" , "INT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
249 array("vstr" , "VARCHAR(128)"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
250 array("vtext" , "TEXT"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
251 array("vint" , "INT"), |
519 | 252 array("sdesc" , "VARCHAR(128)"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
253 ), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
254 |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
255 "displaySlides" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
256 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
257 array("title" , "VARCHAR(".SET_LEN_DISP_SLIDE_TITLE.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
258 array("text" , "VARCHAR(".SET_LEN_DISP_SLIDE_TEXT.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
259 ), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
260 |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
261 "rotationListData" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
262 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
263 array("name" , "VARCHAR(".SET_LEN_ROT_LIST_NAME.")"), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
264 ), |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
265 |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
266 "rotationListSlides" => array( |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
267 array("id" , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"), |
505
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
268 array("list_id" , "INT", "DEFAULT 0"), |
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
269 array("slide_id" , "INT", "DEFAULT 0"), |
f66aa0cdb666
Rename some SQL table schema types (s/INTEGER/INT/)
Matti Hamalainen <ccr@tnsp.org>
parents:
504
diff
changeset
|
270 array("order_num" , "INT", "DEFAULT 0"), |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
271 ), |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
272 ); |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
273 |
515 | 274 |
275 // | |
276 // Party information system settings / data | |
277 // | |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
278 $siteDisplayVars = array( |
148
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
279 "showMode" => array(VT_INT, 0, "Currently active display mode"), |
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
280 "rotateDuration" => array(VT_INT, 15, "Slide rotation time per slide (seconds)"), |
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
281 |
393 | 282 "tempDuration" => array(VT_INT, 5, "Temporary slide display time (minutes)"), |
140
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
283 "tempSlide" => array(VT_INT, 0, "Temporary slide ID"), |
148
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
284 |
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
285 "compoID" => array(VT_INT, 0, "Compo ID of current compo"), |
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
286 "compoPrevEntry" => array(VT_INT, 0, "Previously shown compo entry"), |
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
287 "compoCurrEntry" => array(VT_INT, 0, "Current / next compo entry to be shown"), |
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
288 |
6d4325451570
And some more work on the info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
289 // Not user-manageable |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
290 "tempSlideSet" => array(VT_BOOL, false, "Temporary slide set"), |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
291 |
140
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
292 "activeSlideMode" => array(VT_INT, 0, "Current active slide display mode"), |
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
293 "activeSlide" => array(VT_INT, 0, "Current active slide"), |
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
294 "activeSlideExpire" => array(VT_INT, 0, "Expiration timestamp of current slide"), |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
295 |
142
d2e9285b69ad
More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
296 "rotateList" => array(VT_INT, 0, "Current rotation list ID"), |
d2e9285b69ad
More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
297 "rotateListIndex" => array(VT_INT, 0, "Current index in rotation list"), |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
298 |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
299 "lastUpdate" => array(VT_INT, 0, "Timestamp of last slide update"), |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
300 ); |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
301 |
515 | 302 |
303 // | |
304 // Some premade test data | |
305 // | |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
306 $siteTestData = array( |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
307 "news" => array( |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
308 "utime,title,text,author", |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
309 time().",%s,%s,%s", |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
310 array("Today's news", "We. Are. Back.", "orgaz"), |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
311 array("Good news, everybody!", "...", "The Professor"), |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
312 ), |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
313 |
88
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
314 "votekeys" => array( |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
315 "key", |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
316 "%s", |
120
2c594958050e
Make test vote keys "testN" where N >= 1
Matti Hamalainen <ccr@tnsp.org>
parents:
119
diff
changeset
|
317 array("test1"), |
2c594958050e
Make test vote keys "testN" where N >= 1
Matti Hamalainen <ccr@tnsp.org>
parents:
119
diff
changeset
|
318 array("test2"), |
88
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
319 array("7jjnqt5z"), |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
320 array("c7jcfk1G"), |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
321 ), |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
322 |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
323 "attendees" => array( |
88
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
324 "regtime,name,groups,oneliner,email", |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
325 "%d,%s,%s,%s,%s", |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
326 array(time()-0, "man with no alias", "supergroup", "foo-bar", "c@supergroup.com"), |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
327 array(time()-15, "man with alias", "supergroup", "hi!", "c@supergroup.com"), |
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
328 array(time()-30, "alias with a man", "supergroup", "mega super kewl rulets", "x@microsoft.com"), |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
329 ), |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
330 |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
331 "compos" => array( |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
332 "name,description,visible,voting", |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
333 "%s,%s,1,1", |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
334 array("Graphics", "Anything in standard resolutions."), |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
335 array("Protracker music", "Standard 4-channel Protracker MOD music."), |
170 | 336 array("4k intro", "4k intro competition"), |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
337 ), |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
338 |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
339 "entries" => array( |
170 | 340 "name,author,compo_id,filename,info", |
341 "%s,%s,%d,%s,%s", | |
342 array("Donkey Dong", "electric/extend", 1, "donkey.lbm", "amigaaaah!"), | |
343 array("Your kondom", "ccr/TNSP", 1, "kondom.lbm", "oh my god, it's full of cocks!"), | |
344 array("Penis song", "reed/flt", 2, "penis.mod", "laulu rakkaudelle"), | |
345 array("jenkka", "aegis", 2, "jenkka.mod", ""), | |
220 | 346 array("Fungiform 2", "mfx", 3, "mfx-fungiform2.lzh", "OCS-only"), |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
347 ), |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
348 |
140
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
349 "displaySlides" => array( |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
350 "title,text", |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
351 "%s,%s", |
414 | 352 array("Next Up 4k", "<h1>Next up: 4k intro</h1><h2>4k intro compo is about to begin</h2>... in about 10 minutes."), |
142
d2e9285b69ad
More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
353 array("Astu to infodesk", "<b>Astu</b> - please come to info desk!"), |
d2e9285b69ad
More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
354 array("Gentle Eye mainos", "<b>Buy Amiga stuff!</b><br />Gentle Eye Oy is selling Amiga-related stuff near organizer desk!"), |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
355 ), |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
356 |
416
876846d8ed5b
Rename some database things.
Matti Hamalainen <ccr@tnsp.org>
parents:
414
diff
changeset
|
357 "rotationListData" => array( |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
358 "name", |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
359 "%s", |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
360 array("Main rotation"), |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
361 array("Next Up"), |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
362 ), |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
363 |
416
876846d8ed5b
Rename some database things.
Matti Hamalainen <ccr@tnsp.org>
parents:
414
diff
changeset
|
364 "rotationListSlides" => array( |
140
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
365 "list_id,slide_id", |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
366 "%d,%d", |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
367 array(1,2), |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
368 array(1,3), |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
369 array(2,1), |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
370 ), |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
371 ); |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
372 |
88
784953d60ba5
More work on test data generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
373 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
374 // |
36 | 375 // Helper functions |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
376 // |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
377 function stGetTableSchema($dbh, $data) |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
378 { |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
379 $res = array(); |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
380 $driver = $dbh->getAttribute(PDO::ATTR_DRIVER_NAME); |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
381 |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
382 foreach ($data as $col) |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
383 { |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
384 $tmp = array(); |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
385 |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
386 switch ($driver) |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
387 { |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
388 case "pgsql": |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
389 foreach ($col as $elem) |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
390 { |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
391 if ($elem != "AUTOINCREMENT") |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
392 $tmp[] = $elem; |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
393 } |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
394 break; |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
395 |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
396 case "sqlite": |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
397 case "mysql": |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
398 $tmp = $col; |
518
af2f39a1dd79
Oops, had a missing semicolon ..
Matti Hamalainen <ccr@tnsp.org>
parents:
517
diff
changeset
|
399 break; |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
400 |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
401 default: |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
402 die("Don't know how to handle PDO driver '".$driver."' yet.\n"); |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
403 } |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
404 |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
405 $res[] = implode(" ", $tmp); |
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
406 } |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
407 |
504
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
408 return implode(", ", $res); |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
409 } |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
410 |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
411 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
412 function stCreateOneTable($dbh, $name, $schema) |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
413 { |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
414 return (stDBExecSQL($dbh, "CREATE TABLE IF NOT EXISTS ".$name." (".$schema.")") !== FALSE) ? TRUE : FALSE; |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
415 } |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
416 |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
417 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
418 function stCreateTables($dbh, $upgrade) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
419 { |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
420 global $sqlTables; |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
421 echo "Creating tables...\n"; |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
422 foreach ($sqlTables as $name => $schemaData) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
423 { |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
424 echo " - '".$name."'\n"; |
517
fcfd8e28a083
Start making database migration to PostgreSQL work.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
425 if (!stCreateOneTable($dbh, $name, stGetTableSchema($dbh, $schemaData)) && !$upgrade) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
426 return FALSE; |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
427 } |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
428 return TRUE; |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
429 } |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
430 |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
431 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
432 $upgradeMappings = array( |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
433 // "" => array("key" => "", value => ""), |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
434 ); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
435 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
436 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
437 function stUpgradeMap($type, $name, $value = FALSE) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
438 { |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
439 global $upgradeMappings; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
440 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
441 if (isset($upgradeMappings[$name])) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
442 { |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
443 if (isset($upgradeMappings[$name][$type])) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
444 { |
515 | 445 // XXX TODO .. |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
446 } |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
447 else |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
448 die("Upgrade failed due to missing or invalid upgrade definition: ".$type." ".$name." from version X to Y.\n"); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
449 } |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
450 else |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
451 switch ($type) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
452 { |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
453 case "key": return $name; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
454 case "value": return $value; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
455 } |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
456 } |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
457 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
458 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
459 function stAddSettings($inDB, $outDB, $settings, $table, $upgrade) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
460 { |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
461 echo ($upgrade ? "Adding settings to" : "Upgrading settings in")." '".$table."' table."; |
80 | 462 |
519 | 463 $status = TRUE; |
464 stDBExecSQL($outDB, "BEGIN TRANSACTION"); | |
465 | |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
466 foreach ($settings as $key => $data) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
467 { |
515 | 468 // Get setting type |
80 | 469 switch ($data[0]) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
470 { |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
471 case VT_TEXT: $type = "%s"; $var = "vtext"; break; |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
472 case VT_STR: $type = "%s"; $var = "vstr"; break; |
72
63a6caf59e5c
Fix creation of boolean settings, and add '%b' formatter into stPrepareSQL().
Matti Hamalainen <ccr@tnsp.org>
parents:
67
diff
changeset
|
473 case VT_BOOL: $type = "%b"; $var = "vint"; break; |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
474 case VT_INT: $type = "%d"; $var = "vint"; break; |
80 | 475 default: die("Invalid type in default settings '".$key."', type=".$data[0]."\n"); |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
476 } |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
477 |
515 | 478 // Map the key, in case the name has changed |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
479 $inKey = stUpgradeMap("key", $key); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
480 |
515 | 481 // Check if we are upgrading |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
482 if ($upgrade && ($res = stDBFetchSQL($inDB, stDBPrepareSQL($inDB, "SELECT * FROM ".$table." WHERE key=%s", $inKey))) !== FALSE) |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
483 { |
515 | 484 // Yup, upgrade the data, if we can |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
485 echo "."; |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
486 |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
487 if ($res["vtype"] != $data[0]) |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
488 die("Oops! Data type of '".$key."' does not match in table '".$table.". DB upgrade failed.\n"); |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
489 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
490 $sql = stDBPrepareSQL($outDB, |
519 | 491 "INSERT INTO ".$table." (key,vtype,".$var.",sdesc) VALUES (%s,%d,".$type.",%s)", |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
492 $key, $data[0], stUpgradeMap("value", $key, $res[$var]), $data[2]); |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
493 } |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
494 else |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
495 { |
515 | 496 // Normal insertion of default data |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
497 echo "+"; |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
498 $sql = stDBPrepareSQL($outDB, |
519 | 499 "INSERT INTO ".$table." (key,vtype,".$var.",sdesc) VALUES (%s,%d,".$type.",%s)", |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
500 $key, $data[0], $data[1], $data[2]); |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
501 } |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
502 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
503 if (stDBExecSQL($outDB, $sql) === FALSE) |
519 | 504 { |
505 $status = FALSE; | |
506 break; | |
507 } | |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
508 } |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
509 echo "\n"; |
519 | 510 |
511 stDBExecSQL($outDB, "COMMIT"); | |
512 return $status; | |
513 } | |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
514 |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
515 |
519 | 516 function stAddTestData($outDB) |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
517 { |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
518 global $siteTestData; |
519 | 519 |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
520 echo "Adding test data.\n"; |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
521 |
519 | 522 $status = TRUE; |
523 stDBExecSQL($outDB, "BEGIN TRANSACTION"); | |
524 | |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
525 foreach ($siteTestData as $table => $data) |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
526 { |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
527 echo " - ".$table."...\n"; |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
528 if (count($data) >= 3) |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
529 { |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
530 for ($n = 2; $n < count($data); $n++) |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
531 { |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
532 $arr = array_merge( |
519 | 533 array($outDB, "INSERT INTO ".$table." (".$data[0].") VALUES (".$data[1].")"), |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
534 $data[$n]); |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
535 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
536 $sql = call_user_func_array('stDBPrepareSQL', $arr); |
519 | 537 if (stDBExecSQL($outDB, $sql) === false) |
538 { | |
539 $status = false; | |
540 break; | |
541 } | |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
542 } |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
543 } |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
544 else |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
545 { |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
546 echo " Invalid table / data definition.\n"; |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
547 } |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
548 } |
519 | 549 |
550 stDBExecSQL($outDB, "COMMIT"); | |
551 return $status; | |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
552 } |
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
553 |
499 | 554 |
504
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
555 function stGetSQLTypeParam($dbh, $def, $value) |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
556 { |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
557 switch (substr($def, 0, 3)) |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
558 { |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
559 case "INT": |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
560 return intval($value); |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
561 |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
562 case "VAR": |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
563 case "TEX": |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
564 return $dbh->quote($value); |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
565 |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
566 default: die("Unknown type ".$col[1].".\n"); |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
567 } |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
568 } |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
569 |
519 | 570 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
571 function stMigrateTables($inDB, $outDB, $excluded) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
572 { |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
573 global $sqlTables; |
519 | 574 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
575 echo "Migrating tables...\n"; |
519 | 576 $status = TRUE; |
577 stDBExecSQL($outDB, "BEGIN TRANSACTION"); | |
578 | |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
579 foreach ($sqlTables as $name => $schema) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
580 if (!in_array($name, $excluded)) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
581 { |
504
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
582 echo " - '".$name."' "; |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
583 |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
584 foreach (stDBExecSQL($inDB, "SELECT * FROM ".$name) as $row) |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
585 { |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
586 $avals = array(); |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
587 $acols = array(); |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
588 |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
589 foreach ($schema as $col) |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
590 { |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
591 if (isset($row[$col[0]])) |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
592 { |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
593 $avals[] = stGetSQLTypeParam($outDB, $col[1], $row[$col[0]]); |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
594 $acols[] = $col[0]; |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
595 } |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
596 } |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
597 |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
598 $sql = "INSERT INTO ".$name." (".implode(",", $acols).") VALUES (".implode(",", $avals).")"; |
519 | 599 if (stDBExecSQL($outDB, $sql) === false) |
600 { | |
601 $status = FALSE; | |
602 break; | |
603 } | |
504
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
604 echo "."; |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
605 } |
a491865e0684
Implement tables migration.
Matti Hamalainen <ccr@tnsp.org>
parents:
503
diff
changeset
|
606 echo "\n"; |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
607 } |
519 | 608 |
609 stDBExecSQL($outDB, "COMMIT"); | |
610 | |
611 return $status; | |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
612 } |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
613 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
614 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
615 function stSetDBPermissions($spec) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
616 { |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
617 if (substr($spec, 0, 7) == "sqlite:") |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
618 { |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
619 $filename = substr($spec, 7); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
620 echo |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
621 "NOTICE! It seems you have SQLite database in use, changing permission ". |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
622 "of the target file '".$filename."' to 0600, for security. You may have to ". |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
623 "loosen up that for the things to actually work, but be careful. Having your ". |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
624 "database world-readable in the web is NOT good.\n"; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
625 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
626 if (chmod($filename, 0600) === FALSE) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
627 { |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
628 echo "ERROR! Could not set permissions of '".$filename."!\n"; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
629 } |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
630 } |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
631 } |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
632 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
633 |
36 | 634 // |
635 // Main program starts | |
636 // | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
637 if ($argc < 2) |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
638 { |
482
e0fd4c7ae8fb
Update commandline help, remove the commandline option for target database
Matti Hamalainen <ccr@tnsp.org>
parents:
479
diff
changeset
|
639 echo |
529
ddbc84031a7b
Rename createdb.php to managedb.php
Matti Hamalainen <ccr@tnsp.org>
parents:
528
diff
changeset
|
640 "ManageDB - Manage FAPWeb SQL database\n". |
482
e0fd4c7ae8fb
Update commandline help, remove the commandline option for target database
Matti Hamalainen <ccr@tnsp.org>
parents:
479
diff
changeset
|
641 "(C) Copyright 2012-2013 ccr/TNSP\n". |
e0fd4c7ae8fb
Update commandline help, remove the commandline option for target database
Matti Hamalainen <ccr@tnsp.org>
parents:
479
diff
changeset
|
642 "\n". |
e0fd4c7ae8fb
Update commandline help, remove the commandline option for target database
Matti Hamalainen <ccr@tnsp.org>
parents:
479
diff
changeset
|
643 "Usage: ".$argv[0]." <mode> [args]\n". |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
644 "Where mode is one of following:\n". |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
645 "\n". |
525
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
646 " new <dbspec> Create a new database with given PDO spec\n". |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
647 " or default to the one in mconfig.inc.php\n". |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
648 "\n". |
525
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
649 " test <dbspec> Like new, but add initial test data.\n". |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
650 "\n". |
525
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
651 " upgrade <input_dbspec> <output_dbspec>\n". |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
652 " Upgrade current database, if possible.\n". |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
653 " Output to new database (DO NOT USE SAME as current!)\n". |
516 | 654 "\n". |
525
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
655 " migrate <input_dbspec> <output_dbspec>\n". |
516 | 656 " Like upgrade, but no version check. Creates\n". |
657 " a copy of the database to the output spec.\n". | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
658 "\n"; |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
659 exit; |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
660 } |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
661 |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
662 |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
663 // Act according to specified command |
489 | 664 $addTestData = FALSE; |
27
b27204653615
Work on adding support for entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
665 switch (stCArgLC(1)) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
666 { |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
667 case "test": |
489 | 668 $addTestData = TRUE; |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
669 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
670 case "new": |
525
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
671 // Try to connect to database |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
672 if (($inSpec = stCArg(2)) === false) |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
673 die("No PDO database spec specified.\n"); |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
674 |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
675 if (($inDB = stConnectSQLDBSpec($inSpec)) === false) |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
676 die("Could not connect to SQL database '".$inSpec."'.\n"); |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
677 |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
678 echo "Using database spec '".$inSpec."'.\n"; |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
679 |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
680 // Create tables, add defaults |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
681 if (stCreateTables($inDB, FALSE)) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
682 { |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
683 stAddSettings($inDB, $inDB, $dbMeta, "dbmeta", FALSE); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
684 stAddSettings($inDB, $inDB, $siteDefaults, "settings", FALSE); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
685 stAddSettings($inDB, $inDB, $siteDisplayVars, "displayVars", FALSE); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
686 } |
27
b27204653615
Work on adding support for entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
687 |
489 | 688 if ($addTestData) |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
689 stAddTestData($inDB); |
85
50d6c69836a1
Add test data mode for database creation.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
690 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
691 stSetDBPermissions($inSpec); |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
692 break; |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
693 |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
694 case "upgrade": |
516 | 695 case "migrate": |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
696 // |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
697 // Attempt to upgrade database |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
698 // |
525
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
699 if ($argc < 4) |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
700 die("Usage: ".$argv[0]." upgrade <input_dbspec> <output_dbspec>\n"); |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
701 |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
702 $inSpec = stCArg(2); |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
703 $outSpec = stCArg(3); |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
704 |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
705 if ($outSpec == $inSpec) |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
706 die("The input and output databases CAN NOT BE SAME.\nBe VERY CAREFUL to not accidentally specify same db!\n"); |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
707 |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
708 echo "Using database spec '".$inSpec."'.\n"; |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
709 |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
710 if (($inDB = stConnectSQLDBSpec($inSpec)) === false) |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
711 die("Could not connect to SQL database '".$inSpec."'.\n"); |
d7302b3a479e
Change database tool commandline a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
519
diff
changeset
|
712 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
713 // Check the current version first ... |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
714 if (($currVersion = stGetDBMeta($inDB, "dbVersion")) === FALSE) |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
715 $currVersion = -1; |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
716 |
516 | 717 if ($currVersion == $dbVersion && stCArgLC(1) == "upgrade") |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
718 { |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
719 echo "Database is already version ".$dbVersion.", no upgrading needed.\n"; |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
720 } |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
721 else |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
722 { |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
723 // Okay, we shall create an upgraded version .. |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
724 if (($outDB = stConnectSQLDBSpec($outSpec)) === false) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
725 die("Could not connect to SQL database '".$outSpec."'.\n"); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
726 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
727 echo "Database at version ".$currVersion.", upgrading to ".$dbVersion."\n"; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
728 echo "Using OUTPUT database spec '".$outSpec."'.\n"; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
729 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
730 // Possibly bail out incompatible upgrades here |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
731 |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
732 // Create tables |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
733 if (!stCreateTables($outDB, TRUE)) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
734 exit; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
735 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
736 // Migrate data from setting tables .. |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
737 if (!stAddSettings($inDB, $outDB, $siteDefaults, "settings", TRUE)) |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
738 exit; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
739 |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
740 if (!stAddSettings($inDB, $outDB, $siteDisplayVars, "displayVars", TRUE)) |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
741 exit; |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
742 |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
743 stAddSettings($inDB, $outDB, $dbMeta, "dbmeta", TRUE); |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
744 |
503
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
745 // Migrate other tables |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
746 if (!stMigrateTables($inDB, $outDB, array("settings", "displayVars", "dbmeta"))) |
3232f682f0d2
Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents:
502
diff
changeset
|
747 exit; |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
748 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
749 echo "Setting dbVersion.\n"; |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
750 stSetDBMeta($outDB, "dbVersion", $dbVersion); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
751 echo "Upgrade complete.\n"; |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
752 |
502
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
753 stSetDBPermissions($inSpec); |
d2a38070e18f
Partially refactor database upgrading .. not finished yet, and the
Matti Hamalainen <ccr@tnsp.org>
parents:
500
diff
changeset
|
754 stSetDBPermissions($outSpec); |
199
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
755 } |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
756 break; |
dbc6f214b825
Work on a database upgrade function.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
757 |
27
b27204653615
Work on adding support for entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
758 default: |
b27204653615
Work on adding support for entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
759 echo "ERROR! Invalid operation mode '".stCArg(1)."'.\n"; |
b27204653615
Work on adding support for entry submission.
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
760 break; |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
761 } |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
762 |
28 | 763 |
764 // | |
765 // Clean up permissions | |
766 // | |
529
ddbc84031a7b
Rename createdb.php to managedb.php
Matti Hamalainen <ccr@tnsp.org>
parents:
528
diff
changeset
|
767 foreach (array("managedb.php") as $filename) |
28 | 768 { |
769 if (chmod($filename, 0700) === FALSE) | |
770 { | |
490
505f46b8bb14
Separate variable from string flow.
Matti Hamalainen <ccr@tnsp.org>
parents:
489
diff
changeset
|
771 echo "ERROR! Could not set permissions for '".$filename."'!\n"; |
28 | 772 } |
773 } | |
774 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
775 ?> |