You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

upgrade.php 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Arthur Schiwon
  6. * @copyright 2013 Arthur Schiwon blizzz@owncloud.com
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. $RUNTIME_NOAPPS = true; //no apps, yet
  23. require_once 'lib/base.php';
  24. // Don't do anything if ownCloud has not been installed
  25. if(!OC_Config::getValue('installed', false)) {
  26. exit(0);
  27. }
  28. $br = OC::$CLI ? PHP_EOL : '<br/>';
  29. if(OC::checkUpgrade(false)) {
  30. $updater = new \OC\Updater();
  31. $updater->listen('\OC\Updater', 'maintenanceStart', function () use ($br) {
  32. echo 'Turned on maintenance mode'.$br;
  33. });
  34. $updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($br) {
  35. echo 'Turned off maintenance mode'.$br;
  36. echo 'Update successful'.$br;
  37. });
  38. $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($br) {
  39. echo 'Updated database'.$br;
  40. });
  41. $updater->listen('\OC\Updater', 'filecacheStart', function () use ($br) {
  42. echo 'Updating filecache, this may take really long...'.$br;
  43. });
  44. $updater->listen('\OC\Updater', 'filecacheDone', function () use ($br) {
  45. echo 'Updated filecache'.$br;
  46. });
  47. $updater->listen('\OC\Updater', 'filecacheProgress', function ($out)
  48. use ($br) {
  49. echo '... ' . $out . '% done ...'.$br;
  50. });
  51. $updater->listen('\OC\Updater', 'failure', function ($message) use ($br) {
  52. echo $message.$br;
  53. OC_Config::setValue('maintenance', false);
  54. });
  55. $updater->upgrade();
  56. } else {
  57. if(OC_Config::getValue('maintenance', false)) {
  58. //Possible scenario: ownCloud core is updated but an app failed
  59. echo 'ownCloud is in maintenance mode'.$br;
  60. echo 'Maybe an upgrade is already in process. Please check the '
  61. . 'logfile (data/owncloud.log). If you want to re-run the '
  62. . 'upgrade procedure, remove the "maintenance mode" from '
  63. . 'config.php and call this script again.'
  64. .$br;
  65. } else {
  66. echo 'ownCloud is already latest version'.$br;
  67. }
  68. }