refactor(core): Make AJAX cron script work without jQuery
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>pull/46009/head
parent
8ec53608b0
commit
4d6a21a379
@ -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'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -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 })
|
||||||
|
}
|
||||||
|
})
|
||||||
Loading…
Reference in New Issue