mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 17:13:47 +02:00
2018-06-08 Fred Gleason <fredg@paravelsystems.com>
* Added a sanity check to rddbmgr(8) to prevent reverting from an unknown schema. * Added a sanity check to rddbmgr(8) to prevent inadvertent reversion to an implied schema.
This commit is contained in:
@@ -17033,3 +17033,8 @@
|
||||
* Removed the 'Backup Database' and 'Restore Database' buttons
|
||||
from rdadmin(1).
|
||||
* Removed the database creation and updater code from rdadmin(1).
|
||||
2018-06-08 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a sanity check to rddbmgr(8) to prevent reverting from an
|
||||
unknown schema.
|
||||
* Added a sanity check to rddbmgr(8) to prevent inadvertent
|
||||
reversion to an implied schema.
|
||||
|
@@ -222,23 +222,6 @@ MainObject::MainObject(QObject *parent)
|
||||
fprintf(stderr,"rddbmgr: exactly one command must be specified\n");
|
||||
exit(1);
|
||||
}
|
||||
if(set_schema>0) {
|
||||
if((set_schema<242)||(set_schema>RD_VERSION_DATABASE)) {
|
||||
fprintf(stderr,"rddbmgr: unsupported schema\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(set_version.isEmpty()) {
|
||||
set_schema=RD_VERSION_DATABASE;
|
||||
}
|
||||
else {
|
||||
if((set_schema=GetVersionSchema(set_version))==0) {
|
||||
fprintf(stderr,"invalid/unsupported Rivendell version\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(db_yes&&db_no) {
|
||||
fprintf(stderr,"rddbmgr: '--yes' and '--no' are mutually exclusive\n");
|
||||
exit(1);
|
||||
@@ -318,6 +301,36 @@ MainObject::MainObject(QObject *parent)
|
||||
RDConfig::createTablePostfix(db_mysql_engine,db_mysql_charset,
|
||||
db_mysql_collation);
|
||||
|
||||
//
|
||||
// Resolve Target Schema
|
||||
//
|
||||
int schema=GetCurrentSchema();
|
||||
if(schema>RD_VERSION_DATABASE) {
|
||||
fprintf(stderr,"rddbmgr: unknown current schema [%d]\n",schema);
|
||||
exit(1);
|
||||
}
|
||||
if(set_schema>0) {
|
||||
if((set_schema<242)||(set_schema>RD_VERSION_DATABASE)) {
|
||||
fprintf(stderr,"rddbmgr: unsupported schema\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(set_version.isEmpty()) {
|
||||
if(set_schema<schema) {
|
||||
fprintf(stderr,"rddbmgr: reversion implied, you must explicitly specify the target schema\n");
|
||||
exit(1);
|
||||
}
|
||||
set_schema=RD_VERSION_DATABASE;
|
||||
}
|
||||
else {
|
||||
if((set_schema=GetVersionSchema(set_version))==0) {
|
||||
fprintf(stderr,"invalid/unsupported Rivendell version\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Run the Command
|
||||
//
|
||||
|
Reference in New Issue
Block a user