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.
hashar created this task.May 31 2012, 8:12 AM

Can I work on this bug?

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.

Krinkle set Security to None.
Tinaj1234 removed Tinaj1234 as the assignee of this task.Oct 1 2015, 11:14 AM
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptAug 23 2016, 11:34 AM
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.

hashar closed this task as Declined.Jan 1 2019, 3:10 PM

They are slightly different nowadays.