@@ -41,172 +41,172 @@ discard block |
||
41 | 41 | |
42 | 42 | class UpgradeMetaHelper{ |
43 | 43 | |
44 | - var $upgrade_dir; |
|
45 | - var $debug_mode; |
|
46 | - var $upgrade_modules; |
|
47 | - var $customized_modules; |
|
48 | - var $source_dir; |
|
49 | - var $dest_dir ; |
|
50 | - var $evparser; |
|
51 | - var $dvparser; |
|
52 | - var $path_to_master_copy; |
|
53 | - /** |
|
54 | - * UpgradeMetaHelper |
|
55 | - * This is the constructor for the UpgradeMetaHelper class |
|
56 | - * @param $dir The root upgrade directory (where to copy working files) |
|
57 | - * @param $masterCopyDirectory The root master directory (where SugarCRM 5.x files reside) |
|
58 | - * @param $debugMode Debug mode, default is false |
|
59 | - * |
|
60 | - */ |
|
61 | - function UpgradeMetaHelper($dir='upgrade', $masterCopyDirecotry='modules_50', $debugMode = false) { |
|
62 | - $this->upgrade_dir = $dir; |
|
63 | - $this->debug_mode = $debugMode; |
|
64 | - $this->upgrade_modules = $this->getModifiedModules(); |
|
65 | - |
|
66 | - if(count($this->upgrade_modules) > 0) { |
|
67 | - $_SESSION['Upgraded_Modules'] = $this->upgrade_modules; |
|
68 | - $this->create_upgrade_directory(); |
|
69 | - $this->path_to_master_copy = $masterCopyDirecotry; |
|
70 | - $this->runParser(); |
|
71 | - } |
|
72 | - |
|
73 | - $this->customized_modules = $this->getAllCustomizedModulesBeyondStudio(); |
|
74 | - if(count($this->customized_modules) > 0) { |
|
75 | - $_SESSION['Customized_Modules'] = $this->customized_modules; |
|
76 | - } |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * getModifiedModules |
|
82 | - * This method returns a two-dimensional Array of Studio enabled |
|
83 | - * modules that have been modified. The second Array index is an |
|
84 | - * Array of files that do not match the md5 checksum for the module |
|
85 | - * @return $return_array Two-dimensional Array of [module][modified file(s) Array] |
|
86 | - */ |
|
87 | - function getModifiedModules() { |
|
88 | - |
|
89 | - $md5_string = array(); |
|
90 | - if(file_exists(clean_path(getcwd().'/files.md5'))){ |
|
91 | - require(clean_path(getcwd().'/files.md5')); |
|
92 | - } |
|
93 | - |
|
94 | - $return_array = array(); |
|
95 | - $modules = $this->loadStudioModules(); |
|
96 | - foreach($modules as $mod) { |
|
97 | - |
|
98 | - $editView = "modules/$mod/EditView.html"; |
|
99 | - $detailView = "modules/$mod/DetailView.html"; |
|
100 | - $searchForm = "modules/$mod/SearchForm.html"; |
|
101 | - if(file_exists($editView) && isset($md5_string['./' . $editView])) { |
|
102 | - $fileContents = file_get_contents($editView); |
|
103 | - if(md5($fileContents) != $md5_string['./' . $editView]) { |
|
104 | - $return_array[$mod][] = $editView; |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - if(file_exists($detailView) && isset($md5_string['./' . $detailView])) { |
|
109 | - $fileContents = file_get_contents($detailView); |
|
110 | - if(md5($fileContents) != $md5_string['./' . $detailView]) { |
|
111 | - $return_array[$mod][] = $detailView; |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - if(file_exists($searchForm) && isset($md5_string['./' . $searchForm])) { |
|
116 | - $fileContents = file_get_contents($searchForm); |
|
117 | - if(md5($fileContents) != $md5_string['./' . $searchForm]) { |
|
118 | - $return_array[$mod][] = $searchForm; |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - } //foreach |
|
123 | - |
|
124 | - return $return_array; |
|
125 | - } |
|
44 | + var $upgrade_dir; |
|
45 | + var $debug_mode; |
|
46 | + var $upgrade_modules; |
|
47 | + var $customized_modules; |
|
48 | + var $source_dir; |
|
49 | + var $dest_dir ; |
|
50 | + var $evparser; |
|
51 | + var $dvparser; |
|
52 | + var $path_to_master_copy; |
|
53 | + /** |
|
54 | + * UpgradeMetaHelper |
|
55 | + * This is the constructor for the UpgradeMetaHelper class |
|
56 | + * @param $dir The root upgrade directory (where to copy working files) |
|
57 | + * @param $masterCopyDirectory The root master directory (where SugarCRM 5.x files reside) |
|
58 | + * @param $debugMode Debug mode, default is false |
|
59 | + * |
|
60 | + */ |
|
61 | + function UpgradeMetaHelper($dir='upgrade', $masterCopyDirecotry='modules_50', $debugMode = false) { |
|
62 | + $this->upgrade_dir = $dir; |
|
63 | + $this->debug_mode = $debugMode; |
|
64 | + $this->upgrade_modules = $this->getModifiedModules(); |
|
65 | + |
|
66 | + if(count($this->upgrade_modules) > 0) { |
|
67 | + $_SESSION['Upgraded_Modules'] = $this->upgrade_modules; |
|
68 | + $this->create_upgrade_directory(); |
|
69 | + $this->path_to_master_copy = $masterCopyDirecotry; |
|
70 | + $this->runParser(); |
|
71 | + } |
|
72 | + |
|
73 | + $this->customized_modules = $this->getAllCustomizedModulesBeyondStudio(); |
|
74 | + if(count($this->customized_modules) > 0) { |
|
75 | + $_SESSION['Customized_Modules'] = $this->customized_modules; |
|
76 | + } |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * getModifiedModules |
|
82 | + * This method returns a two-dimensional Array of Studio enabled |
|
83 | + * modules that have been modified. The second Array index is an |
|
84 | + * Array of files that do not match the md5 checksum for the module |
|
85 | + * @return $return_array Two-dimensional Array of [module][modified file(s) Array] |
|
86 | + */ |
|
87 | + function getModifiedModules() { |
|
88 | + |
|
89 | + $md5_string = array(); |
|
90 | + if(file_exists(clean_path(getcwd().'/files.md5'))){ |
|
91 | + require(clean_path(getcwd().'/files.md5')); |
|
92 | + } |
|
93 | + |
|
94 | + $return_array = array(); |
|
95 | + $modules = $this->loadStudioModules(); |
|
96 | + foreach($modules as $mod) { |
|
97 | + |
|
98 | + $editView = "modules/$mod/EditView.html"; |
|
99 | + $detailView = "modules/$mod/DetailView.html"; |
|
100 | + $searchForm = "modules/$mod/SearchForm.html"; |
|
101 | + if(file_exists($editView) && isset($md5_string['./' . $editView])) { |
|
102 | + $fileContents = file_get_contents($editView); |
|
103 | + if(md5($fileContents) != $md5_string['./' . $editView]) { |
|
104 | + $return_array[$mod][] = $editView; |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + if(file_exists($detailView) && isset($md5_string['./' . $detailView])) { |
|
109 | + $fileContents = file_get_contents($detailView); |
|
110 | + if(md5($fileContents) != $md5_string['./' . $detailView]) { |
|
111 | + $return_array[$mod][] = $detailView; |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + if(file_exists($searchForm) && isset($md5_string['./' . $searchForm])) { |
|
116 | + $fileContents = file_get_contents($searchForm); |
|
117 | + if(md5($fileContents) != $md5_string['./' . $searchForm]) { |
|
118 | + $return_array[$mod][] = $searchForm; |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + } //foreach |
|
123 | + |
|
124 | + return $return_array; |
|
125 | + } |
|
126 | 126 | |
127 | 127 | function saveMatchingFilesQueries($currStep,$value){ |
128 | - $upgrade_progress_dir = sugar_cached('upgrades/temp'); |
|
129 | - if(!is_dir($upgrade_progress_dir)){ |
|
130 | - mkdir($upgrade_progress_dir); |
|
131 | - } |
|
132 | - $file_queries_file = $upgrade_progress_dir.'/files_queries.php'; |
|
133 | - if(file_exists($file_queries_file)){ |
|
134 | - include($file_queries_file); |
|
135 | - } |
|
136 | - else{ |
|
137 | - if(function_exists('sugar_fopen')){ |
|
138 | - sugar_fopen($file_queries_file, 'w+'); |
|
139 | - } |
|
140 | - else{ |
|
141 | - fopen($file_queries_file, 'w+'); |
|
142 | - } |
|
143 | - } |
|
144 | - if(!isset($files_queries) || $files_queries == NULL){ |
|
145 | - $files_queries = array(); |
|
146 | - } |
|
147 | - $files_queries[$currStep]=$value; |
|
148 | - if(is_writable($file_queries_file) && write_array_to_file( "file_queries", $file_queries, |
|
149 | - $file_queries_file)) { |
|
150 | - //writing to the file |
|
151 | - } |
|
128 | + $upgrade_progress_dir = sugar_cached('upgrades/temp'); |
|
129 | + if(!is_dir($upgrade_progress_dir)){ |
|
130 | + mkdir($upgrade_progress_dir); |
|
131 | + } |
|
132 | + $file_queries_file = $upgrade_progress_dir.'/files_queries.php'; |
|
133 | + if(file_exists($file_queries_file)){ |
|
134 | + include($file_queries_file); |
|
135 | + } |
|
136 | + else{ |
|
137 | + if(function_exists('sugar_fopen')){ |
|
138 | + sugar_fopen($file_queries_file, 'w+'); |
|
139 | + } |
|
140 | + else{ |
|
141 | + fopen($file_queries_file, 'w+'); |
|
142 | + } |
|
143 | + } |
|
144 | + if(!isset($files_queries) || $files_queries == NULL){ |
|
145 | + $files_queries = array(); |
|
146 | + } |
|
147 | + $files_queries[$currStep]=$value; |
|
148 | + if(is_writable($file_queries_file) && write_array_to_file( "file_queries", $file_queries, |
|
149 | + $file_queries_file)) { |
|
150 | + //writing to the file |
|
151 | + } |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | function getAllCustomizedModulesBeyondStudio() { |
155 | 155 | |
156 | - require_once('modules/UpgradeWizard/uw_utils.php'); |
|
157 | - $md5_string = array(); |
|
158 | - if(file_exists(clean_path(getcwd().'/files.md5'))){ |
|
159 | - require(clean_path(getcwd().'/files.md5')); |
|
160 | - } |
|
156 | + require_once('modules/UpgradeWizard/uw_utils.php'); |
|
157 | + $md5_string = array(); |
|
158 | + if(file_exists(clean_path(getcwd().'/files.md5'))){ |
|
159 | + require(clean_path(getcwd().'/files.md5')); |
|
160 | + } |
|
161 | 161 | $return_array = array(); |
162 | 162 | $modules = $this->loadStudioModules(); |
163 | 163 | $modulesAll = getAllModules(); //keep all modules as well |
164 | 164 | $allOtherModules = array_diff($modulesAll,$modules); |
165 | 165 | foreach($modules as $mod) { |
166 | - if(!is_dir('modules/'.$mod)) continue; |
|
167 | - $editView = "modules/$mod/EditView.html"; |
|
168 | - $detailView ="modules/$mod/DetailView.html"; |
|
169 | - $exclude_files[]=$editView; |
|
170 | - $exclude_files[]=$detailView; |
|
171 | - $allModFiles = array(); |
|
172 | - $allModFiles = findAllFiles('modules/'.$mod,$allModFiles); |
|
173 | - foreach($allModFiles as $file){ |
|
174 | - //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file); |
|
175 | - if(file_exists($file) && !in_array($file,$exclude_files)){ |
|
176 | - if(isset($md5_string['./'.$file])) { |
|
177 | - $fileContents = file_get_contents($file); |
|
178 | - if(md5($fileContents) != $md5_string['./'.$file]) { |
|
179 | - $return_array[$mod][] = $file; |
|
180 | - } |
|
181 | - else{ |
|
182 | - //keep in the array to be deleted later |
|
183 | - $_SESSION['removeMd5MatchingFiles'][] = $file; |
|
184 | - } |
|
185 | - } |
|
186 | - } |
|
187 | - } |
|
166 | + if(!is_dir('modules/'.$mod)) continue; |
|
167 | + $editView = "modules/$mod/EditView.html"; |
|
168 | + $detailView ="modules/$mod/DetailView.html"; |
|
169 | + $exclude_files[]=$editView; |
|
170 | + $exclude_files[]=$detailView; |
|
171 | + $allModFiles = array(); |
|
172 | + $allModFiles = findAllFiles('modules/'.$mod,$allModFiles); |
|
173 | + foreach($allModFiles as $file){ |
|
174 | + //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file); |
|
175 | + if(file_exists($file) && !in_array($file,$exclude_files)){ |
|
176 | + if(isset($md5_string['./'.$file])) { |
|
177 | + $fileContents = file_get_contents($file); |
|
178 | + if(md5($fileContents) != $md5_string['./'.$file]) { |
|
179 | + $return_array[$mod][] = $file; |
|
180 | + } |
|
181 | + else{ |
|
182 | + //keep in the array to be deleted later |
|
183 | + $_SESSION['removeMd5MatchingFiles'][] = $file; |
|
184 | + } |
|
185 | + } |
|
186 | + } |
|
187 | + } |
|
188 | 188 | } //foreach |
189 | 189 | //also check out other non-studio modules by taking the difference between |
190 | 190 | //allMOdules and |
191 | - foreach($allOtherModules as $mod) { |
|
192 | - if(!is_dir('modules/'.$mod)) continue; |
|
193 | - $allModFiles = array(); |
|
194 | - $allModFiles = findAllFiles('modules/'.$mod,$allModFiles); |
|
195 | - foreach($allModFiles as $file){ |
|
196 | - //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file); |
|
197 | - if(file_exists($file)){ |
|
198 | - if(isset($md5_string['./'.$file])) { |
|
199 | - $fileContents = file_get_contents($file); |
|
200 | - if(md5($fileContents) == $md5_string['./'.$file]) { |
|
201 | - $_SESSION['removeMd5MatchingFiles'][] = $file; |
|
202 | - } |
|
203 | - } |
|
204 | - } |
|
205 | - } |
|
206 | - } |
|
207 | - //Also store in a file |
|
208 | - //saveMatchingFilesQueries('removeMd5MatchingFiles',$_SESSION['removeMd5MatchingFiles']); |
|
209 | - return $return_array; |
|
191 | + foreach($allOtherModules as $mod) { |
|
192 | + if(!is_dir('modules/'.$mod)) continue; |
|
193 | + $allModFiles = array(); |
|
194 | + $allModFiles = findAllFiles('modules/'.$mod,$allModFiles); |
|
195 | + foreach($allModFiles as $file){ |
|
196 | + //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file); |
|
197 | + if(file_exists($file)){ |
|
198 | + if(isset($md5_string['./'.$file])) { |
|
199 | + $fileContents = file_get_contents($file); |
|
200 | + if(md5($fileContents) == $md5_string['./'.$file]) { |
|
201 | + $_SESSION['removeMd5MatchingFiles'][] = $file; |
|
202 | + } |
|
203 | + } |
|
204 | + } |
|
205 | + } |
|
206 | + } |
|
207 | + //Also store in a file |
|
208 | + //saveMatchingFilesQueries('removeMd5MatchingFiles',$_SESSION['removeMd5MatchingFiles']); |
|
209 | + return $return_array; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -218,39 +218,39 @@ discard block |
||
218 | 218 | */ |
219 | 219 | function getAllCustomizedModules() { |
220 | 220 | |
221 | - require_once('files.md5'); |
|
222 | - |
|
223 | - $return_array = array(); |
|
224 | - $modules = getAllModules(); |
|
225 | - foreach($modules as $mod) { |
|
226 | - //find all files in each module if the files have been modified |
|
227 | - //as compared to the base version then add the module to the |
|
228 | - //customized modules array |
|
229 | - $modFiles = findAllFiles(clean_path(getcwd())."/modules/$mod", array()); |
|
230 | - foreach($modFiles as $file){ |
|
231 | - $fileContents = file_get_contents($file); |
|
232 | - $file = str_replace(clean_path(getcwd()),'',$file); |
|
233 | - if($md5_string['./' . $file]){ |
|
234 | - if(md5($fileContents) != $md5_string['./' . $file]) { |
|
235 | - //A file has been customized in the module. Put the module into the |
|
236 | - // customized modules array. |
|
237 | - echo 'Changed File'.$file; |
|
238 | - $return_array[$mod]; |
|
239 | - break; |
|
240 | - } |
|
241 | - } |
|
242 | - else{ |
|
243 | - // This is a new file in user's version and indicates that module has been |
|
244 | - //customized. Put the module in the customized array. |
|
245 | - echo 'New File'.$file; |
|
246 | - $return_array[$mod]; |
|
247 | - break; |
|
248 | - } |
|
249 | - } |
|
250 | - } //foreach |
|
251 | - |
|
252 | - return $return_array; |
|
253 | - } |
|
221 | + require_once('files.md5'); |
|
222 | + |
|
223 | + $return_array = array(); |
|
224 | + $modules = getAllModules(); |
|
225 | + foreach($modules as $mod) { |
|
226 | + //find all files in each module if the files have been modified |
|
227 | + //as compared to the base version then add the module to the |
|
228 | + //customized modules array |
|
229 | + $modFiles = findAllFiles(clean_path(getcwd())."/modules/$mod", array()); |
|
230 | + foreach($modFiles as $file){ |
|
231 | + $fileContents = file_get_contents($file); |
|
232 | + $file = str_replace(clean_path(getcwd()),'',$file); |
|
233 | + if($md5_string['./' . $file]){ |
|
234 | + if(md5($fileContents) != $md5_string['./' . $file]) { |
|
235 | + //A file has been customized in the module. Put the module into the |
|
236 | + // customized modules array. |
|
237 | + echo 'Changed File'.$file; |
|
238 | + $return_array[$mod]; |
|
239 | + break; |
|
240 | + } |
|
241 | + } |
|
242 | + else{ |
|
243 | + // This is a new file in user's version and indicates that module has been |
|
244 | + //customized. Put the module in the customized array. |
|
245 | + echo 'New File'.$file; |
|
246 | + $return_array[$mod]; |
|
247 | + break; |
|
248 | + } |
|
249 | + } |
|
250 | + } //foreach |
|
251 | + |
|
252 | + return $return_array; |
|
253 | + } |
|
254 | 254 | |
255 | 255 | /** |
256 | 256 | * loadStudioModules |
@@ -258,139 +258,139 @@ discard block |
||
258 | 258 | * present in the metadata directory of the module |
259 | 259 | * @return $modules Array of modules that are studio enabled |
260 | 260 | */ |
261 | - function loadStudioModules() { |
|
262 | - $modules = array(); |
|
263 | - $d = dir('modules'); |
|
264 | - while($e = $d->read()){ |
|
265 | - if(substr($e, 0, 1) == '.' || !is_dir('modules/' . $e))continue; |
|
266 | - if(file_exists('modules/' . $e . '/metadata/studio.php')){ |
|
267 | - $modules[] = $e; |
|
268 | - } |
|
269 | - } |
|
270 | - return $modules; |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - /** |
|
275 | - * runParser |
|
276 | - * This method creates the EditView and DetailView parser intances |
|
277 | - * and runs the parsing for the modules to upgrade |
|
278 | - * |
|
279 | - */ |
|
280 | - function runParser() { |
|
281 | - require_once('include/SugarFields/Parsers/EditViewMetaParser.php'); |
|
282 | - require_once('include/SugarFields/Parsers/DetailViewMetaParser.php'); |
|
283 | - require_once('include/SugarFields/Parsers/SearchFormMetaParser.php'); |
|
284 | - |
|
285 | - $this->evparser = new EditViewMetaParser(); |
|
286 | - $this->dvparser = new DetailViewMetaParser(); |
|
287 | - $this->svparser = new SearchFormMetaParser(); |
|
288 | - |
|
289 | - foreach($this->upgrade_modules as $module_name=>$files) { |
|
290 | - $this->parseFile($module_name, $files); |
|
291 | - } //foreach |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * parseFile |
|
297 | - * Hanldes parsing the files for given module where Studio or manual |
|
298 | - * changes have been detected. |
|
299 | - * @param $module_name The module to parse |
|
300 | - * @param $files Array of files found to parse |
|
301 | - * |
|
302 | - */ |
|
303 | - function parseFile($module_name, $files) { |
|
304 | - global $beanList, $dictionary; |
|
305 | - foreach($files as $file) { |
|
261 | + function loadStudioModules() { |
|
262 | + $modules = array(); |
|
263 | + $d = dir('modules'); |
|
264 | + while($e = $d->read()){ |
|
265 | + if(substr($e, 0, 1) == '.' || !is_dir('modules/' . $e))continue; |
|
266 | + if(file_exists('modules/' . $e . '/metadata/studio.php')){ |
|
267 | + $modules[] = $e; |
|
268 | + } |
|
269 | + } |
|
270 | + return $modules; |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + /** |
|
275 | + * runParser |
|
276 | + * This method creates the EditView and DetailView parser intances |
|
277 | + * and runs the parsing for the modules to upgrade |
|
278 | + * |
|
279 | + */ |
|
280 | + function runParser() { |
|
281 | + require_once('include/SugarFields/Parsers/EditViewMetaParser.php'); |
|
282 | + require_once('include/SugarFields/Parsers/DetailViewMetaParser.php'); |
|
283 | + require_once('include/SugarFields/Parsers/SearchFormMetaParser.php'); |
|
284 | + |
|
285 | + $this->evparser = new EditViewMetaParser(); |
|
286 | + $this->dvparser = new DetailViewMetaParser(); |
|
287 | + $this->svparser = new SearchFormMetaParser(); |
|
288 | + |
|
289 | + foreach($this->upgrade_modules as $module_name=>$files) { |
|
290 | + $this->parseFile($module_name, $files); |
|
291 | + } //foreach |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * parseFile |
|
297 | + * Hanldes parsing the files for given module where Studio or manual |
|
298 | + * changes have been detected. |
|
299 | + * @param $module_name The module to parse |
|
300 | + * @param $files Array of files found to parse |
|
301 | + * |
|
302 | + */ |
|
303 | + function parseFile($module_name, $files) { |
|
304 | + global $beanList, $dictionary; |
|
305 | + foreach($files as $file) { |
|
306 | 306 | if(preg_match('/(EditView|DetailView|SearchForm|QuickCreate)(\.html|\.tpl)$/s', $file, $matches)) { |
307 | 307 | $view = $matches[1]; |
308 | 308 | |
309 | 309 | switch($view) { |
310 | - case 'EditView' : $parser = $this->evparser; break; |
|
311 | - case 'DetailView' : $parser = $this->dvparser; break; |
|
312 | - case 'SearchForm' : $parser = $this->svparser; break; |
|
310 | + case 'EditView' : $parser = $this->evparser; break; |
|
311 | + case 'DetailView' : $parser = $this->dvparser; break; |
|
312 | + case 'SearchForm' : $parser = $this->svparser; break; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | $lowerCaseView = $view == 'SearchForm' ? 'search' : strtolower($view); |
316 | 316 | |
317 | - include('modules/'.$module_name.'/vardefs.php'); |
|
318 | - $bean_name = $beanList[$module_name]; |
|
319 | - $newFile = $this->upgrade_dir.'/modules/'.$module_name.'/metadata/'.$lowerCaseView.'defs.php'; |
|
320 | - $evfp = fopen($newFile,'w'); |
|
321 | - |
|
322 | - $bean_name = $bean_name == 'aCase' ? 'Case' : $bean_name; |
|
323 | - fwrite($evfp, $parser->parse($file, |
|
324 | - $dictionary[$bean_name]['fields'], |
|
325 | - $module_name, |
|
326 | - true, |
|
327 | - $this->path_to_master_copy.'/modules/'.$module_name.'/metadata/'.$lowerCaseView.'defs.php')); |
|
328 | - fclose($evfp); |
|
317 | + include('modules/'.$module_name.'/vardefs.php'); |
|
318 | + $bean_name = $beanList[$module_name]; |
|
319 | + $newFile = $this->upgrade_dir.'/modules/'.$module_name.'/metadata/'.$lowerCaseView.'defs.php'; |
|
320 | + $evfp = fopen($newFile,'w'); |
|
321 | + |
|
322 | + $bean_name = $bean_name == 'aCase' ? 'Case' : $bean_name; |
|
323 | + fwrite($evfp, $parser->parse($file, |
|
324 | + $dictionary[$bean_name]['fields'], |
|
325 | + $module_name, |
|
326 | + true, |
|
327 | + $this->path_to_master_copy.'/modules/'.$module_name.'/metadata/'.$lowerCaseView.'defs.php')); |
|
328 | + fclose($evfp); |
|
329 | + } //if |
|
330 | + } //foreach |
|
331 | + } |
|
332 | + |
|
333 | + |
|
334 | + /** |
|
335 | + * create_upgrade_directory |
|
336 | + * Creates a directory called upgrade to house all the modules that are studio enabled. |
|
337 | + * Also creates subdirectories for all studio enabled modules. |
|
338 | + * |
|
339 | + */ |
|
340 | + function create_upgrade_directory() { |
|
341 | + |
|
342 | + $dir = $this->upgrade_dir.'/modules'; |
|
343 | + if(!file_exists($this->upgrade_dir)) { |
|
344 | + mkdir($this->upgrade_dir, 0755); |
|
345 | + } |
|
346 | + if(!file_exists($dir)) { |
|
347 | + mkdir($dir, 0755); |
|
348 | + } |
|
349 | + |
|
350 | + foreach($this->upgrade_modules as $module=>$files){ |
|
351 | + if(!file_exists($dir.'/'.$module)) { |
|
352 | + mkdir($dir.'/'.$module, 0755); |
|
353 | + } |
|
354 | + if(!file_exists($dir.'/'.$module.'/metadata')) { |
|
355 | + mkdir($dir.'/'.$module.'/metadata', 0755); |
|
356 | + } |
|
357 | + |
|
358 | + foreach($files as $file) { |
|
359 | + if(file_exists($file) && is_file($file)) { |
|
360 | + copy($file, $this->upgrade_dir.'/'.$file); |
|
329 | 361 | } //if |
330 | - } //foreach |
|
331 | - } |
|
332 | - |
|
333 | - |
|
334 | - /** |
|
335 | - * create_upgrade_directory |
|
336 | - * Creates a directory called upgrade to house all the modules that are studio enabled. |
|
337 | - * Also creates subdirectories for all studio enabled modules. |
|
338 | - * |
|
339 | - */ |
|
340 | - function create_upgrade_directory() { |
|
341 | - |
|
342 | - $dir = $this->upgrade_dir.'/modules'; |
|
343 | - if(!file_exists($this->upgrade_dir)) { |
|
344 | - mkdir($this->upgrade_dir, 0755); |
|
345 | - } |
|
346 | - if(!file_exists($dir)) { |
|
347 | - mkdir($dir, 0755); |
|
348 | - } |
|
349 | - |
|
350 | - foreach($this->upgrade_modules as $module=>$files){ |
|
351 | - if(!file_exists($dir.'/'.$module)) { |
|
352 | - mkdir($dir.'/'.$module, 0755); |
|
353 | - } |
|
354 | - if(!file_exists($dir.'/'.$module.'/metadata')) { |
|
355 | - mkdir($dir.'/'.$module.'/metadata', 0755); |
|
356 | - } |
|
357 | - |
|
358 | - foreach($files as $file) { |
|
359 | - if(file_exists($file) && is_file($file)) { |
|
360 | - copy($file, $this->upgrade_dir.'/'.$file); |
|
361 | - } //if |
|
362 | - } //foreach |
|
363 | - } |
|
364 | - } |
|
365 | - |
|
366 | - |
|
367 | - /** |
|
368 | - * verifyMetaData |
|
369 | - * This function does some quick checks to make sure the metadataFile at |
|
370 | - * least has an Array panel |
|
371 | - * |
|
372 | - * @param $metadataFile The path to the metadata file to verify |
|
373 | - * @param $module The module to verify |
|
374 | - * @param $view The view (EditView or DetailView) |
|
375 | - * @return boolean true if verification check is okay; false otherwise |
|
376 | - */ |
|
377 | - function verifyMetaData($metadataFile, $module, $view) { |
|
378 | - if(!file_exists($metadataFile) || !is_file($metadataFile)) { |
|
379 | - return false; |
|
380 | - } |
|
381 | - |
|
382 | - include($metadataFile); |
|
383 | - |
|
384 | - if(isset($viewdefs) && isset($viewdefs[$module][$view]['panels']) && is_array($viewdefs[$module][$view]['panels'])) { |
|
385 | - return true; |
|
386 | - } |
|
362 | + } //foreach |
|
363 | + } |
|
364 | + } |
|
365 | + |
|
366 | + |
|
367 | + /** |
|
368 | + * verifyMetaData |
|
369 | + * This function does some quick checks to make sure the metadataFile at |
|
370 | + * least has an Array panel |
|
371 | + * |
|
372 | + * @param $metadataFile The path to the metadata file to verify |
|
373 | + * @param $module The module to verify |
|
374 | + * @param $view The view (EditView or DetailView) |
|
375 | + * @return boolean true if verification check is okay; false otherwise |
|
376 | + */ |
|
377 | + function verifyMetaData($metadataFile, $module, $view) { |
|
378 | + if(!file_exists($metadataFile) || !is_file($metadataFile)) { |
|
379 | + return false; |
|
380 | + } |
|
381 | + |
|
382 | + include($metadataFile); |
|
383 | + |
|
384 | + if(isset($viewdefs) && isset($viewdefs[$module][$view]['panels']) && is_array($viewdefs[$module][$view]['panels'])) { |
|
385 | + return true; |
|
386 | + } |
|
387 | 387 | |
388 | 388 | if(isset($searchdefs) && isset($searchdefs[$module]) && is_array($searchdefs[$module])) { |
389 | - return true; |
|
389 | + return true; |
|
390 | 390 | } |
391 | 391 | |
392 | - return false; |
|
393 | - } |
|
392 | + return false; |
|
393 | + } |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | ?> |
397 | 397 | \ No newline at end of file |
@@ -46,36 +46,36 @@ |
||
46 | 46 | * *******************************************************************************/ |
47 | 47 | |
48 | 48 | if(ob_get_level() < 1) |
49 | - ob_start(); |
|
49 | + ob_start(); |
|
50 | 50 | ob_implicit_flush(1); |
51 | 51 | |
52 | 52 | // load the generated persistence file if found |
53 | 53 | $persistence = array(); |
54 | 54 | if(file_exists($persist = sugar_cached('/modules/UpgradeWizard/_persistence.php'))) { |
55 | - require_once $persist; |
|
55 | + require_once $persist; |
|
56 | 56 | } |
57 | 57 | require_once('modules/UpgradeWizard/uw_utils.php'); |
58 | 58 | |
59 | 59 | switch($_REQUEST['systemCheckStep']) { |
60 | - case 'find_all_files': |
|
61 | - ob_end_flush(); |
|
62 | - $persistence['files_to_check'] = getFilesForPermsCheck(); |
|
60 | + case 'find_all_files': |
|
61 | + ob_end_flush(); |
|
62 | + $persistence['files_to_check'] = getFilesForPermsCheck(); |
|
63 | 63 | break; |
64 | 64 | |
65 | - case 'check_found_files': |
|
66 | - if(empty($persistence['files_to_check'])) { |
|
67 | - logThis('*** ERROR: could not find persistent array of files to check'); |
|
68 | - echo $mod_strings['ERR_UW_NO_FILES']; |
|
69 | - } else { |
|
70 | - ob_end_flush(); |
|
71 | - $persistence = checkFiles($persistence['files_to_check'], true); |
|
72 | - } |
|
73 | - break; |
|
65 | + case 'check_found_files': |
|
66 | + if(empty($persistence['files_to_check'])) { |
|
67 | + logThis('*** ERROR: could not find persistent array of files to check'); |
|
68 | + echo $mod_strings['ERR_UW_NO_FILES']; |
|
69 | + } else { |
|
70 | + ob_end_flush(); |
|
71 | + $persistence = checkFiles($persistence['files_to_check'], true); |
|
72 | + } |
|
73 | + break; |
|
74 | 74 | |
75 | - case 'check_files_status': |
|
76 | - $ret = ($persistence['filesNotWritable']) ? 'true' : 'false'; |
|
77 | - echo $ret; |
|
78 | - break; |
|
75 | + case 'check_files_status': |
|
76 | + $ret = ($persistence['filesNotWritable']) ? 'true' : 'false'; |
|
77 | + echo $ret; |
|
78 | + break; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | write_array_to_file('persistence', $persistence, $persist); |
@@ -45,76 +45,76 @@ discard block |
||
45 | 45 | ini_set('memory_limit',-1); |
46 | 46 | /////////////////////////////////////////////////////////////////////////////// |
47 | 47 | //// UTILITIES THAT MUST BE LOCAL :( |
48 | - //Bug 24890, 24892. default_permissions not written to config.php. Following function checks and if |
|
49 | - //no found then adds default_permissions to the config file. |
|
50 | - function checkConfigForPermissions(){ |
|
51 | - if(file_exists(getcwd().'/config.php')){ |
|
52 | - require(getcwd().'/config.php'); |
|
53 | - } |
|
54 | - global $sugar_config; |
|
55 | - if(!isset($sugar_config['default_permissions'])){ |
|
56 | - $sugar_config['default_permissions'] = array ( |
|
57 | - 'dir_mode' => 02770, |
|
58 | - 'file_mode' => 0660, |
|
59 | - 'user' => '', |
|
60 | - 'group' => '', |
|
61 | - ); |
|
62 | - ksort($sugar_config); |
|
63 | - if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) { |
|
64 | - //writing to the file |
|
65 | - } |
|
66 | - } |
|
48 | + //Bug 24890, 24892. default_permissions not written to config.php. Following function checks and if |
|
49 | + //no found then adds default_permissions to the config file. |
|
50 | + function checkConfigForPermissions(){ |
|
51 | + if(file_exists(getcwd().'/config.php')){ |
|
52 | + require(getcwd().'/config.php'); |
|
53 | + } |
|
54 | + global $sugar_config; |
|
55 | + if(!isset($sugar_config['default_permissions'])){ |
|
56 | + $sugar_config['default_permissions'] = array ( |
|
57 | + 'dir_mode' => 02770, |
|
58 | + 'file_mode' => 0660, |
|
59 | + 'user' => '', |
|
60 | + 'group' => '', |
|
61 | + ); |
|
62 | + ksort($sugar_config); |
|
63 | + if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) { |
|
64 | + //writing to the file |
|
65 | + } |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | function checkLoggerSettings(){ |
70 | - if(file_exists(getcwd().'/config.php')){ |
|
71 | - require(getcwd().'/config.php'); |
|
72 | - } |
|
70 | + if(file_exists(getcwd().'/config.php')){ |
|
71 | + require(getcwd().'/config.php'); |
|
72 | + } |
|
73 | 73 | global $sugar_config; |
74 | - if(!isset($sugar_config['logger'])){ |
|
75 | - $sugar_config['logger'] =array ( |
|
76 | - 'level'=>'fatal', |
|
77 | - 'file' => |
|
78 | - array ( |
|
79 | - 'ext' => '.log', |
|
80 | - 'name' => 'sugarcrm', |
|
81 | - 'dateFormat' => '%c', |
|
82 | - 'maxSize' => '10MB', |
|
83 | - 'maxLogs' => 10, |
|
84 | - 'suffix' => '', // bug51583, change default suffix to blank for backwards comptability |
|
85 | - ), |
|
86 | - ); |
|
87 | - ksort($sugar_config); |
|
88 | - if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) { |
|
89 | - //writing to the file |
|
90 | - } |
|
91 | - } |
|
74 | + if(!isset($sugar_config['logger'])){ |
|
75 | + $sugar_config['logger'] =array ( |
|
76 | + 'level'=>'fatal', |
|
77 | + 'file' => |
|
78 | + array ( |
|
79 | + 'ext' => '.log', |
|
80 | + 'name' => 'sugarcrm', |
|
81 | + 'dateFormat' => '%c', |
|
82 | + 'maxSize' => '10MB', |
|
83 | + 'maxLogs' => 10, |
|
84 | + 'suffix' => '', // bug51583, change default suffix to blank for backwards comptability |
|
85 | + ), |
|
86 | + ); |
|
87 | + ksort($sugar_config); |
|
88 | + if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) { |
|
89 | + //writing to the file |
|
90 | + } |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | function checkResourceSettings(){ |
95 | - if(file_exists(getcwd().'/config.php')){ |
|
96 | - require(getcwd().'/config.php'); |
|
97 | - } |
|
95 | + if(file_exists(getcwd().'/config.php')){ |
|
96 | + require(getcwd().'/config.php'); |
|
97 | + } |
|
98 | 98 | global $sugar_config; |
99 | - if(!isset($sugar_config['resource_management'])){ |
|
100 | - $sugar_config['resource_management'] = |
|
101 | - array ( |
|
102 | - 'special_query_limit' => 50000, |
|
103 | - 'special_query_modules' => |
|
104 | - array ( |
|
105 | - 0 => 'Reports', |
|
106 | - 1 => 'Export', |
|
107 | - 2 => 'Import', |
|
108 | - 3 => 'Administration', |
|
109 | - 4 => 'Sync', |
|
110 | - ), |
|
111 | - 'default_limit' => 1000, |
|
112 | - ); |
|
113 | - ksort($sugar_config); |
|
114 | - if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) { |
|
115 | - //writing to the file |
|
116 | - } |
|
117 | - } |
|
99 | + if(!isset($sugar_config['resource_management'])){ |
|
100 | + $sugar_config['resource_management'] = |
|
101 | + array ( |
|
102 | + 'special_query_limit' => 50000, |
|
103 | + 'special_query_modules' => |
|
104 | + array ( |
|
105 | + 0 => 'Reports', |
|
106 | + 1 => 'Export', |
|
107 | + 2 => 'Import', |
|
108 | + 3 => 'Administration', |
|
109 | + 4 => 'Sync', |
|
110 | + ), |
|
111 | + 'default_limit' => 1000, |
|
112 | + ); |
|
113 | + ksort($sugar_config); |
|
114 | + if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) { |
|
115 | + //writing to the file |
|
116 | + } |
|
117 | + } |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | |
172 | 172 | function rebuildRelations($pre_path = '') |
173 | 173 | { |
174 | - $_REQUEST['silent'] = true; |
|
175 | - include($pre_path.'modules/Administration/RebuildRelationship.php'); |
|
176 | - $_REQUEST['upgradeWizard'] = true; |
|
177 | - include($pre_path.'modules/ACL/install_actions.php'); |
|
174 | + $_REQUEST['silent'] = true; |
|
175 | + include($pre_path.'modules/Administration/RebuildRelationship.php'); |
|
176 | + $_REQUEST['upgradeWizard'] = true; |
|
177 | + include($pre_path.'modules/ACL/install_actions.php'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | //Bug 52872. Dies if the request does not come from CLI. |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | |
187 | 187 | // only run from command line |
188 | 188 | if(isset($_SERVER['HTTP_USER_AGENT'])) { |
189 | - fwrite(STDERR,'This utility may only be run from the command line or command prompt.'); |
|
190 | - exit(1); |
|
189 | + fwrite(STDERR,'This utility may only be run from the command line or command prompt.'); |
|
190 | + exit(1); |
|
191 | 191 | } |
192 | 192 | //Clean_string cleans out any file passed in as a parameter |
193 | 193 | $_SERVER['PHP_SELF'] = 'silentUpgrade.php'; |
@@ -248,60 +248,60 @@ discard block |
||
248 | 248 | $isDCEInstance = false; |
249 | 249 | $errors = array(); |
250 | 250 | |
251 | - require('config.php'); |
|
252 | - if(isset($argv[3])) { |
|
253 | - if(is_dir($argv[3])) { |
|
254 | - $cwd = $argv[3]; |
|
255 | - chdir($cwd); |
|
256 | - } |
|
257 | - } |
|
251 | + require('config.php'); |
|
252 | + if(isset($argv[3])) { |
|
253 | + if(is_dir($argv[3])) { |
|
254 | + $cwd = $argv[3]; |
|
255 | + chdir($cwd); |
|
256 | + } |
|
257 | + } |
|
258 | 258 | |
259 | - require_once("{$cwd}/sugar_version.php"); // provides $sugar_version & $sugar_flavor |
|
259 | + require_once("{$cwd}/sugar_version.php"); // provides $sugar_version & $sugar_flavor |
|
260 | 260 | |
261 | - global $sugar_config; |
|
262 | - $configOptions = $sugar_config['dbconfig']; |
|
261 | + global $sugar_config; |
|
262 | + $configOptions = $sugar_config['dbconfig']; |
|
263 | 263 | |
264 | 264 | $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM'); |
265 | - $patchName = basename($argv[1]); |
|
266 | - $zip_from_dir = substr($patchName, 0, strlen($patchName) - 4); // patch folder name (minus ".zip") |
|
267 | - $path = $argv[2]; // custom log file, if blank will use ./upgradeWizard.log |
|
265 | + $patchName = basename($argv[1]); |
|
266 | + $zip_from_dir = substr($patchName, 0, strlen($patchName) - 4); // patch folder name (minus ".zip") |
|
267 | + $path = $argv[2]; // custom log file, if blank will use ./upgradeWizard.log |
|
268 | 268 | $db = &DBManagerFactory::getInstance(); |
269 | - $UWstrings = return_module_language('en_us', 'UpgradeWizard', true); |
|
270 | - $adminStrings = return_module_language('en_us', 'Administration', true); |
|
269 | + $UWstrings = return_module_language('en_us', 'UpgradeWizard', true); |
|
270 | + $adminStrings = return_module_language('en_us', 'Administration', true); |
|
271 | 271 | $app_list_strings = return_app_list_strings_language('en_us'); |
272 | - $mod_strings = array_merge($adminStrings, $UWstrings); |
|
273 | - $subdirs = array('full', 'langpack', 'module', 'patch', 'theme', 'temp'); |
|
274 | - global $unzip_dir; |
|
272 | + $mod_strings = array_merge($adminStrings, $UWstrings); |
|
273 | + $subdirs = array('full', 'langpack', 'module', 'patch', 'theme', 'temp'); |
|
274 | + global $unzip_dir; |
|
275 | 275 | $license_accepted = false; |
276 | 276 | if(isset($argv[5]) && (strtolower($argv[5])=='yes' || strtolower($argv[5])=='y')){ |
277 | - $license_accepted = true; |
|
278 | - } |
|
279 | - ////////////////////////////////////////////////////////////////////////////// |
|
280 | - //Adding admin user to the silent upgrade |
|
281 | - |
|
282 | - $current_user = new User(); |
|
283 | - if(isset($argv[4])) { |
|
284 | - //if being used for internal upgrades avoid admin user verification |
|
285 | - $user_name = $argv[4]; |
|
286 | - $q = "select id from users where user_name = '" . $user_name . "' and is_admin=1"; |
|
287 | - $result = $GLOBALS['db']->query($q, false); |
|
288 | - $logged_user = $GLOBALS['db']->fetchByAssoc($result); |
|
289 | - if(isset($logged_user['id']) && $logged_user['id'] != null){ |
|
290 | - //do nothing |
|
291 | - $current_user->retrieve($logged_user['id']); |
|
292 | - } |
|
293 | - else{ |
|
294 | - echo "Not an admin user in users table. Please provide an admin user\n"; |
|
295 | - exit(1); |
|
296 | - } |
|
297 | - } |
|
298 | - else { |
|
299 | - echo "*******************************************************************************\n"; |
|
300 | - echo "*** ERROR: 4th parameter must be a valid admin user.\n"; |
|
301 | - echo $usage; |
|
302 | - echo "FAILURE\n"; |
|
303 | - exit(1); |
|
304 | - } |
|
277 | + $license_accepted = true; |
|
278 | + } |
|
279 | + ////////////////////////////////////////////////////////////////////////////// |
|
280 | + //Adding admin user to the silent upgrade |
|
281 | + |
|
282 | + $current_user = new User(); |
|
283 | + if(isset($argv[4])) { |
|
284 | + //if being used for internal upgrades avoid admin user verification |
|
285 | + $user_name = $argv[4]; |
|
286 | + $q = "select id from users where user_name = '" . $user_name . "' and is_admin=1"; |
|
287 | + $result = $GLOBALS['db']->query($q, false); |
|
288 | + $logged_user = $GLOBALS['db']->fetchByAssoc($result); |
|
289 | + if(isset($logged_user['id']) && $logged_user['id'] != null){ |
|
290 | + //do nothing |
|
291 | + $current_user->retrieve($logged_user['id']); |
|
292 | + } |
|
293 | + else{ |
|
294 | + echo "Not an admin user in users table. Please provide an admin user\n"; |
|
295 | + exit(1); |
|
296 | + } |
|
297 | + } |
|
298 | + else { |
|
299 | + echo "*******************************************************************************\n"; |
|
300 | + echo "*** ERROR: 4th parameter must be a valid admin user.\n"; |
|
301 | + echo $usage; |
|
302 | + echo "FAILURE\n"; |
|
303 | + exit(1); |
|
304 | + } |
|
305 | 305 | |
306 | 306 | /////retrieve admin user |
307 | 307 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | mkdir_recursive($unzip_dir); |
317 | 317 | if(!is_dir($unzip_dir)) { |
318 | - fwrite(STDERR,"\n{$unzip_dir} is not an available directory\nFAILURE\n"); |
|
318 | + fwrite(STDERR,"\n{$unzip_dir} is not an available directory\nFAILURE\n"); |
|
319 | 319 | exit(1); |
320 | 320 | } |
321 | 321 | unzip($argv[1], $unzip_dir); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | |
328 | 328 | if(function_exists('set_upgrade_vars')){ |
329 | - set_upgrade_vars(); |
|
329 | + set_upgrade_vars(); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /////////////////////////////////////////////////////////////////////////////// |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | logThis('Upgrading user preferences start .', $path); |
352 | 352 | if(function_exists('upgradeUserPreferences')){ |
353 | - upgradeUserPreferences(); |
|
353 | + upgradeUserPreferences(); |
|
354 | 354 | } |
355 | 355 | logThis('Upgrading user preferences finish .', $path); |
356 | 356 | |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | //Add the cache cleaning here. |
375 | 375 | if(function_exists('deleteCache')) |
376 | 376 | { |
377 | - logThis('Call deleteCache', $path); |
|
378 | - @deleteCache(); |
|
377 | + logThis('Call deleteCache', $path); |
|
378 | + @deleteCache(); |
|
379 | 379 | } |
380 | 380 | /* |
381 | 381 | // creating full text search logic hooks |
@@ -418,50 +418,50 @@ discard block |
||
418 | 418 | |
419 | 419 | $repairedTables = array(); |
420 | 420 | foreach ($beanFiles as $bean => $file) { |
421 | - if(file_exists($file)){ |
|
422 | - unset($GLOBALS['dictionary'][$bean]); |
|
423 | - require_once($file); |
|
424 | - $focus = new $bean (); |
|
425 | - if(empty($focus->table_name) || isset($repairedTables[$focus->table_name])) { |
|
426 | - continue; |
|
427 | - } |
|
428 | - |
|
429 | - if (($focus instanceOf SugarBean)) { |
|
430 | - if(!isset($repairedTables[$focus->table_name])) |
|
431 | - { |
|
432 | - $sql = $GLOBALS['db']->repairTable($focus, true); |
|
421 | + if(file_exists($file)){ |
|
422 | + unset($GLOBALS['dictionary'][$bean]); |
|
423 | + require_once($file); |
|
424 | + $focus = new $bean (); |
|
425 | + if(empty($focus->table_name) || isset($repairedTables[$focus->table_name])) { |
|
426 | + continue; |
|
427 | + } |
|
428 | + |
|
429 | + if (($focus instanceOf SugarBean)) { |
|
430 | + if(!isset($repairedTables[$focus->table_name])) |
|
431 | + { |
|
432 | + $sql = $GLOBALS['db']->repairTable($focus, true); |
|
433 | 433 | if(trim($sql) != '') |
434 | 434 | { |
435 | - logThis('Running sql:' . $sql, $path); |
|
435 | + logThis('Running sql:' . $sql, $path); |
|
436 | 436 | } |
437 | - $repairedTables[$focus->table_name] = true; |
|
438 | - } |
|
437 | + $repairedTables[$focus->table_name] = true; |
|
438 | + } |
|
439 | 439 | |
440 | - //Check to see if we need to create the audit table |
|
441 | - if($focus->is_AuditEnabled() && !$focus->db->tableExists($focus->get_audit_table_name())){ |
|
442 | - logThis('Creating audit table:' . $focus->get_audit_table_name(), $path); |
|
443 | - $focus->create_audit_table(); |
|
440 | + //Check to see if we need to create the audit table |
|
441 | + if($focus->is_AuditEnabled() && !$focus->db->tableExists($focus->get_audit_table_name())){ |
|
442 | + logThis('Creating audit table:' . $focus->get_audit_table_name(), $path); |
|
443 | + $focus->create_audit_table(); |
|
444 | 444 | } |
445 | - } |
|
446 | - } |
|
445 | + } |
|
446 | + } |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | unset ($dictionary); |
450 | 450 | include ("{$argv[3]}/modules/TableDictionary.php"); |
451 | 451 | foreach ($dictionary as $meta) { |
452 | - $tablename = $meta['table']; |
|
452 | + $tablename = $meta['table']; |
|
453 | 453 | |
454 | - if(isset($repairedTables[$tablename])) { |
|
455 | - continue; |
|
456 | - } |
|
454 | + if(isset($repairedTables[$tablename])) { |
|
455 | + continue; |
|
456 | + } |
|
457 | 457 | |
458 | - $fielddefs = $meta['fields']; |
|
459 | - $indices = $meta['indices']; |
|
460 | - $sql = $GLOBALS['db']->repairTableParams($tablename, $fielddefs, $indices, true); |
|
461 | - if(!empty($sql)) { |
|
462 | - logThis($sql, $path); |
|
463 | - $repairedTables[$tablename] = true; |
|
464 | - } |
|
458 | + $fielddefs = $meta['fields']; |
|
459 | + $indices = $meta['indices']; |
|
460 | + $sql = $GLOBALS['db']->repairTableParams($tablename, $fielddefs, $indices, true); |
|
461 | + if(!empty($sql)) { |
|
462 | + logThis($sql, $path); |
|
463 | + $repairedTables[$tablename] = true; |
|
464 | + } |
|
465 | 465 | |
466 | 466 | } |
467 | 467 | |
@@ -482,18 +482,18 @@ discard block |
||
482 | 482 | |
483 | 483 | |
484 | 484 | if($ce_to_pro_ent) { |
485 | - //add the global team if it does not exist |
|
486 | - $globalteam = new Team(); |
|
487 | - $globalteam->retrieve('1'); |
|
488 | - require_once($unzip_dir.'/'.$zip_from_dir.'/modules/Administration/language/en_us.lang.php'); |
|
489 | - if(isset($globalteam->name)){ |
|
490 | - echo 'Global '.$mod_strings['LBL_UPGRADE_TEAM_EXISTS'].'<br>'; |
|
491 | - logThis(" Finish Building Global Team", $path); |
|
492 | - }else{ |
|
493 | - $globalteam->create_team("Global", $mod_strings['LBL_GLOBAL_TEAM_DESC'], $globalteam->global_team); |
|
494 | - } |
|
495 | - |
|
496 | - logThis(" Start Building private teams", $path); |
|
485 | + //add the global team if it does not exist |
|
486 | + $globalteam = new Team(); |
|
487 | + $globalteam->retrieve('1'); |
|
488 | + require_once($unzip_dir.'/'.$zip_from_dir.'/modules/Administration/language/en_us.lang.php'); |
|
489 | + if(isset($globalteam->name)){ |
|
490 | + echo 'Global '.$mod_strings['LBL_UPGRADE_TEAM_EXISTS'].'<br>'; |
|
491 | + logThis(" Finish Building Global Team", $path); |
|
492 | + }else{ |
|
493 | + $globalteam->create_team("Global", $mod_strings['LBL_GLOBAL_TEAM_DESC'], $globalteam->global_team); |
|
494 | + } |
|
495 | + |
|
496 | + logThis(" Start Building private teams", $path); |
|
497 | 497 | |
498 | 498 | upgradeModulesForTeam(); |
499 | 499 | logThis(" Finish Building private teams", $path); |
@@ -502,12 +502,12 @@ discard block |
||
502 | 502 | upgradeModulesForTeamsets(); |
503 | 503 | logThis(" Finish Building the team_set and team_sets_teams", $path); |
504 | 504 | |
505 | - logThis(" Start modules/Administration/upgradeTeams.php", $path); |
|
505 | + logThis(" Start modules/Administration/upgradeTeams.php", $path); |
|
506 | 506 | include('modules/Administration/upgradeTeams.php'); |
507 | 507 | logThis(" Finish modules/Administration/upgradeTeams.php", $path); |
508 | 508 | |
509 | 509 | if(check_FTS()){ |
510 | - $GLOBALS['db']->full_text_indexing_setup(); |
|
510 | + $GLOBALS['db']->full_text_indexing_setup(); |
|
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | //Unlink files that have been removed |
526 | 526 | if(function_exists('unlinkUpgradeFiles')) |
527 | 527 | { |
528 | - unlinkUpgradeFiles($sugar_version); |
|
528 | + unlinkUpgradeFiles($sugar_version); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | if(function_exists('rebuildSprites') && function_exists('imagecreatetruecolor')) |
@@ -542,11 +542,11 @@ discard block |
||
542 | 542 | /////////////////////////////////////////////////////////////////////////////// |
543 | 543 | //// TAKE OUT TRASH |
544 | 544 | if(empty($errors)) { |
545 | - set_upgrade_progress('end','in_progress','unlinkingfiles','in_progress'); |
|
546 | - logThis('Taking out the trash, unlinking temp files.', $path); |
|
547 | - unlinkUWTempFiles(); |
|
548 | - removeSilentUpgradeVarsCache(); |
|
549 | - logThis('Taking out the trash, done.', $path); |
|
545 | + set_upgrade_progress('end','in_progress','unlinkingfiles','in_progress'); |
|
546 | + logThis('Taking out the trash, unlinking temp files.', $path); |
|
547 | + unlinkUWTempFiles(); |
|
548 | + removeSilentUpgradeVarsCache(); |
|
549 | + logThis('Taking out the trash, done.', $path); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | /////////////////////////////////////////////////////////////////////////////// |
@@ -557,20 +557,20 @@ discard block |
||
557 | 557 | logThis("**** Potential PHP generated error messages: {$phpErrors}", $path); |
558 | 558 | |
559 | 559 | if(count($errors) > 0) { |
560 | - foreach($errors as $error) { |
|
561 | - logThis("****** SilentUpgrade ERROR: {$error}", $path); |
|
562 | - } |
|
563 | - echo "FAILED\n"; |
|
560 | + foreach($errors as $error) { |
|
561 | + logThis("****** SilentUpgrade ERROR: {$error}", $path); |
|
562 | + } |
|
563 | + echo "FAILED\n"; |
|
564 | 564 | } else { |
565 | - logThis("***** SilentUpgrade completed successfully.", $path); |
|
566 | - echo "********************************************************************\n"; |
|
567 | - echo "*************************** SUCCESS*********************************\n"; |
|
568 | - echo "********************************************************************\n"; |
|
569 | - echo "******** If your pre-upgrade Leads data is not showing ************\n"; |
|
570 | - echo "******** Or you see errors in detailview subpanels ****************\n"; |
|
571 | - echo "************* In order to resolve them ****************************\n"; |
|
572 | - echo "******** Log into application as Administrator ********************\n"; |
|
573 | - echo "******** Go to Admin panel ****************************************\n"; |
|
574 | - echo "******** Run Repair -> Rebuild Relationships **********************\n"; |
|
575 | - echo "********************************************************************\n"; |
|
565 | + logThis("***** SilentUpgrade completed successfully.", $path); |
|
566 | + echo "********************************************************************\n"; |
|
567 | + echo "*************************** SUCCESS*********************************\n"; |
|
568 | + echo "********************************************************************\n"; |
|
569 | + echo "******** If your pre-upgrade Leads data is not showing ************\n"; |
|
570 | + echo "******** Or you see errors in detailview subpanels ****************\n"; |
|
571 | + echo "************* In order to resolve them ****************************\n"; |
|
572 | + echo "******** Log into application as Administrator ********************\n"; |
|
573 | + echo "******** Go to Admin panel ****************************************\n"; |
|
574 | + echo "******** Run Repair -> Rebuild Relationships **********************\n"; |
|
575 | + echo "********************************************************************\n"; |
|
576 | 576 | } |
@@ -46,40 +46,40 @@ |
||
46 | 46 | * *******************************************************************************/ |
47 | 47 | |
48 | 48 | if(ob_get_level() < 1) |
49 | - ob_start(); |
|
49 | + ob_start(); |
|
50 | 50 | ob_implicit_flush(1); |
51 | 51 | |
52 | 52 | // load the generated persistence file if found |
53 | 53 | $persistence = array(); |
54 | 54 | if(file_exists($persist = sugar_cached('/modules/UpgradeWizard/_persistence.php'))) { |
55 | - require_once $persist; |
|
55 | + require_once $persist; |
|
56 | 56 | } |
57 | 57 | require_once('modules/UpgradeWizard/uw_utils.php'); |
58 | 58 | require_once('include/utils/zip_utils.php'); |
59 | 59 | |
60 | 60 | switch($_REQUEST['preflightStep']) { |
61 | - case 'find_upgrade_files': |
|
62 | - logThis('preflightJson finding upgrade files'); |
|
63 | - ob_end_flush(); |
|
64 | - $persistence['upgrade_files'] = preflightCheckJsonFindUpgradeFiles(); |
|
65 | - break; |
|
61 | + case 'find_upgrade_files': |
|
62 | + logThis('preflightJson finding upgrade files'); |
|
63 | + ob_end_flush(); |
|
64 | + $persistence['upgrade_files'] = preflightCheckJsonFindUpgradeFiles(); |
|
65 | + break; |
|
66 | 66 | |
67 | - case 'diff_upgrade_files': |
|
68 | - logThis('preflightJson diffing upgrade files'); |
|
69 | - ob_end_flush(); |
|
70 | - $persistence = preflightCheckJsonDiffFiles(); |
|
71 | - break; |
|
67 | + case 'diff_upgrade_files': |
|
68 | + logThis('preflightJson diffing upgrade files'); |
|
69 | + ob_end_flush(); |
|
70 | + $persistence = preflightCheckJsonDiffFiles(); |
|
71 | + break; |
|
72 | 72 | |
73 | - case 'get_diff_results': |
|
74 | - logThis('preflightJson getting diff results for display'); |
|
75 | - ob_end_flush(); |
|
76 | - $persistence = preflightCheckJsonGetDiff(); |
|
77 | - break; |
|
73 | + case 'get_diff_results': |
|
74 | + logThis('preflightJson getting diff results for display'); |
|
75 | + ob_end_flush(); |
|
76 | + $persistence = preflightCheckJsonGetDiff(); |
|
77 | + break; |
|
78 | 78 | |
79 | - case 'get_diff_errors': |
|
80 | - logThis('preflightJson getting diff errors (if any)'); |
|
81 | - preflightCheckJsonGetDiffErrors(); |
|
82 | - break; |
|
79 | + case 'get_diff_errors': |
|
80 | + logThis('preflightJson getting diff errors (if any)'); |
|
81 | + preflightCheckJsonGetDiffErrors(); |
|
82 | + break; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | write_array_to_file('persistence', $persistence, $persist); |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | - //Request object must have these property values: |
|
42 | - // Module: module name, this module should have a file called TreeData.php |
|
43 | - // Function: name of the function to be called in TreeData.php, the function will be called statically. |
|
44 | - // PARAM prefixed properties: array of these property/values will be passed to the function as parameter. |
|
41 | + //Request object must have these property values: |
|
42 | + // Module: module name, this module should have a file called TreeData.php |
|
43 | + // Function: name of the function to be called in TreeData.php, the function will be called statically. |
|
44 | + // PARAM prefixed properties: array of these property/values will be passed to the function as parameter. |
|
45 | 45 | |
46 | 46 | require_once('include/JSON.php'); |
47 | 47 | require_once('include/upload_file.php'); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | $json = getJSONobj(); |
52 | 52 | $file_name = $json->decode(html_entity_decode($_REQUEST['file_name'])); |
53 | - if(isset($file_name['jsonObject']) && $file_name['jsonObject'] != null){ |
|
54 | - $file_name = $file_name['jsonObject']; |
|
55 | - } |
|
53 | + if(isset($file_name['jsonObject']) && $file_name['jsonObject'] != null){ |
|
54 | + $file_name = $file_name['jsonObject']; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | $filesize = ''; |
58 | 58 | if(file_exists($file_name)){ |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | //$uploadSizeIni = substr(ini_get("upload_max_filesize"), 0, strlen( ini_get("upload_max_filesize")) - 1); |
74 | 74 | //$GLOBALS['log']->fatal('Upload php setting Size '.return_bytes(ini_get("upload_max_filesize"))); |
75 | 75 | if($filesize != null){ |
76 | - if(($filesize > return_bytes(ini_get("upload_max_filesize"))) || ($filesize > return_bytes(ini_get("post_max_size")))){ |
|
77 | - $response=$filesize; |
|
78 | - //$response= "<script>alert('File size is bigger than the max_upload-size setting in php.ini. Upgrade attempt will fail. Increase the upload_max_size in php.ini to greater than ')</script>"; |
|
79 | - } |
|
76 | + if(($filesize > return_bytes(ini_get("upload_max_filesize"))) || ($filesize > return_bytes(ini_get("post_max_size")))){ |
|
77 | + $response=$filesize; |
|
78 | + //$response= "<script>alert('File size is bigger than the max_upload-size setting in php.ini. Upgrade attempt will fail. Increase the upload_max_size in php.ini to greater than ')</script>"; |
|
79 | + } |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if (!empty($response)) { |
@@ -72,18 +72,18 @@ |
||
72 | 72 | } |
73 | 73 | */ |
74 | 74 | |
75 | - $_SESSION['totalUpgradeTime'] = $_SESSION['totalUpgradeTime']+$_REQUEST['upgradeStepTime']; |
|
76 | - $response = $_SESSION['totalUpgradeTime']; |
|
75 | + $_SESSION['totalUpgradeTime'] = $_SESSION['totalUpgradeTime']+$_REQUEST['upgradeStepTime']; |
|
76 | + $response = $_SESSION['totalUpgradeTime']; |
|
77 | 77 | |
78 | 78 | $GLOBALS['log']->fatal('TOTAL TIME .....'.$_SESSION['totalUpgradeTime']); |
79 | - //$uptime = $uptime+$_REQUEST['upgradeStepTime']; |
|
80 | - $GLOBALS['log']->fatal($response); |
|
79 | + //$uptime = $uptime+$_REQUEST['upgradeStepTime']; |
|
80 | + $GLOBALS['log']->fatal($response); |
|
81 | 81 | |
82 | 82 | |
83 | - if (!empty($response)) { |
|
83 | + if (!empty($response)) { |
|
84 | 84 | $json = getJSONobj(); |
85 | - print $json->encode($response); |
|
86 | - } |
|
85 | + print $json->encode($response); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | sugar_cleanup(); |
89 | 89 | exit(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function getFilesToRemove($version) |
70 | 70 | { |
71 | - return array(); |
|
71 | + return array(); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -79,31 +79,31 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function processFilesToRemove($files=array()) |
81 | 81 | { |
82 | - if(empty($files) || !is_array($files)) |
|
83 | - { |
|
84 | - return; |
|
85 | - } |
|
82 | + if(empty($files) || !is_array($files)) |
|
83 | + { |
|
84 | + return; |
|
85 | + } |
|
86 | 86 | |
87 | - require_once('include/dir_inc.php'); |
|
87 | + require_once('include/dir_inc.php'); |
|
88 | 88 | |
89 | - if(!file_exists('custom/backup')) |
|
90 | - { |
|
91 | - mkdir_recursive('custom/backup'); |
|
92 | - } |
|
89 | + if(!file_exists('custom/backup')) |
|
90 | + { |
|
91 | + mkdir_recursive('custom/backup'); |
|
92 | + } |
|
93 | 93 | |
94 | - foreach($files as $file) |
|
95 | - { |
|
96 | - if(file_exists($file)) |
|
97 | - { |
|
98 | - $this->backup($file); |
|
99 | - if(is_dir($file)) |
|
100 | - { |
|
101 | - rmdir_recursive($file); |
|
102 | - } else { |
|
103 | - unlink($file); |
|
104 | - } |
|
105 | - } |
|
106 | - } |
|
94 | + foreach($files as $file) |
|
95 | + { |
|
96 | + if(file_exists($file)) |
|
97 | + { |
|
98 | + $this->backup($file); |
|
99 | + if(is_dir($file)) |
|
100 | + { |
|
101 | + rmdir_recursive($file); |
|
102 | + } else { |
|
103 | + unlink($file); |
|
104 | + } |
|
105 | + } |
|
106 | + } |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -115,20 +115,20 @@ discard block |
||
115 | 115 | */ |
116 | 116 | protected function backup($file) |
117 | 117 | { |
118 | - $basename = basename($file); |
|
119 | - $basepath = str_replace($basename, '', $file); |
|
118 | + $basename = basename($file); |
|
119 | + $basepath = str_replace($basename, '', $file); |
|
120 | 120 | |
121 | - if(!empty($basepath) && !file_exists('custom/backup/' . $basepath)) |
|
122 | - { |
|
123 | - mkdir_recursive('custom/backup/' . $basepath); |
|
124 | - } |
|
121 | + if(!empty($basepath) && !file_exists('custom/backup/' . $basepath)) |
|
122 | + { |
|
123 | + mkdir_recursive('custom/backup/' . $basepath); |
|
124 | + } |
|
125 | 125 | |
126 | - if(is_dir($file)) |
|
127 | - { |
|
128 | - copy_recursive($file, 'custom/backup/' . $file); |
|
129 | - } else { |
|
130 | - copy($file, 'custom/backup/' . $file); |
|
131 | - } |
|
126 | + if(is_dir($file)) |
|
127 | + { |
|
128 | + copy_recursive($file, 'custom/backup/' . $file); |
|
129 | + } else { |
|
130 | + copy($file, 'custom/backup/' . $file); |
|
131 | + } |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | } |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | - //Request object must have these property values: |
|
42 | - // Module: module name, this module should have a file called TreeData.php |
|
43 | - // Function: name of the function to be called in TreeData.php, the function will be called statically. |
|
44 | - // PARAM prefixed properties: array of these property/values will be passed to the function as parameter. |
|
41 | + //Request object must have these property values: |
|
42 | + // Module: module name, this module should have a file called TreeData.php |
|
43 | + // Function: name of the function to be called in TreeData.php, the function will be called statically. |
|
44 | + // PARAM prefixed properties: array of these property/values will be passed to the function as parameter. |
|
45 | 45 | |
46 | 46 | require_once('include/JSON.php'); |
47 | 47 | require_once('include/entryPoint.php'); |
@@ -52,25 +52,25 @@ discard block |
||
52 | 52 | |
53 | 53 | $json = getJSONobj(); |
54 | 54 | $selectedTable = $json->decode(html_entity_decode($_REQUEST['selectedTable'])); |
55 | - if(isset($tagArticleIds['jsonObject']) && $tagArticleIds['jsonObject'] != null){ |
|
56 | - $selectedTable = $selectedTable['jsonObject']; |
|
57 | - } |
|
55 | + if(isset($tagArticleIds['jsonObject']) && $tagArticleIds['jsonObject'] != null){ |
|
56 | + $selectedTable = $selectedTable['jsonObject']; |
|
57 | + } |
|
58 | 58 | $GLOBALS['log']->fatal('************ comes here *********'); |
59 | 59 | //$GLOBALS['log']->fatal($_REQUEST['selectedTable']); |
60 | 60 | function tableColumns($table_name){ |
61 | - $GLOBALS['log']->fatal('********TABLE PASSED******* '.$table_name); |
|
62 | - global $sugar_config; |
|
63 | - global $setup_db_database_name; |
|
61 | + $GLOBALS['log']->fatal('********TABLE PASSED******* '.$table_name); |
|
62 | + global $sugar_config; |
|
63 | + global $setup_db_database_name; |
|
64 | 64 | global $setup_db_host_name; |
65 | 65 | global $setup_db_host_instance; |
66 | 66 | global $setup_db_admin_user_name; |
67 | 67 | global $setup_db_admin_password; |
68 | 68 | |
69 | - //$db = &DBManagerFactory::getInstance('information_schema'); |
|
69 | + //$db = &DBManagerFactory::getInstance('information_schema'); |
|
70 | 70 | |
71 | - $db_name= $sugar_config['dbconfig']['db_name']; |
|
72 | - $setup_db_host_name = $sugar_config['dbconfig']['db_host_name']; |
|
73 | - $setup_db_admin_user_name = $sugar_config['dbconfig']['db_user_name']; |
|
71 | + $db_name= $sugar_config['dbconfig']['db_name']; |
|
72 | + $setup_db_host_name = $sugar_config['dbconfig']['db_host_name']; |
|
73 | + $setup_db_admin_user_name = $sugar_config['dbconfig']['db_user_name']; |
|
74 | 74 | $setup_db_host_instance = $sugar_config['dbconfig']['db_host_instance']; |
75 | 75 | $setup_db_admin_password = $sugar_config['dbconfig']['db_password']; |
76 | 76 | |
@@ -78,27 +78,27 @@ discard block |
||
78 | 78 | mysql_select_db('information_schema'); |
79 | 79 | |
80 | 80 | $qu="SELECT column_name FROM information_schema.columns WHERE table_schema = '".$db_name."' AND table_name = '".$table_name."'"; |
81 | - $ct =mysql_query($qu,$link); |
|
81 | + $ct =mysql_query($qu,$link); |
|
82 | 82 | //$cols= ''; |
83 | 83 | $colsDrop = array(); |
84 | 84 | while($row = mysql_fetch_assoc($ct)){ |
85 | - $colsDrop[] =$row['column_name']; |
|
85 | + $colsDrop[] =$row['column_name']; |
|
86 | 86 | } |
87 | 87 | return $colsDrop; |
88 | 88 | } |
89 | 89 | |
90 | 90 | $colsDrop = tableColumns($_REQUEST['selectedTable']); |
91 | 91 | if($colsDrop != null){ |
92 | - $colsDropDown = "<option value=".$_REQUEST['selectedTable']." Columns>".$_REQUEST['selectedTable']." Columns</option>"; |
|
93 | - foreach($colsDrop as $col){ |
|
94 | - $colsDropDown .="<option value={$col}>{$col}</option>"; |
|
95 | - } |
|
92 | + $colsDropDown = "<option value=".$_REQUEST['selectedTable']." Columns>".$_REQUEST['selectedTable']." Columns</option>"; |
|
93 | + foreach($colsDrop as $col){ |
|
94 | + $colsDropDown .="<option value={$col}>{$col}</option>"; |
|
95 | + } |
|
96 | 96 | } |
97 | 97 | //$response = "<script>document.getElementById('select_column').innerHTML=$colsDropDown</script>"; |
98 | 98 | $response = $colsDropDown; |
99 | 99 | |
100 | 100 | if (!empty($response)) { |
101 | - echo $response; |
|
101 | + echo $response; |
|
102 | 102 | } |
103 | 103 | sugar_cleanup(); |
104 | 104 | exit(); |
@@ -35,29 +35,29 @@ discard block |
||
35 | 35 | ********************************************************************************/ |
36 | 36 | |
37 | 37 | function build_argument_string($arguments=array()) { |
38 | - if(!is_array($arguments)) { |
|
39 | - return ''; |
|
40 | - } |
|
38 | + if(!is_array($arguments)) { |
|
39 | + return ''; |
|
40 | + } |
|
41 | 41 | |
42 | - $argument_string = ''; |
|
43 | - $count = 0; |
|
44 | - foreach($arguments as $arg) { |
|
45 | - if($count != 0) |
|
46 | - { |
|
47 | - //If current directory or parent directory is specified, substitute with full path |
|
48 | - if($arg == '.') |
|
49 | - { |
|
50 | - $arg = getcwd(); |
|
51 | - } else if ($arg == '..') { |
|
52 | - $dir = getcwd(); |
|
53 | - $arg = substr($dir, 0, strrpos($dir, DIRECTORY_SEPARATOR)); |
|
54 | - } |
|
55 | - $argument_string .= ' ' . escapeshellarg($arg); |
|
56 | - } |
|
57 | - $count++; |
|
58 | - } |
|
42 | + $argument_string = ''; |
|
43 | + $count = 0; |
|
44 | + foreach($arguments as $arg) { |
|
45 | + if($count != 0) |
|
46 | + { |
|
47 | + //If current directory or parent directory is specified, substitute with full path |
|
48 | + if($arg == '.') |
|
49 | + { |
|
50 | + $arg = getcwd(); |
|
51 | + } else if ($arg == '..') { |
|
52 | + $dir = getcwd(); |
|
53 | + $arg = substr($dir, 0, strrpos($dir, DIRECTORY_SEPARATOR)); |
|
54 | + } |
|
55 | + $argument_string .= ' ' . escapeshellarg($arg); |
|
56 | + } |
|
57 | + $count++; |
|
58 | + } |
|
59 | 59 | |
60 | - return $argument_string; |
|
60 | + return $argument_string; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | //Bug 52872. Dies if the request does not come from CLI. |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | $run_dce_upgrade = true; |
76 | 76 | //set the php path if found |
77 | 77 | if(is_file($argv[7].'dce_config.php')){ |
78 | - include($argv[7].'dce_config.php'); |
|
79 | - $php_path = $dce_config['client_php_path'].'/'; |
|
78 | + include($argv[7].'dce_config.php'); |
|
79 | + $php_path = $dce_config['client_php_path'].'/'; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | $has_error = $output == 0 ? false : true; |
93 | 93 | |
94 | 94 | if(!$has_error) { |
95 | - if($run_dce_upgrade) { |
|
96 | - $step2 = $php_path."php -f {$php_dir}silentUpgrade_dce_step1.php " . build_argument_string($argv); |
|
97 | - passthru($step2, $output); |
|
98 | - } else { |
|
99 | - $step2 = "php -f {$php_dir}silentUpgrade_step2.php " . build_argument_string($argv); |
|
100 | - passthru($step2, $output); |
|
101 | - } |
|
95 | + if($run_dce_upgrade) { |
|
96 | + $step2 = $php_path."php -f {$php_dir}silentUpgrade_dce_step1.php " . build_argument_string($argv); |
|
97 | + passthru($step2, $output); |
|
98 | + } else { |
|
99 | + $step2 = "php -f {$php_dir}silentUpgrade_step2.php " . build_argument_string($argv); |
|
100 | + passthru($step2, $output); |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if($run_dce_upgrade) { |
105 | - $has_error = $output == 0 ? false : true; |
|
106 | - if(!$has_error) { |
|
107 | - $step3 = $php_path."php -f {$php_dir}silentUpgrade_dce_step2.php " . build_argument_string($argv); |
|
108 | - passthru($step3, $output); |
|
109 | - } |
|
105 | + $has_error = $output == 0 ? false : true; |
|
106 | + if(!$has_error) { |
|
107 | + $step3 = $php_path."php -f {$php_dir}silentUpgrade_dce_step2.php " . build_argument_string($argv); |
|
108 | + passthru($step3, $output); |
|
109 | + } |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | if($output != 0) { |
113 | - echo "*************** silentupgrade failed ***************: $output\n"; |
|
113 | + echo "*************** silentupgrade failed ***************: $output\n"; |
|
114 | 114 | } |
115 | 115 | exit($output); |
116 | 116 | ?> |