Commit c907012c86dfd1c53f818fa635e8c4d753cd774b
1 parent
ec67a1c5
Exists in
master
and in
45 other branches
Migrate user WS to allow the save of a download request
Showing
1 changed file
with
30 additions
and
1 deletions
Show diff stats
src/InputOutput/IHMImpl/Tools/IHMUserWSManagerClass.php
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | */ |
8 | 8 | class IHMUserWSManagerClass |
9 | 9 | { |
10 | - private static $WS_VERSION = 1; | |
10 | + private static $WS_VERSION = 2; | |
11 | 11 | |
12 | 12 | protected $wsInfo = null; |
13 | 13 | |
... | ... | @@ -84,6 +84,35 @@ class IHMUserWSManagerClass |
84 | 84 | return file_put_contents(IHMConfigClass::getUserWSInfoFilePath(),$json_data); |
85 | 85 | } |
86 | 86 | |
87 | + private function updateFromVersion1() { | |
88 | + // Update WS for save download requests | |
89 | + | |
90 | + // Load user requests file | |
91 | + $req_mgr_file_path = IHMConfigClass::getUserRequestManagerFilePath(); | |
92 | + if (!file_exists($req_mgr_file_path)) { | |
93 | + return TRUE; | |
94 | + } | |
95 | + | |
96 | + $dom = new DOMDocument(); | |
97 | + if (!$dom->load($req_mgr_file_path)) { | |
98 | + return FALSE; | |
99 | + } | |
100 | + | |
101 | + $downloadNodeTag = 'downloadList'; | |
102 | + $downloadNodes = $dom->documentElement->getElementsByTagName($downloadNodeTag); | |
103 | + // Id download root node already exists, nothing to do | |
104 | + if ($downloadNodes->length > 0) { | |
105 | + return TRUE; | |
106 | + } | |
107 | + | |
108 | + // Create download root node | |
109 | + $downloadNode = $dom->createElement($downloadNodeTag); | |
110 | + $downloadNode->setAttribute('xml:id', 'download-treeRootNode'); | |
111 | + $dom->documentElement->appendChild($downloadNode); | |
112 | + | |
113 | + return $dom->save($req_mgr_file_path); | |
114 | + } | |
115 | + | |
87 | 116 | private function updateFromVersion0() { |
88 | 117 | // This update split plot requests |
89 | 118 | ... | ... |