Fossil SCM
Use the list of configuration properties when transfering content from the template repo to the new repo. Also transfer the ticket formats.
Commit
78cf4138d9ab7214bc7a865d8209598fc41a50a7
Parent
e771171c68edb90…
2 files changed
+22
+9
-16
+22
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -157,10 +157,32 @@ | ||
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | return 0; |
| 161 | 161 | } |
| 162 | + | |
| 163 | +/* | |
| 164 | +** Return a pointer to a string that contains the RHS of an IN operator | |
| 165 | +** that will select CONFIG table names that are part of the configuration | |
| 166 | +** that matchines iMatch. | |
| 167 | +*/ | |
| 168 | +const char *configure_inop_rhs(int iMask){ | |
| 169 | + Blob x; | |
| 170 | + int i; | |
| 171 | + const char *zSep = ""; | |
| 172 | + | |
| 173 | + blob_zero(&x); | |
| 174 | + blob_append(&x, "(", 1); | |
| 175 | + for(i=0; i<count(aConfig); i++){ | |
| 176 | + if( (aConfig[i].groupMask & iMask)==0 ) continue; | |
| 177 | + if( aConfig[i].zName[0]=='@' ) continue; | |
| 178 | + blob_appendf(&x, "%s'%s'", zSep, aConfig[i].zName); | |
| 179 | + zSep = ","; | |
| 180 | + } | |
| 181 | + blob_append(&x, ")", 1); | |
| 182 | + return blob_str(&x); | |
| 183 | +} | |
| 162 | 184 | |
| 163 | 185 | /* |
| 164 | 186 | ** Return the mask for the named configuration parameter if it can be |
| 165 | 187 | ** safely exported. Return 0 if the parameter is not safe to export. |
| 166 | 188 | ** |
| 167 | 189 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -157,10 +157,32 @@ | |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | return 0; |
| 161 | } |
| 162 | |
| 163 | /* |
| 164 | ** Return the mask for the named configuration parameter if it can be |
| 165 | ** safely exported. Return 0 if the parameter is not safe to export. |
| 166 | ** |
| 167 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -157,10 +157,32 @@ | |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | return 0; |
| 161 | } |
| 162 | |
| 163 | /* |
| 164 | ** Return a pointer to a string that contains the RHS of an IN operator |
| 165 | ** that will select CONFIG table names that are part of the configuration |
| 166 | ** that matchines iMatch. |
| 167 | */ |
| 168 | const char *configure_inop_rhs(int iMask){ |
| 169 | Blob x; |
| 170 | int i; |
| 171 | const char *zSep = ""; |
| 172 | |
| 173 | blob_zero(&x); |
| 174 | blob_append(&x, "(", 1); |
| 175 | for(i=0; i<count(aConfig); i++){ |
| 176 | if( (aConfig[i].groupMask & iMask)==0 ) continue; |
| 177 | if( aConfig[i].zName[0]=='@' ) continue; |
| 178 | blob_appendf(&x, "%s'%s'", zSep, aConfig[i].zName); |
| 179 | zSep = ","; |
| 180 | } |
| 181 | blob_append(&x, ")", 1); |
| 182 | return blob_str(&x); |
| 183 | } |
| 184 | |
| 185 | /* |
| 186 | ** Return the mask for the named configuration parameter if it can be |
| 187 | ** safely exported. Return 0 if the parameter is not safe to export. |
| 188 | ** |
| 189 |
M
src/db.c
+9
-16
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1267,30 +1267,23 @@ | ||
| 1267 | 1267 | db_create_default_users(0, zDefaultUser); |
| 1268 | 1268 | user_select(); |
| 1269 | 1269 | |
| 1270 | 1270 | if( zTemplate ){ |
| 1271 | 1271 | /* |
| 1272 | - ** Copy all settings from the supplied template repository | |
| 1273 | - ** except those that are, by definition, always unique to a | |
| 1274 | - ** specific project. The list of settings excluded by this | |
| 1275 | - ** SQL statement may need to be revised in the future. | |
| 1272 | + ** Copy all settings from the supplied template repository. | |
| 1276 | 1273 | */ |
| 1277 | 1274 | db_multi_exec( |
| 1278 | 1275 | "INSERT OR REPLACE INTO config" |
| 1279 | - " SELECT name,value,mtime" | |
| 1280 | - " FROM settingSrc.config WHERE name NOT IN (" | |
| 1281 | - " 'content-schema','aux-schema'," | |
| 1282 | - " 'server-code','project-code'," | |
| 1283 | - " 'last-sync-url','last-sync-pw'," | |
| 1284 | - " 'captcha-secret','login-group-code'," | |
| 1285 | - " 'login-group-name'" | |
| 1286 | - " ) AND " | |
| 1287 | - " name NOT GLOB 'ckout:*' AND" | |
| 1288 | - " name NOT GLOB 'baseurl:*' AND" | |
| 1289 | - " name NOT GLOB 'peer-name-*' AND" | |
| 1290 | - " name NOT GLOB 'peer-repo-*';" | |
| 1276 | + " SELECT name,value,mtime FROM settingSrc.config" | |
| 1277 | + " WHERE name IN %s" | |
| 1278 | + " AND name NOT GLOB 'project-*';", | |
| 1279 | + configure_inop_rhs(CONFIGSET_ALL) | |
| 1280 | + ); | |
| 1281 | + db_multi_exec( | |
| 1282 | + "REPLACE INTO reportfmt SELECT * FROM settingSrc.reportfmt;" | |
| 1291 | 1283 | ); |
| 1284 | + | |
| 1292 | 1285 | /* |
| 1293 | 1286 | ** Copy the user permissions, contact information, last modified |
| 1294 | 1287 | ** time, and photo for all the "system" users from the supplied |
| 1295 | 1288 | ** template repository into the one being setup. The other columns |
| 1296 | 1289 | ** are not copied because they contain security information or other |
| 1297 | 1290 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1267,30 +1267,23 @@ | |
| 1267 | db_create_default_users(0, zDefaultUser); |
| 1268 | user_select(); |
| 1269 | |
| 1270 | if( zTemplate ){ |
| 1271 | /* |
| 1272 | ** Copy all settings from the supplied template repository |
| 1273 | ** except those that are, by definition, always unique to a |
| 1274 | ** specific project. The list of settings excluded by this |
| 1275 | ** SQL statement may need to be revised in the future. |
| 1276 | */ |
| 1277 | db_multi_exec( |
| 1278 | "INSERT OR REPLACE INTO config" |
| 1279 | " SELECT name,value,mtime" |
| 1280 | " FROM settingSrc.config WHERE name NOT IN (" |
| 1281 | " 'content-schema','aux-schema'," |
| 1282 | " 'server-code','project-code'," |
| 1283 | " 'last-sync-url','last-sync-pw'," |
| 1284 | " 'captcha-secret','login-group-code'," |
| 1285 | " 'login-group-name'" |
| 1286 | " ) AND " |
| 1287 | " name NOT GLOB 'ckout:*' AND" |
| 1288 | " name NOT GLOB 'baseurl:*' AND" |
| 1289 | " name NOT GLOB 'peer-name-*' AND" |
| 1290 | " name NOT GLOB 'peer-repo-*';" |
| 1291 | ); |
| 1292 | /* |
| 1293 | ** Copy the user permissions, contact information, last modified |
| 1294 | ** time, and photo for all the "system" users from the supplied |
| 1295 | ** template repository into the one being setup. The other columns |
| 1296 | ** are not copied because they contain security information or other |
| 1297 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1267,30 +1267,23 @@ | |
| 1267 | db_create_default_users(0, zDefaultUser); |
| 1268 | user_select(); |
| 1269 | |
| 1270 | if( zTemplate ){ |
| 1271 | /* |
| 1272 | ** Copy all settings from the supplied template repository. |
| 1273 | */ |
| 1274 | db_multi_exec( |
| 1275 | "INSERT OR REPLACE INTO config" |
| 1276 | " SELECT name,value,mtime FROM settingSrc.config" |
| 1277 | " WHERE name IN %s" |
| 1278 | " AND name NOT GLOB 'project-*';", |
| 1279 | configure_inop_rhs(CONFIGSET_ALL) |
| 1280 | ); |
| 1281 | db_multi_exec( |
| 1282 | "REPLACE INTO reportfmt SELECT * FROM settingSrc.reportfmt;" |
| 1283 | ); |
| 1284 | |
| 1285 | /* |
| 1286 | ** Copy the user permissions, contact information, last modified |
| 1287 | ** time, and photo for all the "system" users from the supplied |
| 1288 | ** template repository into the one being setup. The other columns |
| 1289 | ** are not copied because they contain security information or other |
| 1290 |