#11214 closed enhancement (fixed)
Improve get_themes() so that the size of the in-memory data is smaller
Reported by: | westi | Owned by: | westi |
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Themes | Keywords: | needs-patch |
Focuses: | Cc: |
Description
#10467 introduced the possibility that themes were outside WP_CONTENT_DIR and now we have the full path to all the template files in the data get_themes() returns.
We should be able to refactor this to store less duplicated data.
Attachments (1)
Change History (9)
#3
@
15 years ago
- Milestone changed from 3.0 to 3.1
We're in feature freeze, Approaching Beta in the near future, This is an enhancement and is not a regression over the previous release. Moving to 3.1 for now
#5
follow-up:
↓ 6
@
13 years ago
This came up again so I took a quick look.
Attached patch:
- Reduces in memory storage by approx 50% compares to 2.9 post [12226] for 87 themes (wpcom public themes repo r2679)
- Changes the data we store which may affect plugins / themes although fixing them would be trivial
- Fixes the theme editor to work with the new storage structure.
Not yet tested with:
- Page Templates
- Multiple Themedirs (although the unit tests which gave me the size figure do use an alternate root)
#6
in reply to:
↑ 5
@
13 years ago
Replying to westi:
This came up again so I took a quick look.
Really good idea for some memory usage reduction.
From my reading of the patch I think there are two things still to do:
- Page templates - get_page_templates() needs to have the same fix that was applied to the theme editor, i.e. prepend the path to the template file name.
- Child themes need testing. It looks like there could be an issue for template files added in the loop through $stylesheet_dir as their path would be
$themes[$theme]['Stylesheet Dir']
and not$themes[$theme]['Template Dir']
.
Note: See
TracTickets for help on using
tickets.
A logical approach would be to only store a path if it is outside of the standard theme root. 99% of the time it's not going to be, so why duplicate those? I'll help with a patch for this.