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

SIT-3022: fix/ Rogers-crossposting: update utils.php with client code for cross posting #218

Merged
merged 2 commits into from
Mar 21, 2022

Conversation

YMufleh
Copy link
Collaborator

@YMufleh YMufleh commented Mar 11, 2022

Description of the Change

Please inspect this updated code as received by client and advise us if there will be any breaking changes introduced.

Notes from client:
It's an issue if the function is called multiple times, the functions in those lines are in a function, which declares those functions every time the function is called.
Removing those functions from the containers functions fixes the problem.
This is a problem if you do multiple post inserts in the same script, which is the case on News because we crossposts some posts through our different sites.

The issue as actually happening because we do multiple wp_insert_posts in the same PHP script. Maybe I misspoke the right term, but basically, since we have a loop that create multiple posts, in one go, and that this function called get_post_categories has function declarations in it, there is a Fatal error in PHP since you can't declare two functions with the same name.
We crosspost stories from one site to multiple sites when the story is relevant for the other sites, most likely when the story is national.
The crossposting functionality duplicate the post on another site, and links them, so when the "parent" article gets an update, the "children" articles get the same updates
Personally, I would suggest not having named functions or not have function declarations in a function.

@YMufleh YMufleh requested a review from jeffpaul March 11, 2022 17:17
@YMufleh
Copy link
Collaborator Author

YMufleh commented Mar 11, 2022

@jeffpaul looks like the code change is minimal here only wrapping function calls with others.

Will leave it up to you to decide on if this change is good or breaks current logic.
Thank you

@jeffpaul jeffpaul requested a review from oscarssanchez March 11, 2022 18:07
@jeffpaul jeffpaul added this to the 1.0.12 milestone Mar 11, 2022
@jeffpaul
Copy link
Contributor

@oscarssanchez tagging you for code review here

@jeffpaul jeffpaul changed the title fix/ Rogers-crossposting: update utils.php with client code for cross posting SIT-3022: fix/ Rogers-crossposting: update utils.php with client code for cross posting Mar 14, 2022
@jeffpaul
Copy link
Contributor

@jeffpaul jeffpaul removed their request for review March 14, 2022 16:30
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@oscarssanchez oscarssanchez merged commit 333042f into develop Mar 21, 2022
@oscarssanchez oscarssanchez deleted the fix/rogers_crossposting branch March 21, 2022 19:34
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.

3 participants