@@ -38,124 +38,124 @@ |
||
| 38 | 38 | |
| 39 | 39 | try { |
| 40 | 40 | |
| 41 | - require_once __DIR__ . '/lib/base.php'; |
|
| 42 | - |
|
| 43 | - if (\OCP\Util::needUpgrade()) { |
|
| 44 | - \OCP\Util::writeLog('cron', 'Update required, skipping cron', \OCP\Util::DEBUG); |
|
| 45 | - exit; |
|
| 46 | - } |
|
| 47 | - if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) { |
|
| 48 | - \OCP\Util::writeLog('cron', 'We are in maintenance mode, skipping cron', \OCP\Util::DEBUG); |
|
| 49 | - exit; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - // load all apps to get all api routes properly setup |
|
| 53 | - OC_App::loadApps(); |
|
| 54 | - |
|
| 55 | - \OC::$server->getSession()->close(); |
|
| 56 | - |
|
| 57 | - // initialize a dummy memory session |
|
| 58 | - $session = new \OC\Session\Memory(''); |
|
| 59 | - $cryptoWrapper = \OC::$server->getSessionCryptoWrapper(); |
|
| 60 | - $session = $cryptoWrapper->wrapSession($session); |
|
| 61 | - \OC::$server->setSession($session); |
|
| 62 | - |
|
| 63 | - $logger = \OC::$server->getLogger(); |
|
| 64 | - $config = \OC::$server->getConfig(); |
|
| 65 | - |
|
| 66 | - // Don't do anything if ownCloud has not been installed |
|
| 67 | - if (!$config->getSystemValue('installed', false)) { |
|
| 68 | - exit(0); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - \OC::$server->getTempManager()->cleanOld(); |
|
| 72 | - |
|
| 73 | - // Exit if background jobs are disabled! |
|
| 74 | - $appMode = \OCP\BackgroundJob::getExecutionType(); |
|
| 75 | - if ($appMode == 'none') { |
|
| 76 | - if (OC::$CLI) { |
|
| 77 | - echo 'Background Jobs are disabled!' . PHP_EOL; |
|
| 78 | - } else { |
|
| 79 | - OC_JSON::error(array('data' => array('message' => 'Background jobs disabled!'))); |
|
| 80 | - } |
|
| 81 | - exit(1); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - if (OC::$CLI) { |
|
| 85 | - // set to run indefinitely if needed |
|
| 86 | - if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 87 | - @set_time_limit(0); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - // the cron job must be executed with the right user |
|
| 91 | - if (!function_exists('posix_getuid')) { |
|
| 92 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 93 | - exit(1); |
|
| 94 | - } |
|
| 95 | - $user = posix_getpwuid(posix_getuid()); |
|
| 96 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 97 | - if ($user['name'] !== $configUser['name']) { |
|
| 98 | - echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL; |
|
| 99 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 100 | - echo "Web server user: " . $configUser['name'] . PHP_EOL; |
|
| 101 | - exit(1); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - // We call ownCloud from the CLI (aka cron) |
|
| 105 | - if ($appMode != 'cron') { |
|
| 106 | - \OCP\BackgroundJob::setExecutionType('cron'); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - // Work |
|
| 110 | - $jobList = \OC::$server->getJobList(); |
|
| 111 | - |
|
| 112 | - // We only ask for jobs for 14 minutes, because after 15 minutes the next |
|
| 113 | - // system cron task should spawn. |
|
| 114 | - $endTime = time() + 14 * 60; |
|
| 115 | - |
|
| 116 | - $executedJobs = []; |
|
| 117 | - while ($job = $jobList->getNext()) { |
|
| 118 | - if (isset($executedJobs[$job->getId()])) { |
|
| 119 | - $jobList->unlockJob($job); |
|
| 120 | - break; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - $job->execute($jobList, $logger); |
|
| 124 | - // clean up after unclean jobs |
|
| 125 | - \OC_Util::tearDownFS(); |
|
| 126 | - |
|
| 127 | - $jobList->setLastJob($job); |
|
| 128 | - $executedJobs[$job->getId()] = true; |
|
| 129 | - unset($job); |
|
| 130 | - |
|
| 131 | - if (time() > $endTime) { |
|
| 132 | - break; |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - } else { |
|
| 137 | - // We call cron.php from some website |
|
| 138 | - if ($appMode == 'cron') { |
|
| 139 | - // Cron is cron :-P |
|
| 140 | - OC_JSON::error(array('data' => array('message' => 'Backgroundjobs are using system cron!'))); |
|
| 141 | - } else { |
|
| 142 | - // Work and success :-) |
|
| 143 | - $jobList = \OC::$server->getJobList(); |
|
| 144 | - $job = $jobList->getNext(); |
|
| 145 | - if ($job != null) { |
|
| 146 | - $job->execute($jobList, $logger); |
|
| 147 | - $jobList->setLastJob($job); |
|
| 148 | - } |
|
| 149 | - OC_JSON::success(); |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - // Log the successful cron execution |
|
| 154 | - \OC::$server->getConfig()->setAppValue('core', 'lastcron', time()); |
|
| 155 | - exit(); |
|
| 41 | + require_once __DIR__ . '/lib/base.php'; |
|
| 42 | + |
|
| 43 | + if (\OCP\Util::needUpgrade()) { |
|
| 44 | + \OCP\Util::writeLog('cron', 'Update required, skipping cron', \OCP\Util::DEBUG); |
|
| 45 | + exit; |
|
| 46 | + } |
|
| 47 | + if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) { |
|
| 48 | + \OCP\Util::writeLog('cron', 'We are in maintenance mode, skipping cron', \OCP\Util::DEBUG); |
|
| 49 | + exit; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + // load all apps to get all api routes properly setup |
|
| 53 | + OC_App::loadApps(); |
|
| 54 | + |
|
| 55 | + \OC::$server->getSession()->close(); |
|
| 56 | + |
|
| 57 | + // initialize a dummy memory session |
|
| 58 | + $session = new \OC\Session\Memory(''); |
|
| 59 | + $cryptoWrapper = \OC::$server->getSessionCryptoWrapper(); |
|
| 60 | + $session = $cryptoWrapper->wrapSession($session); |
|
| 61 | + \OC::$server->setSession($session); |
|
| 62 | + |
|
| 63 | + $logger = \OC::$server->getLogger(); |
|
| 64 | + $config = \OC::$server->getConfig(); |
|
| 65 | + |
|
| 66 | + // Don't do anything if ownCloud has not been installed |
|
| 67 | + if (!$config->getSystemValue('installed', false)) { |
|
| 68 | + exit(0); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + \OC::$server->getTempManager()->cleanOld(); |
|
| 72 | + |
|
| 73 | + // Exit if background jobs are disabled! |
|
| 74 | + $appMode = \OCP\BackgroundJob::getExecutionType(); |
|
| 75 | + if ($appMode == 'none') { |
|
| 76 | + if (OC::$CLI) { |
|
| 77 | + echo 'Background Jobs are disabled!' . PHP_EOL; |
|
| 78 | + } else { |
|
| 79 | + OC_JSON::error(array('data' => array('message' => 'Background jobs disabled!'))); |
|
| 80 | + } |
|
| 81 | + exit(1); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + if (OC::$CLI) { |
|
| 85 | + // set to run indefinitely if needed |
|
| 86 | + if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 87 | + @set_time_limit(0); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + // the cron job must be executed with the right user |
|
| 91 | + if (!function_exists('posix_getuid')) { |
|
| 92 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 93 | + exit(1); |
|
| 94 | + } |
|
| 95 | + $user = posix_getpwuid(posix_getuid()); |
|
| 96 | + $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 97 | + if ($user['name'] !== $configUser['name']) { |
|
| 98 | + echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL; |
|
| 99 | + echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 100 | + echo "Web server user: " . $configUser['name'] . PHP_EOL; |
|
| 101 | + exit(1); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + // We call ownCloud from the CLI (aka cron) |
|
| 105 | + if ($appMode != 'cron') { |
|
| 106 | + \OCP\BackgroundJob::setExecutionType('cron'); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + // Work |
|
| 110 | + $jobList = \OC::$server->getJobList(); |
|
| 111 | + |
|
| 112 | + // We only ask for jobs for 14 minutes, because after 15 minutes the next |
|
| 113 | + // system cron task should spawn. |
|
| 114 | + $endTime = time() + 14 * 60; |
|
| 115 | + |
|
| 116 | + $executedJobs = []; |
|
| 117 | + while ($job = $jobList->getNext()) { |
|
| 118 | + if (isset($executedJobs[$job->getId()])) { |
|
| 119 | + $jobList->unlockJob($job); |
|
| 120 | + break; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + $job->execute($jobList, $logger); |
|
| 124 | + // clean up after unclean jobs |
|
| 125 | + \OC_Util::tearDownFS(); |
|
| 126 | + |
|
| 127 | + $jobList->setLastJob($job); |
|
| 128 | + $executedJobs[$job->getId()] = true; |
|
| 129 | + unset($job); |
|
| 130 | + |
|
| 131 | + if (time() > $endTime) { |
|
| 132 | + break; |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + } else { |
|
| 137 | + // We call cron.php from some website |
|
| 138 | + if ($appMode == 'cron') { |
|
| 139 | + // Cron is cron :-P |
|
| 140 | + OC_JSON::error(array('data' => array('message' => 'Backgroundjobs are using system cron!'))); |
|
| 141 | + } else { |
|
| 142 | + // Work and success :-) |
|
| 143 | + $jobList = \OC::$server->getJobList(); |
|
| 144 | + $job = $jobList->getNext(); |
|
| 145 | + if ($job != null) { |
|
| 146 | + $job->execute($jobList, $logger); |
|
| 147 | + $jobList->setLastJob($job); |
|
| 148 | + } |
|
| 149 | + OC_JSON::success(); |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + // Log the successful cron execution |
|
| 154 | + \OC::$server->getConfig()->setAppValue('core', 'lastcron', time()); |
|
| 155 | + exit(); |
|
| 156 | 156 | |
| 157 | 157 | } catch (Exception $ex) { |
| 158 | - \OCP\Util::writeLog('cron', $ex->getMessage(), \OCP\Util::FATAL); |
|
| 158 | + \OCP\Util::writeLog('cron', $ex->getMessage(), \OCP\Util::FATAL); |
|
| 159 | 159 | } catch (Error $ex) { |
| 160 | - \OCP\Util::writeLog('cron', $ex->getMessage(), \OCP\Util::FATAL); |
|
| 160 | + \OCP\Util::writeLog('cron', $ex->getMessage(), \OCP\Util::FATAL); |
|
| 161 | 161 | } |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 37 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 38 | 38 | |
| 39 | 39 | try { |
| 40 | 40 | |
| 41 | - require_once __DIR__ . '/lib/base.php'; |
|
| 41 | + require_once __DIR__.'/lib/base.php'; |
|
| 42 | 42 | |
| 43 | 43 | if (\OCP\Util::needUpgrade()) { |
| 44 | 44 | \OCP\Util::writeLog('cron', 'Update required, skipping cron', \OCP\Util::DEBUG); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $appMode = \OCP\BackgroundJob::getExecutionType(); |
| 75 | 75 | if ($appMode == 'none') { |
| 76 | 76 | if (OC::$CLI) { |
| 77 | - echo 'Background Jobs are disabled!' . PHP_EOL; |
|
| 77 | + echo 'Background Jobs are disabled!'.PHP_EOL; |
|
| 78 | 78 | } else { |
| 79 | 79 | OC_JSON::error(array('data' => array('message' => 'Background jobs disabled!'))); |
| 80 | 80 | } |
@@ -89,15 +89,15 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // the cron job must be executed with the right user |
| 91 | 91 | if (!function_exists('posix_getuid')) { |
| 92 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 92 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php".PHP_EOL; |
|
| 93 | 93 | exit(1); |
| 94 | 94 | } |
| 95 | 95 | $user = posix_getpwuid(posix_getuid()); |
| 96 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 96 | + $configUser = posix_getpwuid(fileowner(OC::$configDir.'config.php')); |
|
| 97 | 97 | if ($user['name'] !== $configUser['name']) { |
| 98 | - echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL; |
|
| 99 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 100 | - echo "Web server user: " . $configUser['name'] . PHP_EOL; |
|
| 98 | + echo "Console has to be executed with the same user as the web server is operated".PHP_EOL; |
|
| 99 | + echo "Current user: ".$user['name'].PHP_EOL; |
|
| 100 | + echo "Web server user: ".$configUser['name'].PHP_EOL; |
|
| 101 | 101 | exit(1); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -3,16 +3,16 @@ |
||
| 3 | 3 | // Show warning if a PHP version below 5.6.0 is used, this has to happen here |
| 4 | 4 | // because base.php will already use 5.6 syntax. |
| 5 | 5 | if (version_compare(PHP_VERSION, '5.6.0') === -1) { |
| 6 | - http_response_code(500); |
|
| 7 | - echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>'; |
|
| 8 | - echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; |
|
| 9 | - exit(-1); |
|
| 6 | + http_response_code(500); |
|
| 7 | + echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>'; |
|
| 8 | + echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; |
|
| 9 | + exit(-1); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | // Show warning if > PHP 7.2 is used as Nextcloud is not compatible with > PHP 7.2 for now |
| 13 | 13 | if (version_compare(PHP_VERSION, '7.3.0') !== -1) { |
| 14 | - http_response_code(500); |
|
| 15 | - echo 'This version of Nextcloud is not compatible with > PHP 7.2.<br/>'; |
|
| 16 | - echo 'You are currently running ' . PHP_VERSION . '.'; |
|
| 17 | - exit(-1); |
|
| 14 | + http_response_code(500); |
|
| 15 | + echo 'This version of Nextcloud is not compatible with > PHP 7.2.<br/>'; |
|
| 16 | + echo 'You are currently running ' . PHP_VERSION . '.'; |
|
| 17 | + exit(-1); |
|
| 18 | 18 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | if (version_compare(PHP_VERSION, '5.6.0') === -1) { |
| 6 | 6 | http_response_code(500); |
| 7 | 7 | echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>'; |
| 8 | - echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; |
|
| 8 | + echo 'You are currently running '.PHP_VERSION.'. Please update your PHP version.'; |
|
| 9 | 9 | exit(-1); |
| 10 | 10 | } |
| 11 | 11 | |
@@ -13,6 +13,6 @@ discard block |
||
| 13 | 13 | if (version_compare(PHP_VERSION, '7.3.0') !== -1) { |
| 14 | 14 | http_response_code(500); |
| 15 | 15 | echo 'This version of Nextcloud is not compatible with > PHP 7.2.<br/>'; |
| 16 | - echo 'You are currently running ' . PHP_VERSION . '.'; |
|
| 16 | + echo 'You are currently running '.PHP_VERSION.'.'; |
|
| 17 | 17 | exit(-1); |
| 18 | 18 | } |
@@ -32,61 +32,61 @@ |
||
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | |
| 35 | - require_once __DIR__ . '/lib/base.php'; |
|
| 35 | + require_once __DIR__ . '/lib/base.php'; |
|
| 36 | 36 | |
| 37 | - OC::handleRequest(); |
|
| 37 | + OC::handleRequest(); |
|
| 38 | 38 | |
| 39 | 39 | } catch(\OC\ServiceUnavailableException $ex) { |
| 40 | - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 40 | + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 41 | 41 | |
| 42 | - //show the user a detailed error page |
|
| 43 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 44 | - OC_Template::printExceptionErrorPage($ex); |
|
| 42 | + //show the user a detailed error page |
|
| 43 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 44 | + OC_Template::printExceptionErrorPage($ex); |
|
| 45 | 45 | } catch (\OC\HintException $ex) { |
| 46 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 47 | - try { |
|
| 48 | - OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); |
|
| 49 | - } catch (Exception $ex2) { |
|
| 50 | - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 51 | - \OC::$server->getLogger()->logException($ex2, array('app' => 'index')); |
|
| 46 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 47 | + try { |
|
| 48 | + OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); |
|
| 49 | + } catch (Exception $ex2) { |
|
| 50 | + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 51 | + \OC::$server->getLogger()->logException($ex2, array('app' => 'index')); |
|
| 52 | 52 | |
| 53 | - //show the user a detailed error page |
|
| 54 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 55 | - OC_Template::printExceptionErrorPage($ex); |
|
| 56 | - } |
|
| 53 | + //show the user a detailed error page |
|
| 54 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 55 | + OC_Template::printExceptionErrorPage($ex); |
|
| 56 | + } |
|
| 57 | 57 | } catch (\OC\User\LoginException $ex) { |
| 58 | - OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN); |
|
| 59 | - OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage()); |
|
| 58 | + OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN); |
|
| 59 | + OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage()); |
|
| 60 | 60 | } catch (Exception $ex) { |
| 61 | - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 61 | + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 62 | 62 | |
| 63 | - //show the user a detailed error page |
|
| 64 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 65 | - OC_Template::printExceptionErrorPage($ex); |
|
| 63 | + //show the user a detailed error page |
|
| 64 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 65 | + OC_Template::printExceptionErrorPage($ex); |
|
| 66 | 66 | } catch (Error $ex) { |
| 67 | - try { |
|
| 68 | - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 69 | - } catch (Error $e) { |
|
| 67 | + try { |
|
| 68 | + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 69 | + } catch (Error $e) { |
|
| 70 | 70 | |
| 71 | - $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']); |
|
| 72 | - $validProtocols = [ |
|
| 73 | - 'HTTP/1.0', |
|
| 74 | - 'HTTP/1.1', |
|
| 75 | - 'HTTP/2', |
|
| 76 | - ]; |
|
| 77 | - $protocol = 'HTTP/1.1'; |
|
| 78 | - if(in_array($claimedProtocol, $validProtocols, true)) { |
|
| 79 | - $protocol = $claimedProtocol; |
|
| 80 | - } |
|
| 81 | - header($protocol . ' 500 Internal Server Error'); |
|
| 82 | - header('Content-Type: text/plain; charset=utf-8'); |
|
| 83 | - print("Internal Server Error\n\n"); |
|
| 84 | - print("The server encountered an internal error and was unable to complete your request.\n"); |
|
| 85 | - print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); |
|
| 86 | - print("More details can be found in the webserver log.\n"); |
|
| 71 | + $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']); |
|
| 72 | + $validProtocols = [ |
|
| 73 | + 'HTTP/1.0', |
|
| 74 | + 'HTTP/1.1', |
|
| 75 | + 'HTTP/2', |
|
| 76 | + ]; |
|
| 77 | + $protocol = 'HTTP/1.1'; |
|
| 78 | + if(in_array($claimedProtocol, $validProtocols, true)) { |
|
| 79 | + $protocol = $claimedProtocol; |
|
| 80 | + } |
|
| 81 | + header($protocol . ' 500 Internal Server Error'); |
|
| 82 | + header('Content-Type: text/plain; charset=utf-8'); |
|
| 83 | + print("Internal Server Error\n\n"); |
|
| 84 | + print("The server encountered an internal error and was unable to complete your request.\n"); |
|
| 85 | + print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); |
|
| 86 | + print("More details can be found in the webserver log.\n"); |
|
| 87 | 87 | |
| 88 | - throw $e; |
|
| 89 | - } |
|
| 90 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 91 | - OC_Template::printExceptionErrorPage($ex); |
|
| 88 | + throw $e; |
|
| 89 | + } |
|
| 90 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 91 | + OC_Template::printExceptionErrorPage($ex); |
|
| 92 | 92 | } |
@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 31 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | |
| 35 | - require_once __DIR__ . '/lib/base.php'; |
|
| 35 | + require_once __DIR__.'/lib/base.php'; |
|
| 36 | 36 | |
| 37 | 37 | OC::handleRequest(); |
| 38 | 38 | |
| 39 | -} catch(\OC\ServiceUnavailableException $ex) { |
|
| 39 | +} catch (\OC\ServiceUnavailableException $ex) { |
|
| 40 | 40 | \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
| 41 | 41 | |
| 42 | 42 | //show the user a detailed error page |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | 'HTTP/2', |
| 76 | 76 | ]; |
| 77 | 77 | $protocol = 'HTTP/1.1'; |
| 78 | - if(in_array($claimedProtocol, $validProtocols, true)) { |
|
| 78 | + if (in_array($claimedProtocol, $validProtocols, true)) { |
|
| 79 | 79 | $protocol = $claimedProtocol; |
| 80 | 80 | } |
| 81 | - header($protocol . ' 500 Internal Server Error'); |
|
| 81 | + header($protocol.' 500 Internal Server Error'); |
|
| 82 | 82 | header('Content-Type: text/plain; charset=utf-8'); |
| 83 | 83 | print("Internal Server Error\n\n"); |
| 84 | 84 | print("The server encountered an internal error and was unable to complete your request.\n"); |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | -require_once __DIR__ . '/../lib/versioncheck.php'; |
|
| 33 | -require_once __DIR__ . '/../lib/base.php'; |
|
| 32 | +require_once __DIR__.'/../lib/versioncheck.php'; |
|
| 33 | +require_once __DIR__.'/../lib/base.php'; |
|
| 34 | 34 | |
| 35 | 35 | if (\OCP\Util::needUpgrade() |
| 36 | 36 | || \OC::$server->getSystemConfig()->getValue('maintenance', false)) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * Try the appframework routes |
| 73 | 73 | */ |
| 74 | 74 | try { |
| 75 | - if(!\OC::$server->getUserSession()->isLoggedIn()) { |
|
| 75 | + if (!\OC::$server->getUserSession()->isLoggedIn()) { |
|
| 76 | 76 | OC::handleLogin(\OC::$server->getRequest()); |
| 77 | 77 | } |
| 78 | 78 | OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | OC_API::setContentType(); |
| 81 | 81 | |
| 82 | 82 | $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
| 83 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
| 83 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
| 84 | 84 | .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
| 85 | 85 | OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
| 86 | 86 | } catch (MethodNotAllowedException $e) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | OC_API::setContentType(); |
| 96 | 96 | |
| 97 | 97 | $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
| 98 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
| 98 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
| 99 | 99 | .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
| 100 | 100 | OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
| 101 | 101 | } |
@@ -23,18 +23,18 @@ |
||
| 23 | 23 | * |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | -require_once __DIR__ . '/../lib/versioncheck.php'; |
|
| 27 | -require_once __DIR__ . '/../lib/base.php'; |
|
| 26 | +require_once __DIR__.'/../lib/versioncheck.php'; |
|
| 27 | +require_once __DIR__.'/../lib/base.php'; |
|
| 28 | 28 | |
| 29 | 29 | header('Content-type: application/xml'); |
| 30 | 30 | |
| 31 | 31 | $request = \OC::$server->getRequest(); |
| 32 | 32 | |
| 33 | -$url = $request->getServerProtocol() . '://' . substr($request->getServerHost() . $request->getRequestUri(), 0, -17).'ocs/v1.php/'; |
|
| 33 | +$url = $request->getServerProtocol().'://'.substr($request->getServerHost().$request->getRequestUri(), 0, -17).'ocs/v1.php/'; |
|
| 34 | 34 | |
| 35 | 35 | $writer = new XMLWriter(); |
| 36 | 36 | $writer->openURI('php://output'); |
| 37 | -$writer->startDocument('1.0','UTF-8'); |
|
| 37 | +$writer->startDocument('1.0', 'UTF-8'); |
|
| 38 | 38 | $writer->setIndent(true); |
| 39 | 39 | $writer->startElement('providers'); |
| 40 | 40 | $writer->startElement('provider'); |
@@ -38,58 +38,58 @@ |
||
| 38 | 38 | define('OC_CONSOLE', 1); |
| 39 | 39 | |
| 40 | 40 | function exceptionHandler($exception) { |
| 41 | - echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
| 42 | - echo $exception; |
|
| 43 | - exit(1); |
|
| 41 | + echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
| 42 | + echo $exception; |
|
| 43 | + exit(1); |
|
| 44 | 44 | } |
| 45 | 45 | try { |
| 46 | - require_once __DIR__ . '/lib/base.php'; |
|
| 46 | + require_once __DIR__ . '/lib/base.php'; |
|
| 47 | 47 | |
| 48 | - // set to run indefinitely if needed |
|
| 49 | - if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 50 | - @set_time_limit(0); |
|
| 51 | - } |
|
| 48 | + // set to run indefinitely if needed |
|
| 49 | + if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 50 | + @set_time_limit(0); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - if (!OC::$CLI) { |
|
| 54 | - echo "This script can be run from the command line only" . PHP_EOL; |
|
| 55 | - exit(1); |
|
| 56 | - } |
|
| 53 | + if (!OC::$CLI) { |
|
| 54 | + echo "This script can be run from the command line only" . PHP_EOL; |
|
| 55 | + exit(1); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - set_exception_handler('exceptionHandler'); |
|
| 58 | + set_exception_handler('exceptionHandler'); |
|
| 59 | 59 | |
| 60 | - if (!function_exists('posix_getuid')) { |
|
| 61 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 62 | - exit(1); |
|
| 63 | - } |
|
| 64 | - $user = posix_getpwuid(posix_getuid()); |
|
| 65 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 66 | - if ($user['name'] !== $configUser['name']) { |
|
| 67 | - echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
| 68 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 69 | - echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
| 70 | - echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
| 71 | - exit(1); |
|
| 72 | - } |
|
| 60 | + if (!function_exists('posix_getuid')) { |
|
| 61 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 62 | + exit(1); |
|
| 63 | + } |
|
| 64 | + $user = posix_getpwuid(posix_getuid()); |
|
| 65 | + $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 66 | + if ($user['name'] !== $configUser['name']) { |
|
| 67 | + echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
| 68 | + echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 69 | + echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
| 70 | + echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
| 71 | + exit(1); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - $oldWorkingDir = getcwd(); |
|
| 75 | - if ($oldWorkingDir === false) { |
|
| 76 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 77 | - echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 78 | - } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
|
| 79 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 80 | - echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 81 | - exit(1); |
|
| 82 | - } |
|
| 74 | + $oldWorkingDir = getcwd(); |
|
| 75 | + if ($oldWorkingDir === false) { |
|
| 76 | + echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 77 | + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 78 | + } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
|
| 79 | + echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 80 | + echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 81 | + exit(1); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
|
| 85 | - echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php" . PHP_EOL; |
|
| 86 | - } |
|
| 84 | + if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
|
| 85 | + echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php" . PHP_EOL; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - $application = new Application(\OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getRequest(), \OC::$server->getLogger()); |
|
| 89 | - $application->loadCommands(new ArgvInput(), new ConsoleOutput()); |
|
| 90 | - $application->run(); |
|
| 88 | + $application = new Application(\OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getRequest(), \OC::$server->getLogger()); |
|
| 89 | + $application->loadCommands(new ArgvInput(), new ConsoleOutput()); |
|
| 90 | + $application->run(); |
|
| 91 | 91 | } catch (Exception $ex) { |
| 92 | - exceptionHandler($ex); |
|
| 92 | + exceptionHandler($ex); |
|
| 93 | 93 | } catch (Error $ex) { |
| 94 | - exceptionHandler($ex); |
|
| 94 | + exceptionHandler($ex); |
|
| 95 | 95 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 32 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 33 | 33 | |
| 34 | 34 | use OC\Console\Application; |
| 35 | 35 | use Symfony\Component\Console\Input\ArgvInput; |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | define('OC_CONSOLE', 1); |
| 39 | 39 | |
| 40 | 40 | function exceptionHandler($exception) { |
| 41 | - echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
| 41 | + echo "An unhandled exception has been thrown:".PHP_EOL; |
|
| 42 | 42 | echo $exception; |
| 43 | 43 | exit(1); |
| 44 | 44 | } |
| 45 | 45 | try { |
| 46 | - require_once __DIR__ . '/lib/base.php'; |
|
| 46 | + require_once __DIR__.'/lib/base.php'; |
|
| 47 | 47 | |
| 48 | 48 | // set to run indefinitely if needed |
| 49 | 49 | if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
@@ -51,38 +51,38 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if (!OC::$CLI) { |
| 54 | - echo "This script can be run from the command line only" . PHP_EOL; |
|
| 54 | + echo "This script can be run from the command line only".PHP_EOL; |
|
| 55 | 55 | exit(1); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | set_exception_handler('exceptionHandler'); |
| 59 | 59 | |
| 60 | 60 | if (!function_exists('posix_getuid')) { |
| 61 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 61 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php".PHP_EOL; |
|
| 62 | 62 | exit(1); |
| 63 | 63 | } |
| 64 | 64 | $user = posix_getpwuid(posix_getuid()); |
| 65 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 65 | + $configUser = posix_getpwuid(fileowner(OC::$configDir.'config.php')); |
|
| 66 | 66 | if ($user['name'] !== $configUser['name']) { |
| 67 | - echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
| 68 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 69 | - echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
| 70 | - echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
| 67 | + echo "Console has to be executed with the user that owns the file config/config.php".PHP_EOL; |
|
| 68 | + echo "Current user: ".$user['name'].PHP_EOL; |
|
| 69 | + echo "Owner of config.php: ".$configUser['name'].PHP_EOL; |
|
| 70 | + echo "Try adding 'sudo -u ".$configUser['name']." ' to the beginning of the command (without the single quotes)".PHP_EOL; |
|
| 71 | 71 | exit(1); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $oldWorkingDir = getcwd(); |
| 75 | 75 | if ($oldWorkingDir === false) { |
| 76 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 77 | - echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 76 | + echo "This script can be run from the Nextcloud root directory only.".PHP_EOL; |
|
| 77 | + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact.".PHP_EOL; |
|
| 78 | 78 | } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
| 79 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 80 | - echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 79 | + echo "This script can be run from the Nextcloud root directory only.".PHP_EOL; |
|
| 80 | + echo "Can't change to Nextcloud root directory.".PHP_EOL; |
|
| 81 | 81 | exit(1); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
| 85 | - echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php" . PHP_EOL; |
|
| 85 | + echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php".PHP_EOL; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $application = new Application(\OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getRequest(), \OC::$server->getLogger()); |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 32 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 33 | 33 | |
| 34 | 34 | try { |
| 35 | 35 | |
| 36 | - require_once __DIR__ . '/lib/base.php'; |
|
| 36 | + require_once __DIR__.'/lib/base.php'; |
|
| 37 | 37 | |
| 38 | 38 | $systemConfig = \OC::$server->getSystemConfig(); |
| 39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php |
| 43 | 43 | # for description and defaults |
| 44 | 44 | $defaults = new \OCP\Defaults(); |
| 45 | - $values=array( |
|
| 45 | + $values = array( |
|
| 46 | 46 | 'installed'=>$installed, |
| 47 | 47 | 'maintenance' => $maintenance, |
| 48 | 48 | 'needsDbUpgrade' => \OCP\Util::needUpgrade(), |
@@ -32,64 +32,64 @@ |
||
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | |
| 35 | - require_once __DIR__ . '/lib/base.php'; |
|
| 36 | - if (\OCP\Util::needUpgrade()) { |
|
| 37 | - // since the behavior of apps or remotes are unpredictable during |
|
| 38 | - // an upgrade, return a 503 directly |
|
| 39 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 40 | - OC_Template::printErrorPage('Service unavailable'); |
|
| 41 | - exit; |
|
| 42 | - } |
|
| 35 | + require_once __DIR__ . '/lib/base.php'; |
|
| 36 | + if (\OCP\Util::needUpgrade()) { |
|
| 37 | + // since the behavior of apps or remotes are unpredictable during |
|
| 38 | + // an upgrade, return a 503 directly |
|
| 39 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 40 | + OC_Template::printErrorPage('Service unavailable'); |
|
| 41 | + exit; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - OC::checkMaintenanceMode(); |
|
| 45 | - $request = \OC::$server->getRequest(); |
|
| 46 | - $pathInfo = $request->getPathInfo(); |
|
| 44 | + OC::checkMaintenanceMode(); |
|
| 45 | + $request = \OC::$server->getRequest(); |
|
| 46 | + $pathInfo = $request->getPathInfo(); |
|
| 47 | 47 | |
| 48 | - if (!$pathInfo && $request->getParam('service', '') === '') { |
|
| 49 | - header('HTTP/1.0 404 Not Found'); |
|
| 50 | - exit; |
|
| 51 | - } elseif ($request->getParam('service', '')) { |
|
| 52 | - $service = $request->getParam('service', ''); |
|
| 53 | - } else { |
|
| 54 | - $pathInfo = trim($pathInfo, '/'); |
|
| 55 | - list($service) = explode('/', $pathInfo); |
|
| 56 | - } |
|
| 57 | - $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service)); |
|
| 58 | - if ($file === null) { |
|
| 59 | - header('HTTP/1.0 404 Not Found'); |
|
| 60 | - exit; |
|
| 61 | - } |
|
| 48 | + if (!$pathInfo && $request->getParam('service', '') === '') { |
|
| 49 | + header('HTTP/1.0 404 Not Found'); |
|
| 50 | + exit; |
|
| 51 | + } elseif ($request->getParam('service', '')) { |
|
| 52 | + $service = $request->getParam('service', ''); |
|
| 53 | + } else { |
|
| 54 | + $pathInfo = trim($pathInfo, '/'); |
|
| 55 | + list($service) = explode('/', $pathInfo); |
|
| 56 | + } |
|
| 57 | + $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service)); |
|
| 58 | + if ($file === null) { |
|
| 59 | + header('HTTP/1.0 404 Not Found'); |
|
| 60 | + exit; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - $parts = explode('/', $file, 2); |
|
| 64 | - $app = $parts[0]; |
|
| 63 | + $parts = explode('/', $file, 2); |
|
| 64 | + $app = $parts[0]; |
|
| 65 | 65 | |
| 66 | - // Load all required applications |
|
| 67 | - \OC::$REQUESTEDAPP = $app; |
|
| 68 | - OC_App::loadApps(array('authentication')); |
|
| 69 | - OC_App::loadApps(array('filesystem', 'logging')); |
|
| 66 | + // Load all required applications |
|
| 67 | + \OC::$REQUESTEDAPP = $app; |
|
| 68 | + OC_App::loadApps(array('authentication')); |
|
| 69 | + OC_App::loadApps(array('filesystem', 'logging')); |
|
| 70 | 70 | |
| 71 | - if (!\OC::$server->getAppManager()->isInstalled($app)) { |
|
| 72 | - throw new Exception('App not installed: ' . $app); |
|
| 73 | - } |
|
| 74 | - OC_App::loadApp($app); |
|
| 75 | - OC_User::setIncognitoMode(true); |
|
| 71 | + if (!\OC::$server->getAppManager()->isInstalled($app)) { |
|
| 72 | + throw new Exception('App not installed: ' . $app); |
|
| 73 | + } |
|
| 74 | + OC_App::loadApp($app); |
|
| 75 | + OC_User::setIncognitoMode(true); |
|
| 76 | 76 | |
| 77 | - $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
| 77 | + $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
| 78 | 78 | |
| 79 | - require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
| 79 | + require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
| 80 | 80 | |
| 81 | 81 | } catch (Exception $ex) { |
| 82 | - if ($ex instanceof \OC\ServiceUnavailableException) { |
|
| 83 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 84 | - } else { |
|
| 85 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 86 | - } |
|
| 87 | - //show the user a detailed error page |
|
| 88 | - \OC::$server->getLogger()->logException($ex, ['app' => 'public']); |
|
| 89 | - OC_Template::printExceptionErrorPage($ex); |
|
| 82 | + if ($ex instanceof \OC\ServiceUnavailableException) { |
|
| 83 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 84 | + } else { |
|
| 85 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 86 | + } |
|
| 87 | + //show the user a detailed error page |
|
| 88 | + \OC::$server->getLogger()->logException($ex, ['app' => 'public']); |
|
| 89 | + OC_Template::printExceptionErrorPage($ex); |
|
| 90 | 90 | } catch (Error $ex) { |
| 91 | - //show the user a detailed error page |
|
| 92 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 93 | - \OC::$server->getLogger()->logException($ex, ['app' => 'public']); |
|
| 94 | - OC_Template::printExceptionErrorPage($ex); |
|
| 91 | + //show the user a detailed error page |
|
| 92 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 93 | + \OC::$server->getLogger()->logException($ex, ['app' => 'public']); |
|
| 94 | + OC_Template::printExceptionErrorPage($ex); |
|
| 95 | 95 | } |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 31 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | |
| 35 | - require_once __DIR__ . '/lib/base.php'; |
|
| 35 | + require_once __DIR__.'/lib/base.php'; |
|
| 36 | 36 | if (\OCP\Util::needUpgrade()) { |
| 37 | 37 | // since the behavior of apps or remotes are unpredictable during |
| 38 | 38 | // an upgrade, return a 503 directly |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $pathInfo = trim($pathInfo, '/'); |
| 55 | 55 | list($service) = explode('/', $pathInfo); |
| 56 | 56 | } |
| 57 | - $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service)); |
|
| 57 | + $file = \OC::$server->getConfig()->getAppValue('core', 'public_'.strip_tags($service)); |
|
| 58 | 58 | if ($file === null) { |
| 59 | 59 | header('HTTP/1.0 404 Not Found'); |
| 60 | 60 | exit; |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | OC_App::loadApps(array('filesystem', 'logging')); |
| 70 | 70 | |
| 71 | 71 | if (!\OC::$server->getAppManager()->isInstalled($app)) { |
| 72 | - throw new Exception('App not installed: ' . $app); |
|
| 72 | + throw new Exception('App not installed: '.$app); |
|
| 73 | 73 | } |
| 74 | 74 | OC_App::loadApp($app); |
| 75 | 75 | OC_User::setIncognitoMode(true); |
| 76 | 76 | |
| 77 | - $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
| 77 | + $baseuri = OC::$WEBROOT.'/public.php/'.$service.'/'; |
|
| 78 | 78 | |
| 79 | - require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
| 79 | + require_once OC_App::getAppPath($app).'/'.$parts[1]; |
|
| 80 | 80 | |
| 81 | 81 | } catch (Exception $ex) { |
| 82 | 82 | if ($ex instanceof \OC\ServiceUnavailableException) { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | -require_once __DIR__ . '/../lib/versioncheck.php'; |
|
| 31 | +require_once __DIR__.'/../lib/versioncheck.php'; |
|
| 32 | 32 | |
| 33 | 33 | use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin; |
| 34 | 34 | use Sabre\DAV\Exception\ServiceUnavailable; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | // we shall not log on RemoteException |
| 57 | 57 | $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger())); |
| 58 | 58 | } |
| 59 | - $server->on('beforeMethod', function () use ($e) { |
|
| 59 | + $server->on('beforeMethod', function() use ($e) { |
|
| 60 | 60 | if ($e instanceof RemoteException) { |
| 61 | 61 | switch ($e->getCode()) { |
| 62 | 62 | case OC_Response::STATUS_SERVICE_UNAVAILABLE: |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $server->exec(); |
| 73 | 73 | } else { |
| 74 | 74 | $statusCode = OC_Response::STATUS_INTERNAL_SERVER_ERROR; |
| 75 | - if ($e instanceof \OC\ServiceUnavailableException ) { |
|
| 75 | + if ($e instanceof \OC\ServiceUnavailableException) { |
|
| 76 | 76 | $statusCode = OC_Response::STATUS_SERVICE_UNAVAILABLE; |
| 77 | 77 | } |
| 78 | 78 | if ($e instanceof RemoteException) { |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | return $services[$service]; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service); |
|
| 108 | + return \OC::$server->getConfig()->getAppValue('core', 'remote_'.$service); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | try { |
| 112 | - require_once __DIR__ . '/lib/base.php'; |
|
| 112 | + require_once __DIR__.'/lib/base.php'; |
|
| 113 | 113 | |
| 114 | 114 | // All resources served via the DAV endpoint should have the strictest possible |
| 115 | 115 | // policy. Exempted from this is the SabreDAV browser plugin which overwrites |
@@ -130,18 +130,18 @@ discard block |
||
| 130 | 130 | if (!$pos = strpos($pathInfo, '/', 1)) { |
| 131 | 131 | $pos = strlen($pathInfo); |
| 132 | 132 | } |
| 133 | - $service=substr($pathInfo, 1, $pos-1); |
|
| 133 | + $service = substr($pathInfo, 1, $pos - 1); |
|
| 134 | 134 | |
| 135 | 135 | $file = resolveService($service); |
| 136 | 136 | |
| 137 | - if(is_null($file)) { |
|
| 137 | + if (is_null($file)) { |
|
| 138 | 138 | throw new RemoteException('Path not found', OC_Response::STATUS_NOT_FOUND); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $file=ltrim($file, '/'); |
|
| 141 | + $file = ltrim($file, '/'); |
|
| 142 | 142 | |
| 143 | - $parts=explode('/', $file, 2); |
|
| 144 | - $app=$parts[0]; |
|
| 143 | + $parts = explode('/', $file, 2); |
|
| 144 | + $app = $parts[0]; |
|
| 145 | 145 | |
| 146 | 146 | // Load all required applications |
| 147 | 147 | \OC::$REQUESTEDAPP = $app; |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | switch ($app) { |
| 152 | 152 | case 'core': |
| 153 | - $file = OC::$SERVERROOT .'/'. $file; |
|
| 153 | + $file = OC::$SERVERROOT.'/'.$file; |
|
| 154 | 154 | break; |
| 155 | 155 | default: |
| 156 | 156 | if (!\OC::$server->getAppManager()->isInstalled($app)) { |
| 157 | - throw new RemoteException('App not installed: ' . $app); |
|
| 157 | + throw new RemoteException('App not installed: '.$app); |
|
| 158 | 158 | } |
| 159 | 159 | OC_App::loadApp($app); |
| 160 | - $file = OC_App::getAppPath($app) .'/'. $parts[1]; |
|
| 160 | + $file = OC_App::getAppPath($app).'/'.$parts[1]; |
|
| 161 | 161 | break; |
| 162 | 162 | } |
| 163 | - $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; |
|
| 163 | + $baseuri = OC::$WEBROOT.'/remote.php/'.$service.'/'; |
|
| 164 | 164 | require_once $file; |
| 165 | 165 | |
| 166 | 166 | } catch (Exception $ex) { |