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

Many SitesManagement API's return incomplete site information #7155

Open
tsteur opened this issue Feb 9, 2015 · 0 comments
Open

Many SitesManagement API's return incomplete site information #7155

tsteur opened this issue Feb 9, 2015 · 0 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@tsteur
Copy link
Member

tsteur commented Feb 9, 2015

Eg. getAllSites, getSitesFromIds, getSiteFromId, ... pretty much all methods that return one or more sites and not only site ids.

What those methods do is the following:

PHP
$sites = array() // get sites in some way eg $this->getModel()->getAllSites()
Site::setSitesFromArray($sites);
return $sites;

It actually returns the raw site information as returned by the model / database but setSitesFromArray triggers a postEvent to let plugins change or extend the site information. As we do return only $sites and not the modified sites array the values might be incomplete.

This sometimes results in weird code like this:

Site::clearCache();
APISitesManager::getInstance()->getSitesWithAtLeastViewAccess();
$sites = Site::getSites()

Apart from this not making any sense it causes the site cache to be cleared which results in many more site queries although the site information was already fetched previously.

Ideally the site cache would not post an event as it is only a cache and should not contain any logic.

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Feb 9, 2015
@mattab mattab added this to the Short term milestone Feb 9, 2015
@mattab mattab modified the milestones: Short term, Mid term Apr 7, 2015
@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants