pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
306 stars 445 forks source link

[OJS] Can't change CDN for jquery etc. #5993

Closed consultbelieve closed 4 years ago

consultbelieve commented 4 years ago

It's come to our attention that googleapis.com hosted versions of JQuery are inaccessible from China, which renders most of the admin functionality useful to editors etc. accessing from China.

We've found the location that these are defined in the following file

lib/pkp/classes/template/PKPTemplateManager.inc.php

and have amended to pull from the jquery CDN instead

However, despite clearing the template cache, the changes are not showing on the front end of the site - and there doesn't appear to be anywhere else that the googleapis.com URLs are defined.

  1. What are we missing, in terms of getting our updated CDN URLs to come through to the site
  2. Perhaps it might be worth moving away from googleapis.com (or offering the option to choose/define these in the admin) given that the Chinese academic market is probably fairly large.
asmecher commented 4 years ago

@consultbelieve, grepping through the code, I see several references to googleapis.com:

./plugins/generic/lensGalley/LensGalleyPlugin.inc.php
./plugins/generic/lensGalley/lib/lens/index.html
./plugins/generic/immersion/ImmersionThemePlugin.inc.php
./plugins/generic/tinymce/styles/content-font.css
./plugins/generic/pdfJsViewer/PdfJsViewerPlugin.inc.php
./plugins/themes/bootstrap3/BootstrapThreeThemePlugin.inc.php
./plugins/themes/bootstrap3/bootstrap-themes/united/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/lumen/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/paper/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/yeti/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/simplex/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/darkly/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/journal/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/sandstone/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/cosmo/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/readable/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/superhero/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/spacelab/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/flatly/bootswatch.less
./plugins/themes/bootstrap3/bootstrap-themes/cyborg/bootswatch.less
./plugins/themes/default/DefaultThemePlugin.inc.php
./lib/pkp/tools/travis/install-linter.sh
./lib/pkp/classes/template/PKPTemplateManager.inc.php
./lib/ui-library/public/index.html

Your mileage may vary depending on what plugins you have installed and which are enabled, but the default theme plugin's reference to the CDN for fonts will probably affect you, for example.

You can turn off enable_cdn in config.inc.php to use local copies of JQuery.

At a glance, there are alternatives for the fonts described here: https://www.hongkiat.com/blog/google-fonts-china/ ...however, I don't have any experience with them and suggestions are welcome.

consultbelieve commented 4 years ago

Good point - hadn't considered the plugin side of things too

NateWr commented 4 years ago

I think the enable_cdn config setting should suffice here. If you want, you can add additional CSS assets using a generic plugin.

I'm going to go ahead and close this for now but feel free to reopen it if there is more you'd like to discuss.

ifaniqbal commented 4 years ago

Where is it to change enable_cdn value to false?

ifaniqbal commented 4 years ago

Found it: config.inc.php