Skip to content
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

Various fixes required to get supported modules data to be correctly utilised #51

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented May 17, 2024

Issue silverstripe/.github#242

Remove the randomness from the function that's supposed to be predictable

Contains a second commit with various fixes for running against the new tooling, workflow and misc repos

@emteknetnz emteknetnz force-pushed the pulls/main/fix-random-number branch 5 times, most recently from 66a4b4a to 3c9b13e Compare May 20, 2024 02:05
@GuySartorelli GuySartorelli changed the title FIX Do not use random number for predictable int Various fixes required to get supported modules data to be correctly utilised May 20, 2024
funcs_scripts.php Outdated Show resolved Hide resolved
funcs_scripts.php Outdated Show resolved Hide resolved
funcs_utils.php Outdated Show resolved Hide resolved
@@ -1,13 +1,13 @@
<?php

// run on two consecutive days of the week
$dayOfWeek = predictable_random_int(6);
$dayOfWeek = predictable_random_int('dispatch-ci', 6);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use basename(__FILE__) instead, saves having the same magic string multiple times. Change all of these if you change any.
Doesn't ultimately matter though so I won't hold up merging if you leave these as they are.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already tried that, it doesn't work due to the use of eval()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yikes.... we should probably not be using eval but I guess that's something for a separate card.
I guess we just have to hope we don't forget and add code relying on basename in another script or during refactoring in the future.

Copy link
Member Author

@emteknetnz emteknetnz May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basname() isn't the problem, the problem is __FILE__ will be the file with eval() in it, rather than the script file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, pretend I said __FILE__ then, my remark still stands. :p
Nothing to change in this PR, just something we'll have to watch out for in the future.

scripts/cms-any/dispatch-ci.php Outdated Show resolved Hide resolved
scripts/cms-any/merge-ups.php Outdated Show resolved Hide resolved
scripts/cms-any/update-js.php Outdated Show resolved Hide resolved
scripts/cms5/phpstan.php Show resolved Hide resolved
funcs_scripts.php Show resolved Hide resolved
@emteknetnz emteknetnz force-pushed the pulls/main/fix-random-number branch 4 times, most recently from 330c6c7 to c95c982 Compare May 20, 2024 04:20
funcs_scripts.php Show resolved Hide resolved
funcs_utils.php Outdated Show resolved Hide resolved
@@ -1,13 +1,13 @@
<?php

// run on two consecutive days of the week
$dayOfWeek = predictable_random_int(6);
$dayOfWeek = predictable_random_int('dispatch-ci', 6);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yikes.... we should probably not be using eval but I guess that's something for a separate card.
I guess we just have to hope we don't forget and add code relying on basename in another script or during refactoring in the future.

@emteknetnz emteknetnz force-pushed the pulls/main/fix-random-number branch 2 times, most recently from 218211c to ef8a7b6 Compare May 20, 2024 23:51
funcs_utils.php Outdated Show resolved Hide resolved
@emteknetnz emteknetnz force-pushed the pulls/main/fix-random-number branch from ef8a7b6 to 8206cb1 Compare May 21, 2024 03:57
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GuySartorelli GuySartorelli merged commit 6c2b613 into silverstripe:main May 21, 2024
1 check passed
@GuySartorelli GuySartorelli deleted the pulls/main/fix-random-number branch May 21, 2024 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants