diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-09 07:44:26 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-09 13:53:59 +0200 |
commit | 9af69ca2a5ed74acefdaedad6d189bdfd9e61e0e (patch) | |
tree | c755177c3886de1498010820b9a547a5314c8d41 /core | |
parent | 8b38b601e5bd07559bb86d38132be31820c41627 (diff) | |
download | nextcloud-server-9af69ca2a5ed74acefdaedad6d189bdfd9e61e0e.tar.gz nextcloud-server-9af69ca2a5ed74acefdaedad6d189bdfd9e61e0e.zip |
Fix usage of deprecated OC.webroot
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/js/backgroundjobs.js | 2 | ||||
-rw-r--r-- | core/js/js.js | 10 | ||||
-rw-r--r-- | core/js/maintenance-check.js | 2 | ||||
-rw-r--r-- | core/js/mimetype.js | 4 | ||||
-rw-r--r-- | core/js/tests/specs/coreSpec.js | 32 | ||||
-rw-r--r-- | core/js/tests/specs/l10nSpec.js | 4 | ||||
-rw-r--r-- | core/js/tests/specs/mimeTypeSpec.js | 8 | ||||
-rw-r--r-- | core/js/update.js | 2 | ||||
-rw-r--r-- | core/search/js/searchprovider.js | 2 |
9 files changed, 33 insertions, 33 deletions
diff --git a/core/js/backgroundjobs.js b/core/js/backgroundjobs.js index 8d51d519c8d..499d8e88073 100644 --- a/core/js/backgroundjobs.js +++ b/core/js/backgroundjobs.js @@ -21,7 +21,7 @@ // start worker once page has loaded $(document).ready(function(){ - $.get( OC.webroot+'/cron.php' ); + $.get( OC.getRootPath()+'/cron.php' ); $('.section .icon-info').tooltip({ placement: 'right' diff --git a/core/js/js.js b/core/js/js.js index 3f7ad233e31..e7e1c301bb5 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -99,7 +99,7 @@ var OCP = {}, * @return {string} the url */ linkToRemoteBase:function(service) { - return OC.webroot + '/remote.php/' + service; + return OC.getRootPath() + '/remote.php/' + service; }, /** @@ -119,7 +119,7 @@ var OCP = {}, */ linkToOCS: function(service, version) { version = (version !== 2) ? 1 : 2; - return window.location.protocol + '//' + window.location.host + OC.webroot + '/ocs/v' + version + '.php/' + service + '/'; + return window.location.protocol + '//' + window.location.host + OC.getRootPath() + '/ocs/v' + version + '.php/' + service + '/'; }, /** @@ -157,10 +157,10 @@ var OCP = {}, } if(oc_config.modRewriteWorking == true) { - return OC.webroot + _build(url, params); + return OC.getRootPath() + _build(url, params); } - return OC.webroot + '/index.php' + _build(url, params); + return OC.getRootPath() + '/index.php' + _build(url, params); }, /** @@ -172,7 +172,7 @@ var OCP = {}, */ filePath:function(app,type,file){ var isCore=OC.coreApps.indexOf(app)!==-1, - link=OC.webroot; + link=OC.getRootPath(); if(file.substring(file.length-3) === 'php' && !isCore){ link+='/index.php/apps/' + app; if (file != 'index.php') { diff --git a/core/js/maintenance-check.js b/core/js/maintenance-check.js index 663f7fb5f00..b9d34793a82 100644 --- a/core/js/maintenance-check.js +++ b/core/js/maintenance-check.js @@ -3,7 +3,7 @@ window.setInterval(checkStatus, 20000); function checkStatus() { var request = new XMLHttpRequest(); - request.open("GET", OC.webroot+'/status.php', true); + request.open("GET", OC.getRootPath()+'/status.php', true); request.onreadystatechange = function() { if (request.readyState === 4) { var response = request.responseText; diff --git a/core/js/mimetype.js b/core/js/mimetype.js index e5a07abc951..bad676d9357 100644 --- a/core/js/mimetype.js +++ b/core/js/mimetype.js @@ -85,7 +85,7 @@ OC.MimeType = { var gotIcon = null; var path = ''; if (OC.theme.folder !== '' && $.isArray(OC.MimeTypeList.themes[OC.theme.folder])) { - path = OC.webroot + '/themes/' + OC.theme.folder + '/core/img/filetypes/'; + path = OC.getRootPath() + '/themes/' + OC.theme.folder + '/core/img/filetypes/'; var icon = OC.MimeType._getFile(mimeType, OC.MimeTypeList.themes[OC.theme.folder]); if (icon !== null) { @@ -101,7 +101,7 @@ OC.MimeType = { // If we do not yet have an icon fall back to the default if (gotIcon === null) { - path = OC.webroot + '/core/img/filetypes/'; + path = OC.getRootPath() + '/core/img/filetypes/'; path += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files); } diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index 6766fc2789c..96c8e3f99ec 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -31,7 +31,7 @@ describe('Core base tests', function() { }); describe('Base values', function() { it('Sets webroots', function() { - expect(OC.webroot).toBeDefined(); + expect(OC.getRootPath()).toBeDefined(); expect(OC.appswebroots).toBeDefined(); }); }); @@ -256,7 +256,7 @@ describe('Core base tests', function() { describe('filePath', function() { beforeEach(function() { OC.webroot = 'http://localhost'; - OC.appswebroots.files = OC.webroot + '/apps3/files'; + OC.appswebroots.files = OC.getRootPath() + '/apps3/files'; }); afterEach(function() { delete OC.appswebroots.files; @@ -275,7 +275,7 @@ describe('Core base tests', function() { }); describe('Link functions', function() { var TESTAPP = 'testapp'; - var TESTAPP_ROOT = OC.webroot + '/appsx/testapp'; + var TESTAPP_ROOT = OC.getRootPath() + '/appsx/testapp'; beforeEach(function() { OC.appswebroots[TESTAPP] = TESTAPP_ROOT; @@ -285,22 +285,22 @@ describe('Core base tests', function() { delete OC.appswebroots[TESTAPP]; }); it('Generates correct links for core apps', function() { - expect(OC.linkTo('core', 'somefile.php')).toEqual(OC.webroot + '/core/somefile.php'); - expect(OC.linkTo('admin', 'somefile.php')).toEqual(OC.webroot + '/admin/somefile.php'); + expect(OC.linkTo('core', 'somefile.php')).toEqual(OC.getRootPath() + '/core/somefile.php'); + expect(OC.linkTo('admin', 'somefile.php')).toEqual(OC.getRootPath() + '/admin/somefile.php'); }); it('Generates correct links for regular apps', function() { - expect(OC.linkTo(TESTAPP, 'somefile.php')).toEqual(OC.webroot + '/index.php/apps/' + TESTAPP + '/somefile.php'); + expect(OC.linkTo(TESTAPP, 'somefile.php')).toEqual(OC.getRootPath() + '/index.php/apps/' + TESTAPP + '/somefile.php'); }); it('Generates correct remote links', function() { - expect(OC.linkToRemote('webdav')).toEqual(window.location.protocol + '//' + window.location.host + OC.webroot + '/remote.php/webdav'); + expect(OC.linkToRemote('webdav')).toEqual(window.location.protocol + '//' + window.location.host + OC.getRootPath() + '/remote.php/webdav'); }); describe('Images', function() { it('Generates image path with given extension', function() { - expect(OC.imagePath('core', 'somefile.jpg')).toEqual(OC.webroot + '/core/img/somefile.jpg'); + expect(OC.imagePath('core', 'somefile.jpg')).toEqual(OC.getRootPath() + '/core/img/somefile.jpg'); expect(OC.imagePath(TESTAPP, 'somefile.jpg')).toEqual(TESTAPP_ROOT + '/img/somefile.jpg'); }); it('Generates image path with svg extension', function() { - expect(OC.imagePath('core', 'somefile')).toEqual(OC.webroot + '/core/img/somefile.svg'); + expect(OC.imagePath('core', 'somefile')).toEqual(OC.getRootPath() + '/core/img/somefile.svg'); expect(OC.imagePath(TESTAPP, 'somefile')).toEqual(TESTAPP_ROOT + '/img/somefile.svg'); }); }); @@ -502,23 +502,23 @@ describe('Core base tests', function() { }); describe('Generate Url', function() { it('returns absolute urls', function() { - expect(OC.generateUrl('csrftoken')).toEqual(OC.webroot + '/index.php/csrftoken'); - expect(OC.generateUrl('/csrftoken')).toEqual(OC.webroot + '/index.php/csrftoken'); + expect(OC.generateUrl('csrftoken')).toEqual(OC.getRootPath() + '/index.php/csrftoken'); + expect(OC.generateUrl('/csrftoken')).toEqual(OC.getRootPath() + '/index.php/csrftoken'); }); it('substitutes parameters which are escaped by default', function() { - expect(OC.generateUrl('apps/files/download/{file}', {file: '<">ImAnUnescapedString/!'})).toEqual(OC.webroot + '/index.php/apps/files/download/%3C%22%3EImAnUnescapedString%2F!'); + expect(OC.generateUrl('apps/files/download/{file}', {file: '<">ImAnUnescapedString/!'})).toEqual(OC.getRootPath() + '/index.php/apps/files/download/%3C%22%3EImAnUnescapedString%2F!'); }); it('substitutes parameters which can also be unescaped via option flag', function() { - expect(OC.generateUrl('apps/files/download/{file}', {file: 'subfolder/Welcome.txt'}, {escape: false})).toEqual(OC.webroot + '/index.php/apps/files/download/subfolder/Welcome.txt'); + expect(OC.generateUrl('apps/files/download/{file}', {file: 'subfolder/Welcome.txt'}, {escape: false})).toEqual(OC.getRootPath() + '/index.php/apps/files/download/subfolder/Welcome.txt'); }); it('substitutes multiple parameters which are escaped by default', function() { - expect(OC.generateUrl('apps/files/download/{file}/{id}', {file: '<">ImAnUnescapedString/!', id: 5})).toEqual(OC.webroot + '/index.php/apps/files/download/%3C%22%3EImAnUnescapedString%2F!/5'); + expect(OC.generateUrl('apps/files/download/{file}/{id}', {file: '<">ImAnUnescapedString/!', id: 5})).toEqual(OC.getRootPath() + '/index.php/apps/files/download/%3C%22%3EImAnUnescapedString%2F!/5'); }); it('substitutes multiple parameters which can also be unescaped via option flag', function() { - expect(OC.generateUrl('apps/files/download/{file}/{id}', {file: 'subfolder/Welcome.txt', id: 5}, {escape: false})).toEqual(OC.webroot + '/index.php/apps/files/download/subfolder/Welcome.txt/5'); + expect(OC.generateUrl('apps/files/download/{file}/{id}', {file: 'subfolder/Welcome.txt', id: 5}, {escape: false})).toEqual(OC.getRootPath() + '/index.php/apps/files/download/subfolder/Welcome.txt/5'); }); it('doesnt error out with no params provided', function () { - expect(OC.generateUrl('apps/files/download{file}')).toEqual(OC.webroot + '/index.php/apps/files/download%7Bfile%7D'); + expect(OC.generateUrl('apps/files/download{file}')).toEqual(OC.getRootPath() + '/index.php/apps/files/download%7Bfile%7D'); }); }); describe('Main menu mobile toggle', function() { diff --git a/core/js/tests/specs/l10nSpec.js b/core/js/tests/specs/l10nSpec.js index 3dd1fa268ef..219c9348717 100644 --- a/core/js/tests/specs/l10nSpec.js +++ b/core/js/tests/specs/l10nSpec.js @@ -12,7 +12,7 @@ describe('OC.L10N tests', function() { var TEST_APP = 'jsunittestapp'; beforeEach(function() { - OC.appswebroots[TEST_APP] = OC.webroot + '/apps3/jsunittestapp'; + OC.appswebroots[TEST_APP] = OC.getRootPath() + '/apps3/jsunittestapp'; }); afterEach(function() { delete OC.L10N._bundles[TEST_APP]; @@ -141,7 +141,7 @@ describe('OC.L10N tests', function() { expect(fakeServer.requests.length).toEqual(1); var req = fakeServer.requests[0]; expect(req.url).toEqual( - OC.webroot + '/apps3/' + TEST_APP + '/l10n/zh_CN.json' + OC.getRootPath() + '/apps3/' + TEST_APP + '/l10n/zh_CN.json' ); req.respond( 200, diff --git a/core/js/tests/specs/mimeTypeSpec.js b/core/js/tests/specs/mimeTypeSpec.js index 8ad0300a0a7..c9497a7c574 100644 --- a/core/js/tests/specs/mimeTypeSpec.js +++ b/core/js/tests/specs/mimeTypeSpec.js @@ -100,7 +100,7 @@ describe('MimeType tests', function() { it('return the url for the mimetype file', function() { var res = OC.MimeType.getIconUrl('file'); - expect(res).toEqual(OC.webroot + '/core/img/filetypes/file.svg'); + expect(res).toEqual(OC.getRootPath() + '/core/img/filetypes/file.svg'); }); it('test if the cache works correctly', function() { @@ -118,7 +118,7 @@ describe('MimeType tests', function() { it('test if alaiases are converted correctly', function() { var res = OC.MimeType.getIconUrl('app/foobar'); - expect(res).toEqual(OC.webroot + '/core/img/filetypes/foo-bar.svg'); + expect(res).toEqual(OC.getRootPath() + '/core/img/filetypes/foo-bar.svg'); expect(OC.MimeType._mimeTypeIcons['foo/bar']).toEqual(res); }); }); @@ -139,12 +139,12 @@ describe('MimeType tests', function() { it('test if theme path is used if a theme icon is availble', function() { var res = OC.MimeType.getIconUrl('dir'); - expect(res).toEqual(OC.webroot + '/themes/abc/core/img/filetypes/folder.svg'); + expect(res).toEqual(OC.getRootPath() + '/themes/abc/core/img/filetypes/folder.svg'); }); it('test if we fallback to the default theme if no icon is available in the theme', function() { var res = OC.MimeType.getIconUrl('dir-shared'); - expect(res).toEqual(OC.webroot + '/core/img/filetypes/folder-shared.svg'); + expect(res).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-shared.svg'); }); }); }); diff --git a/core/js/update.js b/core/js/update.js index eb65336229e..842f85c2f18 100644 --- a/core/js/update.js +++ b/core/js/update.js @@ -41,7 +41,7 @@ }) ); - var updateEventSource = new OC.EventSource(OC.webroot+'/core/ajax/update.php'); + var updateEventSource = new OC.EventSource(OC.getRootPath()+'/core/ajax/update.php'); updateEventSource.listen('success', function(message) { self.setMessage(message); }); diff --git a/core/search/js/searchprovider.js b/core/search/js/searchprovider.js index f5a499fab60..86a22f570f8 100644 --- a/core/search/js/searchprovider.js +++ b/core/search/js/searchprovider.js @@ -417,7 +417,7 @@ $(document).ready(function() { if ($searchResults.length > 0 && $searchBox.length > 0) { $searchResults.addClass('hidden'); $searchResults.load( - OC.webroot + '/core/search/templates/part.results.html', + OC.getRootPath() + '/core/search/templates/part.results.html', function() { OC.Search = new OCA.Search.Core( $searchBox, |