Skip to content

Commit

Permalink
[GitHub #62] Fixed background job detection
Browse files Browse the repository at this point in the history
  • Loading branch information
marius-wieschollek committed Aug 28, 2018
1 parent 6a37d0b commit 4ccae44
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker/php/files/xdebug.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9001
xdebug.remote_handler = "dbgp"
Expand Down
1 change: 1 addition & 0 deletions src/js/Manager/SettingsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class SettingsManager {
* Register observer to get updated when a setting is changed
*
* @param settings
* @param callback
* @returns {Promise<any>}
*/
observe(settings, callback) {
Expand Down
14 changes: 12 additions & 2 deletions src/lib/Services/EnvironmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public function isMaintenanceEnabled(): bool {
* @param IRequest $request
*/
protected function checkIfCronJob(IRequest $request): void {
$this->isCronJob = ($request->getRequestUri() === '/cron.php' && in_array(BackgroundJob::getExecutionType(), ['ajax', 'webcron'])) ||
($this->isCliMode && BackgroundJob::getExecutionType() === 'cron' && strpos($request->getScriptName(), 'cron.php') !== false);
$this->isCronJob = ($request->getRequestUri() === '/cron.php' && in_array($this->getBackgroundJobType(), ['ajax', 'webcron'])) ||
($this->isCliMode && $this->getBackgroundJobType() === 'cron' && strpos($request->getScriptName(), 'cron.php') !== false);
}

/**
Expand All @@ -127,4 +127,14 @@ protected function checkIfAppUpdate(IRequest $request): void {
} catch(\Exception $e) {
}
}

/**
* @return string
* @TODO remove in 2019.1.0
*/
protected function getBackgroundJobType() {
if(BackgroundJob::getExecutionType() !== '') return BackgroundJob::getExecutionType();

return \OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax');
}
}
6 changes: 5 additions & 1 deletion src/lib/Settings/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,13 @@ protected function getFileCaches(): array {
*/
protected function getPlatformSupport(): array {
$ncVersion = intval(explode('.', \OC::$server->getConfig()->getSystemValue('version'), 2)[0]);
$cronType = \OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax');

if(BackgroundJob::getExecutionType() !== '') $cronType = BackgroundJob::getExecutionType();


return [
'cron' => BackgroundJob::getExecutionType() === 'ajax',
'cron' => $cronType === 'ajax',
'https' => \OC::$server->getRequest()->getHttpProtocol() === 'https',
'wkhtml' => $this->config->getAppValue('service/preview') == HelperService::PREVIEW_WKHTML,
'php' => [
Expand Down
2 changes: 1 addition & 1 deletion src/scss/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ section.section.passwords {
}

&:first-of-type {
margin-top : -2em;
margin-top : 2em;
}

&:last-of-type {
Expand Down
1 change: 0 additions & 1 deletion tests/codecept/steps/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ module.exports = function() {
*
* @param file The file name
* @param wait Wait for x seconds before capturing
* @param full Capture full page
* @param preview Create a preview image
*/
async captureWholePage(file, wait = 1, preview = true) {
Expand Down

0 comments on commit 4ccae44

Please sign in to comment.