| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | $Rev: 427 $ | $LastChangedBy: nate $ |
|---|
| 4 | $LastChangedDate: 2008-08-13 12:09:00 -0600 (Wed, 13 Aug 2008) $ |
|---|
| 5 | +-------------------------------------------------------------------------+ |
|---|
| 6 | | Copyright (c) 2004 - 2010, Kreotek LLC | |
|---|
| 7 | | All rights reserved. | |
|---|
| 8 | +-------------------------------------------------------------------------+ |
|---|
| 9 | | | |
|---|
| 10 | | Redistribution and use in source and binary forms, with or without | |
|---|
| 11 | | modification, are permitted provided that the following conditions are | |
|---|
| 12 | | met: | |
|---|
| 13 | | | |
|---|
| 14 | | - Redistributions of source code must retain the above copyright | |
|---|
| 15 | | notice, this list of conditions and the following disclaimer. | |
|---|
| 16 | | | |
|---|
| 17 | | - Redistributions in binary form must reproduce the above copyright | |
|---|
| 18 | | notice, this list of conditions and the following disclaimer in the | |
|---|
| 19 | | documentation and/or other materials provided with the distribution. | |
|---|
| 20 | | | |
|---|
| 21 | | - Neither the name of Kreotek LLC nor the names of its contributore may | |
|---|
| 22 | | be used to endorse or promote products derived from this software | |
|---|
| 23 | | without specific prior written permission. | |
|---|
| 24 | | | |
|---|
| 25 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
|---|
| 26 | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
|---|
| 27 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
|---|
| 28 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
|---|
| 29 | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
|---|
| 30 | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
|---|
| 31 | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
|---|
| 32 | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
|---|
| 33 | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
|---|
| 34 | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
|---|
| 35 | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
|---|
| 36 | | | |
|---|
| 37 | +-------------------------------------------------------------------------+ |
|---|
| 38 | */ |
|---|
| 39 | define("APP_DEBUG",false); |
|---|
| 40 | define("noStartup",true); |
|---|
| 41 | |
|---|
| 42 | require("install_include.php"); |
|---|
| 43 | require("../include/session.php"); |
|---|
| 44 | require("../include/common_functions.php"); |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | class updateAjax extends installUpdateBase{ |
|---|
| 48 | |
|---|
| 49 | function coreDataUpdate(){ |
|---|
| 50 | |
|---|
| 51 | if(!$this->db->connect()) |
|---|
| 52 | return $this->returnJSON(false, "Could not connect to database ".$this->db->getError()); |
|---|
| 53 | |
|---|
| 54 | if(!$this->db->selectSchema()) |
|---|
| 55 | return $this->returnJSON(false, "Could not open database schema '".MYSQL_DATABASE."'"); |
|---|
| 56 | |
|---|
| 57 | $updater = new installer($this->db); |
|---|
| 58 | |
|---|
| 59 | //get the current Version |
|---|
| 60 | $currentVersion = $this->getCurrentVersion("base"); |
|---|
| 61 | include("../phpbmsversion.php"); |
|---|
| 62 | $newVersion = $modules["base"]["version"]; |
|---|
| 63 | |
|---|
| 64 | //next we loop through ech upgrade process |
|---|
| 65 | while($currentVersion != $newVersion){ |
|---|
| 66 | |
|---|
| 67 | switch($currentVersion){ |
|---|
| 68 | |
|---|
| 69 | // ================================================================================================ |
|---|
| 70 | case 0.8: |
|---|
| 71 | |
|---|
| 72 | $version = 0.9; |
|---|
| 73 | //Processing Data Structure Changes |
|---|
| 74 | $thereturn = $updater->processSQLfile("updatev".$version.".sql"); |
|---|
| 75 | if($thereturn !== true) |
|---|
| 76 | return $this->returnJSON(false, $thereturn); |
|---|
| 77 | |
|---|
| 78 | //Updating Module Table |
|---|
| 79 | $thereturn = $this->updateModuleVersion("base", $version); |
|---|
| 80 | if($thereturn !== true) |
|---|
| 81 | return $this->returnJSON(false, $thereturn); |
|---|
| 82 | |
|---|
| 83 | $currentVersion = $version; |
|---|
| 84 | |
|---|
| 85 | break; |
|---|
| 86 | |
|---|
| 87 | // ================================================================================================ |
|---|
| 88 | case 0.9: |
|---|
| 89 | |
|---|
| 90 | $version = 0.92; |
|---|
| 91 | //Processing Data Structure Changes |
|---|
| 92 | $thereturn = $updater->processSQLfile("updatev".$version.".sql"); |
|---|
| 93 | if($thereturn !== true) |
|---|
| 94 | return $this->returnJSON(false, $thereturn); |
|---|
| 95 | |
|---|
| 96 | //Updating Module Table |
|---|
| 97 | $thereturn = $this->updateModuleVersion("base", $version); |
|---|
| 98 | if($thereturn !== true) |
|---|
| 99 | return $this->returnJSON(false, $thereturn); |
|---|
| 100 | |
|---|
| 101 | $currentVersion = $version; |
|---|
| 102 | |
|---|
| 103 | break; |
|---|
| 104 | |
|---|
| 105 | // ================================================================================================ |
|---|
| 106 | case 0.92: |
|---|
| 107 | |
|---|
| 108 | $version = 0.94; |
|---|
| 109 | //Processing Data Structure Changes |
|---|
| 110 | $thereturn = $updater->processSQLfile("updatev".$version.".sql"); |
|---|
| 111 | if($thereturn !== true) |
|---|
| 112 | return $this->returnJSON(false, $thereturn); |
|---|
| 113 | |
|---|
| 114 | //Updating Module Table |
|---|
| 115 | $thereturn = $this->updateModuleVersion("base", $version); |
|---|
| 116 | if($thereturn !== true) |
|---|
| 117 | return $this->returnJSON(false, $thereturn); |
|---|
| 118 | |
|---|
| 119 | $currentVersion = $version; |
|---|
| 120 | |
|---|
| 121 | break; |
|---|
| 122 | |
|---|
| 123 | // ================================================================================================ |
|---|
| 124 | case 0.94: |
|---|
| 125 | |
|---|
| 126 | $version = 0.96; |
|---|
| 127 | //Processing Data Structure Changes |
|---|
| 128 | $thereturn = $updater->processSQLfile("updatev".$version.".sql"); |
|---|
| 129 | if($thereturn !== true) |
|---|
| 130 | return $this->returnJSON(false, $thereturn); |
|---|
| 131 | |
|---|
| 132 | //Updating Module Table |
|---|
| 133 | $thereturn = $this->updateModuleVersion("base", $version); |
|---|
| 134 | if($thereturn !== true) |
|---|
| 135 | return $this->returnJSON(false, $thereturn); |
|---|
| 136 | |
|---|
| 137 | $currentVersion = $version; |
|---|
| 138 | |
|---|
| 139 | break; |
|---|
| 140 | |
|---|
| 141 | // ================================================================================================ |
|---|
| 142 | case 0.96: |
|---|
| 143 | |
|---|
| 144 | $version = 0.98; |
|---|
| 145 | //Processing Data Structure Changes |
|---|
| 146 | $thereturn = $updater->processSQLfile("updatev".$version.".sql"); |
|---|
| 147 | if($thereturn !== true) |
|---|
| 148 | return $this->returnJSON(false, $thereturn); |
|---|
| 149 | |
|---|
| 150 | $this->v098UpdateUUIDS("tabledefs", "tbld:", true); |
|---|
| 151 | $this->v098UpdateUUIDS("users", "usr:", true); |
|---|
| 152 | $this->v098UpdateUUIDS("roles", "role:", true); |
|---|
| 153 | $this->v098UpdateUUIDS("reports", "rpt:"); |
|---|
| 154 | $this->v098UpdateUUIDS("scheduler", "schd:"); |
|---|
| 155 | $this->v098UpdateUUIDS("smartsearches", "smrt:"); |
|---|
| 156 | |
|---|
| 157 | $this->v098UpdateNotesUUID(); |
|---|
| 158 | $this->v098UpdateApiUsers(); |
|---|
| 159 | |
|---|
| 160 | //Updating Module Table |
|---|
| 161 | $thereturn = $this->updateModuleVersion("base", $version); |
|---|
| 162 | if($thereturn !== true) |
|---|
| 163 | return $this->returnJSON(false, $thereturn); |
|---|
| 164 | |
|---|
| 165 | $currentVersion = $version; |
|---|
| 166 | |
|---|
| 167 | break; |
|---|
| 168 | |
|---|
| 169 | }//endswitch currentVersion |
|---|
| 170 | |
|---|
| 171 | }//endwhile currentversion/newversion |
|---|
| 172 | |
|---|
| 173 | return $this->returnJSON(true, "Update Successful."); |
|---|
| 174 | |
|---|
| 175 | }//end function coreDataUpdate |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | function moduleUpdate($module){ |
|---|
| 179 | |
|---|
| 180 | if(!$this->db->connect()) |
|---|
| 181 | return $this->returnJSON(false, "Could not connect to database ".$this->db->getError()); |
|---|
| 182 | |
|---|
| 183 | if(!$this->db->selectSchema()) |
|---|
| 184 | return $this->returnJSON(false, "Could not open database schema '".MYSQL_DATABASE."'"); |
|---|
| 185 | |
|---|
| 186 | $moduleFile = "../modules/".$module."/install/update.php"; |
|---|
| 187 | if(!file_exists($moduleFile)) |
|---|
| 188 | return $this->returnJSON(false, "Module update file '".$moduleFile."' does not exist."); |
|---|
| 189 | |
|---|
| 190 | $versionFile = "../modules/".$module."/version.php"; |
|---|
| 191 | if(!file_exists($versionFile)) |
|---|
| 192 | return $this->returnJSON(false, "Module version file '".$versionFile."' does not exist."); |
|---|
| 193 | |
|---|
| 194 | @ include($moduleFile); |
|---|
| 195 | @ include($versionFile); |
|---|
| 196 | |
|---|
| 197 | $theModule->currentVersion = $this->getCurrentVersion($theModule->moduleName); |
|---|
| 198 | return $theModule->update(); |
|---|
| 199 | |
|---|
| 200 | }//end function coreDataUpdate |
|---|
| 201 | |
|---|
| 202 | |
|---|
| 203 | function process($command, $extras = null){ |
|---|
| 204 | |
|---|
| 205 | $this->phpbmsSession = new phpbmsSession; |
|---|
| 206 | |
|---|
| 207 | if($this->phpbmsSession->loadDBSettings(false)){ |
|---|
| 208 | |
|---|
| 209 | @ include_once("include/db.php"); |
|---|
| 210 | |
|---|
| 211 | $this->db = new db(false); |
|---|
| 212 | $this->db->stopOnError = false; |
|---|
| 213 | $this->db->showError = false; |
|---|
| 214 | $this->db->logError = false; |
|---|
| 215 | |
|---|
| 216 | } else |
|---|
| 217 | return $this->returnJSON(false, "Could not open session.php file"); |
|---|
| 218 | |
|---|
| 219 | switch($command){ |
|---|
| 220 | |
|---|
| 221 | case "coredataupdate": |
|---|
| 222 | echo $this->coreDataUpdate(); |
|---|
| 223 | break; |
|---|
| 224 | |
|---|
| 225 | case "moduleupdate": |
|---|
| 226 | if(!$extras) |
|---|
| 227 | echo $this->returnJSON(false, "module not passed"); |
|---|
| 228 | echo $this->moduleUpdate($extras); |
|---|
| 229 | break; |
|---|
| 230 | |
|---|
| 231 | default: |
|---|
| 232 | echo $this->returnJSON(false, "command not recognized"); |
|---|
| 233 | break; |
|---|
| 234 | |
|---|
| 235 | }//endswitch |
|---|
| 236 | |
|---|
| 237 | }//endfunction process |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | function getCurrentVersion($module){ |
|---|
| 241 | |
|---|
| 242 | $querystatement = " |
|---|
| 243 | SELECT |
|---|
| 244 | version |
|---|
| 245 | FROM |
|---|
| 246 | modules |
|---|
| 247 | WHERE |
|---|
| 248 | name = '".$module."'"; |
|---|
| 249 | |
|---|
| 250 | $queryresult = $this->db->query($querystatement); |
|---|
| 251 | if($this->db->error) |
|---|
| 252 | $error = new appError(-600,"Could not retrieve current version information for ".$module.": ".$this->db->error,"Cannot load module information",true,true,false); |
|---|
| 253 | |
|---|
| 254 | if($this->db->numRows($queryresult)){ |
|---|
| 255 | |
|---|
| 256 | $therecord = $this->db->fetchArray($queryresult); |
|---|
| 257 | |
|---|
| 258 | return floatval($therecord["version"]); |
|---|
| 259 | |
|---|
| 260 | } else |
|---|
| 261 | return 0; |
|---|
| 262 | |
|---|
| 263 | }//end function getCurrentVersion |
|---|
| 264 | |
|---|
| 265 | |
|---|
| 266 | function updateModuleVersion($module, $version){ |
|---|
| 267 | |
|---|
| 268 | $updatestatement = " |
|---|
| 269 | UPDATE |
|---|
| 270 | `modules` |
|---|
| 271 | SET |
|---|
| 272 | `version` ='".$version."' |
|---|
| 273 | WHERE |
|---|
| 274 | `name` = '".$module."'"; |
|---|
| 275 | |
|---|
| 276 | $this->db->query($updatestatement); |
|---|
| 277 | |
|---|
| 278 | if($this->db->error) |
|---|
| 279 | return $this->returnJSON(false, "Could not update module '".$version."' version to '".$version."': ".$this->db->error); |
|---|
| 280 | else |
|---|
| 281 | return true; |
|---|
| 282 | |
|---|
| 283 | }//end function updateModuleVersion |
|---|
| 284 | |
|---|
| 285 | |
|---|
| 286 | |
|---|
| 287 | // ==== v0.98 functions ================================================ |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | function v098UpdateNotesUUID(){ |
|---|
| 291 | |
|---|
| 292 | $updatestatement = " |
|---|
| 293 | UPDATE |
|---|
| 294 | notes |
|---|
| 295 | SET |
|---|
| 296 | parentid = NULL |
|---|
| 297 | WHERE |
|---|
| 298 | parentid = '0'"; |
|---|
| 299 | |
|---|
| 300 | $this->db->query($updatestatement); |
|---|
| 301 | |
|---|
| 302 | $querystatement = " |
|---|
| 303 | SELECT |
|---|
| 304 | id, |
|---|
| 305 | assignedtoid, |
|---|
| 306 | assignebyid |
|---|
| 307 | FROM |
|---|
| 308 | notes"; |
|---|
| 309 | |
|---|
| 310 | $queryresult = $this->db->query($querystatement); |
|---|
| 311 | |
|---|
| 312 | while($therecord = $this->db->fetchArray($queryresult)){ |
|---|
| 313 | |
|---|
| 314 | $noteList[$therecord["id"]] = uuid("note:"); |
|---|
| 315 | |
|---|
| 316 | $updatestatement = " |
|---|
| 317 | UPDATE |
|---|
| 318 | notes |
|---|
| 319 | SET |
|---|
| 320 | uuid = '".$noteList[$therecord["id"]]."', |
|---|
| 321 | assignedtoid = '".$this->uuids["users"][$therecord["assignedtoid"]]."', |
|---|
| 322 | assignedbyid = '".$this->uuids["users"][$therecord["assignedbyid"]]."', |
|---|
| 323 | WHERE |
|---|
| 324 | id =".$therecord["id"]; |
|---|
| 325 | |
|---|
| 326 | $this->db->query($updatestatement); |
|---|
| 327 | |
|---|
| 328 | }//endwhile |
|---|
| 329 | |
|---|
| 330 | //next we need to update notes who have a parentid |
|---|
| 331 | $querystatement = " |
|---|
| 332 | SELECT |
|---|
| 333 | id, |
|---|
| 334 | parentid |
|---|
| 335 | FROM |
|---|
| 336 | notes |
|---|
| 337 | WHERE |
|---|
| 338 | parentid IS NOT NULL"; |
|---|
| 339 | |
|---|
| 340 | $queryresult = $this->db->query($querystatement); |
|---|
| 341 | |
|---|
| 342 | while($therecord = $this->db->fetchArray($queryresult)){ |
|---|
| 343 | |
|---|
| 344 | $updatestatement = " |
|---|
| 345 | UPDATE |
|---|
| 346 | notes |
|---|
| 347 | SET |
|---|
| 348 | parentid ='".$noteList[$therecord["parentid"]]."' |
|---|
| 349 | WHERE |
|---|
| 350 | id = ".$therecord["id"]; |
|---|
| 351 | |
|---|
| 352 | $this->db->query($updatestatement); |
|---|
| 353 | |
|---|
| 354 | }//endwhile |
|---|
| 355 | |
|---|
| 356 | }//end function v098UpdateNotesUUID |
|---|
| 357 | |
|---|
| 358 | |
|---|
| 359 | function v098UpdateUUIDS($tablename, $prefix, $populateList = false){ |
|---|
| 360 | |
|---|
| 361 | $querystatement = " |
|---|
| 362 | SELECT |
|---|
| 363 | `id` |
|---|
| 364 | FROM |
|---|
| 365 | `".$tablename."` |
|---|
| 366 | WHERE |
|---|
| 367 | uuid = '' |
|---|
| 368 | OR uuid IS NULL"; |
|---|
| 369 | |
|---|
| 370 | $queryresult = $this->db->query($querystatement); |
|---|
| 371 | |
|---|
| 372 | if($populateList) |
|---|
| 373 | $uuidList[0] = ""; |
|---|
| 374 | |
|---|
| 375 | while($therecord = $this->db->fetchArray($queryresult)){ |
|---|
| 376 | |
|---|
| 377 | $uuid = uuid($prefix); |
|---|
| 378 | if($populateList) |
|---|
| 379 | $uuidList[$therecord["id"]] = $uuid; |
|---|
| 380 | $updatestatement = " |
|---|
| 381 | UPDATE |
|---|
| 382 | `".$tablename."` |
|---|
| 383 | SET |
|---|
| 384 | `uuid`='".$uuid."' |
|---|
| 385 | WHERE |
|---|
| 386 | `id` = '".$therecord["id"]."'; |
|---|
| 387 | "; |
|---|
| 388 | |
|---|
| 389 | $this->db->query($updatestatement); |
|---|
| 390 | |
|---|
| 391 | }//end while |
|---|
| 392 | |
|---|
| 393 | if($populateList) |
|---|
| 394 | $this->uuids[$tablename] = $uuidList; |
|---|
| 395 | |
|---|
| 396 | }//end function |
|---|
| 397 | |
|---|
| 398 | |
|---|
| 399 | /** |
|---|
| 400 | * function v098UpdateAppUUID |
|---|
| 401 | */ |
|---|
| 402 | |
|---|
| 403 | function v098UpdateAppUUID() { |
|---|
| 404 | |
|---|
| 405 | $updatestatement = " |
|---|
| 406 | UPDATE |
|---|
| 407 | `settings` |
|---|
| 408 | SET |
|---|
| 409 | `value` = '".mysql_real_escape_string(uuid("sys:"))."' |
|---|
| 410 | WHERE |
|---|
| 411 | `name` = 'application_uuid' |
|---|
| 412 | "; |
|---|
| 413 | |
|---|
| 414 | $this->db->query($updatestatement); |
|---|
| 415 | |
|---|
| 416 | }//end method |
|---|
| 417 | |
|---|
| 418 | |
|---|
| 419 | /** |
|---|
| 420 | * function v098UpdateApiUsers |
|---|
| 421 | * |
|---|
| 422 | * Gives admin access to all users with portal access. |
|---|
| 423 | */ |
|---|
| 424 | |
|---|
| 425 | function v098UpdateApiUsers(){ |
|---|
| 426 | |
|---|
| 427 | $updatestatement = " |
|---|
| 428 | UPDATE |
|---|
| 429 | `users` |
|---|
| 430 | SET |
|---|
| 431 | `admin` = '1' |
|---|
| 432 | WHERE |
|---|
| 433 | `portalaccess` != '0' |
|---|
| 434 | "; |
|---|
| 435 | |
|---|
| 436 | $this->db->query($updatestatement); |
|---|
| 437 | |
|---|
| 438 | }//end method |
|---|
| 439 | |
|---|
| 440 | }//end class updateAjax |
|---|
| 441 | |
|---|
| 442 | |
|---|
| 443 | class updateModuleAjax extends installUpdateBase{ |
|---|
| 444 | |
|---|
| 445 | var $pathToModule = ""; |
|---|
| 446 | var $updateVersions = array(); |
|---|
| 447 | var $moduleName; |
|---|
| 448 | var $newVersion = 0; |
|---|
| 449 | var $currentVersion = 100000; |
|---|
| 450 | |
|---|
| 451 | |
|---|
| 452 | function updateModuleAjax($db, $phpbmsSession, $moduleName, $pathToModule){ |
|---|
| 453 | |
|---|
| 454 | $this->db = $db; |
|---|
| 455 | $this->phpbmsSession = $phpbmsSession; |
|---|
| 456 | $this->pathToModule = $pathToModule; |
|---|
| 457 | $this->moduleName = $moduleName; |
|---|
| 458 | |
|---|
| 459 | }//end function |
|---|
| 460 | |
|---|
| 461 | |
|---|
| 462 | function update(){ |
|---|
| 463 | |
|---|
| 464 | if(!$this->db->connect()) |
|---|
| 465 | return $this->returnJSON(false, "Could not connect to database ".$this->db->getError()); |
|---|
| 466 | |
|---|
| 467 | if(!$this->db->selectSchema()) |
|---|
| 468 | return $this->returnJSON(false, "Could not open database schema '".MYSQL_DATABASE."'"); |
|---|
| 469 | |
|---|
| 470 | $updater = new installer($this->db); |
|---|
| 471 | |
|---|
| 472 | //next we loop through each upgrade process |
|---|
| 473 | foreach($this->updateVersions as $version){ |
|---|
| 474 | |
|---|
| 475 | if($this->currentVersion <= $version){ |
|---|
| 476 | |
|---|
| 477 | $thereturn = $updater->processSQLfile($this->pathToModule."updatev".$version.".sql"); |
|---|
| 478 | if($thereturn !== true) |
|---|
| 479 | return $this->returnJSON(false, $thereturn); |
|---|
| 480 | |
|---|
| 481 | //Updating Module Table |
|---|
| 482 | $thereturn = $this->updateModuleVersion($this->moduleName, $version); |
|---|
| 483 | if($thereturn !== true) |
|---|
| 484 | return $this->returnJSON(false, $thereturn); |
|---|
| 485 | |
|---|
| 486 | }//endif |
|---|
| 487 | |
|---|
| 488 | }//endforeach |
|---|
| 489 | |
|---|
| 490 | return $this->returnJSON(true, "Module '".$this->moduleName."' Updated"); |
|---|
| 491 | |
|---|
| 492 | }//end function update |
|---|
| 493 | |
|---|
| 494 | |
|---|
| 495 | function updateModuleVersion($module, $version){ |
|---|
| 496 | |
|---|
| 497 | $updatestatement = " |
|---|
| 498 | UPDATE |
|---|
| 499 | `modules` |
|---|
| 500 | SET |
|---|
| 501 | `version` ='".$version."' |
|---|
| 502 | WHERE |
|---|
| 503 | `name` = '".$module."'"; |
|---|
| 504 | |
|---|
| 505 | $this->db->query($updatestatement); |
|---|
| 506 | |
|---|
| 507 | if($this->db->error) |
|---|
| 508 | return $this->returnJSON(false, "Could not update module '".$version."' version to '".$version."': ".$this->db->error); |
|---|
| 509 | else |
|---|
| 510 | return true; |
|---|
| 511 | |
|---|
| 512 | }//end function updateModuleVersion |
|---|
| 513 | |
|---|
| 514 | }//end class updateModuleAjax |
|---|
| 515 | |
|---|
| 516 | |
|---|
| 517 | // START PROCESSING |
|---|
| 518 | //============================================================================== |
|---|
| 519 | |
|---|
| 520 | $updateAjax = new updateAjax(); |
|---|
| 521 | |
|---|
| 522 | if(!isset($_GET["command"])) |
|---|
| 523 | echo $updateAjax->returnJSON("failure", "No command given."); |
|---|
| 524 | |
|---|
| 525 | if(!isset($_GET["extras"])) |
|---|
| 526 | $updateAjax->process($_GET["command"]); |
|---|
| 527 | else |
|---|
| 528 | $updateAjax->process($_GET["command"], $_GET["extras"]); |
|---|