Browse Source
refactor(core): Make AJAX cron script work without jQuery
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/46009/head
Ferdinand Thiessen
1 year ago
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
5 changed files with
20 additions and
15 deletions
-
core/Listener/BeforeTemplateRenderedListener.php
-
core/js/backgroundjobs.js
-
core/js/public/publicpage.js
-
core/src/ajax-cron.ts
-
webpack.modules.js
|
|
|
@ -54,7 +54,7 @@ class BeforeTemplateRenderedListener implements IEventListener { |
|
|
|
|
|
|
|
// If installed and background job is set to ajax, add dedicated script
|
|
|
|
if ($this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { |
|
|
|
Util::addScript('core', 'backgroundjobs'); |
|
|
|
Util::addScript('core', 'ajax-cron'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,13 +0,0 @@ |
|
|
|
/** |
|
|
|
* SPDX-FileCopyrightText: 2012 Jakob Sack owncloud@jakobsack.de |
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later |
|
|
|
*/ |
|
|
|
|
|
|
|
// start worker once page has loaded
|
|
|
|
window.addEventListener('DOMContentLoaded', function(){ |
|
|
|
$.get( OC.getRootPath()+'/cron.php' ); |
|
|
|
|
|
|
|
$('.section .icon-info').tooltip({ |
|
|
|
placement: 'right' |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -14,7 +14,6 @@ window.addEventListener('DOMContentLoaded', function () { |
|
|
|
$('#remote_address').focus(); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$(document).mouseup(function(e) { |
|
|
|
var toggle = $('#body-public').find('.header-right .menutoggle'); |
|
|
|
var container = toggle.next('.popovermenu'); |
|
|
|
|
|
|
|
@ -0,0 +1,18 @@ |
|
|
|
/** |
|
|
|
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later |
|
|
|
*/ |
|
|
|
|
|
|
|
import { getRootUrl } from '@nextcloud/router' |
|
|
|
import logger from './logger' |
|
|
|
|
|
|
|
window.addEventListener('DOMContentLoaded', async () => { |
|
|
|
// When the page is loaded send GET to the cron endpoint to trigger background jobs
|
|
|
|
try { |
|
|
|
logger.debug('Running web cron') |
|
|
|
await window.fetch(`${getRootUrl()}/cron.php`) |
|
|
|
logger.debug('Web cron successfull') |
|
|
|
} catch (e) { |
|
|
|
logger.debug('Running web cron failed', { error: e }) |
|
|
|
} |
|
|
|
}) |
|
|
|
@ -11,6 +11,7 @@ module.exports = { |
|
|
|
init: path.join(__dirname, 'apps/comments/src', 'init.ts'), |
|
|
|
}, |
|
|
|
core: { |
|
|
|
'ajax-cron': path.join(__dirname, 'core/src', 'ajax-cron.ts'), |
|
|
|
files_client: path.join(__dirname, 'core/src', 'files/client.js'), |
|
|
|
files_fileinfo: path.join(__dirname, 'core/src', 'files/fileinfo.js'), |
|
|
|
install: path.join(__dirname, 'core/src', 'install.js'), |
|
|
|
|