Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-9163

style.php cannot be properly cached

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 3.0.x
    • Fix Version/s: 3.1.0-a1
    • Component/s: Styles
    • Labels:
      None
    • Environment:
      PHP Environment:
      Database:

      Description

      Right now style.php is fairly intensive, it doesn't attempt to mitigate this by using any validity negotiation based on modification time. However there is still another problem, the SID is appended to each request making the URI unique for every session.

      Proposed solutions is to remove the SID and actually use the passed lang= variable. Age based negotiation of freshness could also be added but significant benefits will be made from using persistent URIs.

        Issue Links

          Activity

          Hide
          Oleg Oleg [X] (Inactive) added a comment -

          For boards which do not edit styles in acp, infinite caching can be done via rails-style modification time stamp.

          When computing style.php link:

          1. remove sid for best results
          2. add mtime=$mtime to url, where $mtime is modification time of stylesheet.css (same as current refreshing logic)
          3. use lang parameter as described

          When rendering style, if mtime parameter was given, output max-age=infinity cache control header.

          Users would need to touch/upload stylesheet.css when making any style changes.

          A setting in acp would control whether this caching mode is on.

          I have a feeling most boards that are concerned with performance would not be editing styles in acp.

          Show
          Oleg Oleg [X] (Inactive) added a comment - For boards which do not edit styles in acp, infinite caching can be done via rails-style modification time stamp. When computing style.php link: 1. remove sid for best results 2. add mtime=$mtime to url, where $mtime is modification time of stylesheet.css (same as current refreshing logic) 3. use lang parameter as described When rendering style, if mtime parameter was given, output max-age=infinity cache control header. Users would need to touch/upload stylesheet.css when making any style changes. A setting in acp would control whether this caching mode is on. I have a feeling most boards that are concerned with performance would not be editing styles in acp.
          Hide
          ToonArmy Chris Smith added a comment -

          Realised the expires header combined with the SID ensures the cache will always 'expire' next time you get a new SID.

          Show
          ToonArmy Chris Smith added a comment - Realised the expires header combined with the SID ensures the cache will always 'expire' next time you get a new SID.
          Hide
          ToonArmy Chris Smith added a comment -

          We could theoretically introduce a timestamp into the URL we know the mtime of the style in the database if it's edited like that. File storage would have to be enumerated each request. That way we have no worries over use of the expires header whilst not having different URIs per session.

          I'm thinking this might be a little big for 3.0 but I'll push my changes as is to GitHub.

          Show
          ToonArmy Chris Smith added a comment - We could theoretically introduce a timestamp into the URL we know the mtime of the style in the database if it's edited like that. File storage would have to be enumerated each request. That way we have no worries over use of the expires header whilst not having different URIs per session. I'm thinking this might be a little big for 3.0 but I'll push my changes as is to GitHub.
          Hide
          Oleg Oleg [X] (Inactive) added a comment -

          You can't check all database rows affecting style.php output, so which entries are you going to check?

          Show
          Oleg Oleg [X] (Inactive) added a comment - You can't check all database rows affecting style.php output, so which entries are you going to check?

            People

            • Assignee:
              bantu Andreas Fischer
              Reporter:
              ToonArmy Chris Smith
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development