Page MenuHomePhabricator

Duplicate code in SiteConfiguration
Closed, DeclinedPublic

Description

The two following methods in SiteConfiguration seems to have duplicate code:

  • SiteConfiguration::extractGlobalSetting()
  • SiteConfiguration::getAll()

They both check if a variable starts with '+', eventually merge array or just set the value. The only difference is that the first one write the result in $_GLOBALS;

Considering what we have in production:

globals = $conf->getAll( 'enwiki' );
extract( $globals );

That could be replaced by:

$conf->extractAllGlobals( 'enwiki' );

Actually, since both methods seems to be duplicates, we are not sure the two use cases are going to do EXACTLY the same thing. Hence this request to factor out both methods.


Version: 1.20.x
Severity: normal

Details

Reference
bz37238

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:20 AM
bzimport set Reference to bz37238.

Change 107034 had a related patch set uploaded by Tinaj1234:
Removed SiteConfiguration::getAll()

https://gerrit.wikimedia.org/r/107034

Change 107034 abandoned by Hashar:
Removed SiteConfiguration::getAll()

Reason:
Abandoning for now. No follow up since last comments three months ago.

https://gerrit.wikimedia.org/r/107034

Tina Johnson: This issue has been assigned to you a while ago.
Could you please provide a status update and inform us whether you are still working (or still plan to work) on this issue?
Only in case you do not plan to work on this issue anymore, should the assignee be set back to default? Thanks.

hashar lowered the priority of this task from Medium to Lowest.Aug 23 2016, 11:34 AM

Removing good first task as the previous patch has shown that it's not clear for a contributor how to refactor.

They are slightly different nowadays.