-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkp/pkp-lib#9753 [stable-3_3_0] Update jquery, jquery-ui and chart.js to address security vulnerability reports #10167
Merged
Merged
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
61ec3bd
pkp/pkp-lib#9753 [stable-3_3_0] Update jquery version from 3.5.1 to 3…
blesildaramirez f8534d6
pkp/pkp-lib#9753 [stable-3_3_0] Update jquery validation from v1.11.1…
blesildaramirez 18ec6b9
pkp/pkp-lib#9753 [stable-3_3_0] Remove components/jqueryui as a compo…
blesildaramirez 3558cc6
pkp/pkp-lib#9753 [stable-3_3_0] Manually add jquery-ui v1.13.3 to jqu…
blesildaramirez 037c3f4
pkp/pkp-lib#9753 [stable-3_3_0] Move import of jqueryui from vendors …
blesildaramirez 5bebaf5
pkp/pkp-lib#9753 [stable-3_3_0] Remove jquery-ui local files
blesildaramirez 22c2a69
pkp/pkp-lib#9753 [stable-3_3_0] Add jquery-ui dependency to composer …
blesildaramirez 11f1508
pkp/pkp-lib#9753 [stable-3_3_0] Remove jquery-validation local files
blesildaramirez 281ba42
pkp/pkp-lib#9753 [stable-3_3_0] Add jquery-validation to composer fro…
blesildaramirez db32b3b
pkp/pkp-lib#9753 [stable-3_3_0] Remove jquery, jquery-ui and jquery-v…
blesildaramirez 5e1c3d5
pkp#9753 [stable-3_3_0] Undo updates to jquery, jquery-ui and jquery-…
blesildaramirez adf20a8
pkp/pkp-lib#9753 [stable-3_3_0] Add js/lib/jquery/plugins/validate/ p…
blesildaramirez 6586b70
pkp/pkp-lib#9753 [stable-3_3_0] Add script to copy jquery and jqueryu…
blesildaramirez e056252
pkp/pkp-lib#9753 Add composer custom repositories for jquery-ui, jque…
blesildaramirez a7e43ff
pkp/pkp-lib#9753 Update composer script when copying jqueryui and jqu…
blesildaramirez b162b82
pkp/pkp-lib#9753 Update FileManager mkdir function to check if folder…
blesildaramirez 09f3a5b
pkp/pkp-lib#9753 Update ComposerScript to use FileManager to copy fil…
blesildaramirez d1d12c0
pkp/pkp-lib#9753 Undo unintended version bump for plugin-api-version
blesildaramirez a3a0cb7
pkp/pkp-lib#9753 Update returned value when directory already exists …
blesildaramirez 70ed240
pkp/pkp-lib#9753 Resolve unexpected throw statement on ComposerScript…
blesildaramirez 3624d79
pkp/pkp-lib#9753 Update path when requiring tools/bootstrap.inc.php
blesildaramirez 6270fa6
pkp/pkp-lib#9753 Update ComposerScript to use native functions to cop…
blesildaramirez 1e227f9
pkp/pkp-lib#9753 Undo check of is_dir on mkdir function in FileManager
blesildaramirez bf243e1
pkp/pkp-lib#9753 Update message log if creating dir fails in Composer…
blesildaramirez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* @file classes/dev/ComposerScript.php | ||
* | ||
* Copyright (c) 2024 Simon Fraser University | ||
* Copyright (c) 2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class ComposerScript | ||
* | ||
* @brief Custom composer scripts to run post installs/updates | ||
*/ | ||
|
||
namespace PKP\dev; | ||
|
||
use Exception; | ||
|
||
require_once '../../tools/bootstrap.inc.php'; | ||
import('lib.pkp.classes.file.FileManager'); | ||
|
||
class ComposerScript | ||
{ | ||
/** | ||
* A post-install-cmd custom composer script that | ||
* copies composer installs from repositories | ||
* to the correct/existing directories of the following dependencies: | ||
* jquery-ui and jquery validation | ||
*/ | ||
public static function copyVendorAssets(): void | ||
{ | ||
$fileManager = new \FileManager(); | ||
$vendorBaseDir = __DIR__ . '/../../lib/vendor'; | ||
$jsPluginsDir = __DIR__ . '/../../js/lib'; | ||
|
||
$source = [ | ||
'jquery-ui.js' => $vendorBaseDir . '/jquery/ui/dist/jquery-ui.js', | ||
'jquery-ui.min.js' => $vendorBaseDir . '/jquery/ui/dist/jquery-ui.min.js', | ||
'jquery-validate' => $vendorBaseDir . '/jquery/validation/dist' | ||
]; | ||
|
||
$dest = [ | ||
'jquery-ui.js' => $vendorBaseDir . '/components/jqueryui/jquery-ui.js', | ||
'jquery-ui.min.js' => $vendorBaseDir . '/components/jqueryui/jquery-ui.min.js', | ||
'jquery-validate' => $jsPluginsDir . '/jquery/plugins/validate' | ||
]; | ||
|
||
// jQuery UI | ||
$fileManager->copyFile($source['jquery-ui.js'], $dest['jquery-ui.js']) || throw new Exception('Failed to copy jquery-ui.js to destination folder'); | ||
$fileManager->copyFile($source['jquery-ui.min.js'], $dest['jquery-ui.min.js']) || throw new Exception('Failed to copy jquery-ui.min.js to destination folder'); | ||
|
||
// jQuery Validation | ||
$fileManager->copyDir($source['jquery-validate'], $dest['jquery-validate']) || throw new Exception('Failed to copy jquery-validate to destination folder'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tagging @asmecher to confirm if it's ok this breaking change, regarding the required permissions (https://docs.pkp.sfu.ca/admin-guide/en/troubleshooting#configuring-file-permissions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script is run by Composer during dependency installation, not when OJS is installed and in production. For the most part, it'll be run from the package build script when I build a release, and for folks that host OJS from git it'll be run early in the installation process from the same terminal that's used to e.g. clone the code into place. I don't think the production file permission document is relevant. (This is also why I recommended not using
FileManager
-- it's intended for execution in the bootstrapped PKP environment, not elsewhere.)