@@ -14,40 +14,40 @@ |
||
| 14 | 14 | |
| 15 | 15 | if (!array_key_exists('v',$options) || !array_key_exists('c',$options) || !array_key_exists('b',$options)) |
| 16 | 16 | { |
| 17 | - printf("Need version -v, database -b (mysql,pgsql) command -c (create/update)\n"); |
|
| 18 | - exit(1); |
|
| 17 | + printf("Need version -v, database -b (mysql,pgsql) command -c (create/update)\n"); |
|
| 18 | + exit(1); |
|
| 19 | 19 | } |
| 20 | 20 | $command=$options['c']; |
| 21 | 21 | $path=$options['a']; |
| 22 | 22 | try { |
| 23 | - switch($command) |
|
| 24 | - { |
|
| 25 | - case 'create': |
|
| 26 | - $schema=($options['b']=='mysql')?'schema_v'.$options['v'].'.sql':'schema_v'.$options['v'].'.pgsql'; |
|
| 27 | - $schema=$path.'/SQL/'.$schema; |
|
| 28 | - $trap->trapsDB->create_schema($schema, 'traps_'); |
|
| 29 | - break; |
|
| 30 | - case 'update': |
|
| 31 | - $message=$trap->trapsDB->update_schema($path."/SQL/",$options['v'], 'traps_',true); |
|
| 32 | - printf("Update message : %s\n",$message); |
|
| 33 | - if ($message == 'ERROR') |
|
| 34 | - { |
|
| 35 | - exit(1); |
|
| 36 | - } |
|
| 37 | - printf("Messages DONE, updating : \n"); |
|
| 38 | - $message=$trap->trapsDB->update_schema($path."/SQL/",$options['v'], 'traps_'); |
|
| 39 | - if ($message == 'ERROR') |
|
| 40 | - { |
|
| 41 | - exit(1); |
|
| 42 | - } |
|
| 43 | - break; |
|
| 44 | - default: |
|
| 45 | - prtinf("Unknown command\n"); |
|
| 46 | - exit(1); |
|
| 47 | - } |
|
| 23 | + switch($command) |
|
| 24 | + { |
|
| 25 | + case 'create': |
|
| 26 | + $schema=($options['b']=='mysql')?'schema_v'.$options['v'].'.sql':'schema_v'.$options['v'].'.pgsql'; |
|
| 27 | + $schema=$path.'/SQL/'.$schema; |
|
| 28 | + $trap->trapsDB->create_schema($schema, 'traps_'); |
|
| 29 | + break; |
|
| 30 | + case 'update': |
|
| 31 | + $message=$trap->trapsDB->update_schema($path."/SQL/",$options['v'], 'traps_',true); |
|
| 32 | + printf("Update message : %s\n",$message); |
|
| 33 | + if ($message == 'ERROR') |
|
| 34 | + { |
|
| 35 | + exit(1); |
|
| 36 | + } |
|
| 37 | + printf("Messages DONE, updating : \n"); |
|
| 38 | + $message=$trap->trapsDB->update_schema($path."/SQL/",$options['v'], 'traps_'); |
|
| 39 | + if ($message == 'ERROR') |
|
| 40 | + { |
|
| 41 | + exit(1); |
|
| 42 | + } |
|
| 43 | + break; |
|
| 44 | + default: |
|
| 45 | + prtinf("Unknown command\n"); |
|
| 46 | + exit(1); |
|
| 47 | + } |
|
| 48 | 48 | } catch (Exception $e) { |
| 49 | - printf("Caught Exception %s\n",$e->getMessage()); |
|
| 50 | - exit (1); |
|
| 49 | + printf("Caught Exception %s\n",$e->getMessage()); |
|
| 50 | + exit (1); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | exit(0); |