Page MenuHomeIn-Portal Phabricator

INP-1730 - Add param/skip_param support for "key" parameter of "m_Cache" tag
Needs RevisionPublic

Authored by alex on Dec 12 2017, 10:00 AM.

Details

Reviewers
erik
Test Plan

Template:

<br/>
<br/>
<br/>
<inp2:m_Cache>
T_DEF: <?php echo date('Y-m-d H:i:s'); ?><br/>
</inp2:m_Cache>

<inp2:m_Cache key="skip_var:page">
T_SKIP_VAR[page]: <?php echo date('Y-m-d H:i:s'); ?><br/>
</inp2:m_Cache>

<inp2:m_Cache key="var:test">
T_ADD_VAR[test]: <?php echo date('Y-m-d H:i:s'); ?><br/>
</inp2:m_Cache>

<inp2:m_Cache key="skip_prefix:phrases">
T_SKIP_PREFIX[phrases]: <?php echo date('Y-m-d H:i:s'); ?><br/>
</inp2:m_Cache>

<inp2:m_Cache key="prefix:poll">
T_PREFIX[poll]: <?php echo date('Y-m-d H:i:s'); ?><br/>
</inp2:m_Cache>

<inp2:m_Cache key="prefix_id:poll">
T_PREFIX_ID[poll]: <?php echo date('Y-m-d H:i:s'); ?><br/>
</inp2:m_Cache>

<inp2:m_Cache key="param:test_param_missing">
T_PARAM[test_param_missing]: <?php echo date('Y-m-d H:i:s'); ?><br/>
</inp2:m_Cache>

<inp2:m_SetParam test_param_existing="1"/>
<inp2:m_Cache key="param:test_param_existing">
T_PARAM[test_param_existing]: <?php echo date('Y-m-d H:i:s'); ?><br/>
</inp2:m_Cache>

Preparations

  • in IDE:
    1. create themes/advanced/test.tpl template with above shown content
    2. in /system/config.php make sure, that $_CONFIG['Misc']['CacheHandler'] is set to 'Memcache'
  • in Admin Console:
    1. press Rescan Themes toolbar button in ConfigurationWebsiteThemes section
    2. enable Enable Tag Caching setting in ConfigurationWebsiteAdvanced section
NOTE: Replace ... in urls with base URL of your In-Portal installation.

Part 1 (default config)

  1. open .../test.html URL
  2. remember value after T_...: (e.g. after T_DEF: and so on)
  3. reload page several times
  4. confirm, that remembered values haven't changed

Part 2 (request variables)

  1. open .../test.html URL
  2. remember value after T_...: (e.g. after T_DEF: and so on)
  3. open .../test.html?page=1 URL
  4. confirm, that:
    • value after T_DEF: have changed
    • value after T_SKIP_VAR[page]: haven't changed
    • value after T_ADD_VAR[test]: haven't changed
  5. remember value after T_...: (e.g. after T_DEF: and so on)
  6. reload page several times
  7. confirm, that remembered values haven't changed

Part 3 (skip prefixes)

  1. open .../test.html URL
  2. remember value after T_...: (e.g. after T_DEF: and so on)
  3. in Admin Console change translation of la_Active phrase in Website & ContentLabels & Phrases section
  4. reload the page
  5. confirm, that all values, except after T_SKIP_PREFIX[phrases]: were changed
  6. remember value after T_...: (e.g. after T_DEF: and so on)
  7. reload page several times
  8. confirm, that remembered values haven't changed

Part 4 (prefixes)

  1. open .../test.html URL
  2. remember value after T_...: (e.g. after T_DEF: and so on)
  3. in Admin Console create new poll in Website & ContentPolls section
  4. reload the page
  5. confirm, that only value after T_PREFIX[poll]: was changed
  6. remember value after T_...: (e.g. after T_DEF: and so on)
  7. reload page several times
  8. confirm, that remembered values haven't changed

Part 5 (prefix_ids)

  1. open .../test.html?poll_id=1 URL
  2. remember value after T_...: (e.g. after T_DEF: and so on)
  3. in Admin Console change something in poll with ID=1 in Website & ContentPolls section
  4. reload the page
  5. confirm, that only values after T_PREFIX[poll]: and T_PREFIX_ID[poll]: were changed
  6. remember value after T_...: (e.g. after T_DEF: and so on)
  7. reload page several times
  8. confirm, that remembered values haven't changed

Part 6 (param)

  1. open .../test.html URL
  2. remember value after T_...: (e.g. after T_DEF: and so on)
  3. in IDE: change <inp2:m_SetParam test_param_existing="1"/> to the <inp2:m_SetParam test_param_existing="2"/>
  4. reload the page
  5. confirm, that only value after T_PARAM[test_param_existing]: was changed
  6. remember value after T_...: (e.g. after T_DEF: and so on)
  7. reload page several times
  8. confirm, that remembered values haven't changed

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.2.x
Lint
Lint ErrorsExcuse: CS fixing only added code would only make other code look worse.
SeverityLocationCodeMessage
Errorcore/kernel/nparser/nparser.php:1048PHPCS.E.CodingStandard.Array.Array.SpaceAfterKeywordCodingStandard.Array.Array.SpaceAfterKeyword
Errorcore/kernel/nparser/nparser.php:1048PHPCS.E.Generic.PHP.LowerCaseKeyword.FoundGeneric.PHP.LowerCaseKeyword.Found
Errorcore/kernel/nparser/nparser.php:1050PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace
Errorcore/kernel/nparser/nparser.php:1050PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace
Errorcore/kernel/nparser/nparser.php:1051PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace
Errorcore/kernel/nparser/nparser.php:1051PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace
Errorcore/kernel/nparser/nparser.php:1081PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace
Errorcore/kernel/nparser/nparser.php:1081PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace
Errorcore/kernel/nparser/nparser.php:1082PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace
Errorcore/kernel/nparser/nparser.php:1082PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace
Errorcore/kernel/nparser/nparser.php:1087PHPCS.E.CodingStandard.Commenting.InlineComment.InvalidEndCharCodingStandard.Commenting.InlineComment.InvalidEndChar
Errorcore/kernel/nparser/nparser.php:1087PHPCS.E.CodingStandard.Commenting.InlineComment.NotCapitalCodingStandard.Commenting.InlineComment.NotCapital
Errorcore/kernel/nparser/nparser.php:1093PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace
Errorcore/kernel/nparser/nparser.php:1093PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace
Errorcore/kernel/nparser/nparser.php:1100PHPCS.E.CodingStandard.Commenting.InlineComment.InvalidEndCharCodingStandard.Commenting.InlineComment.InvalidEndChar
Errorcore/kernel/nparser/nparser.php:1100PHPCS.E.CodingStandard.Commenting.InlineComment.NotCapitalCodingStandard.Commenting.InlineComment.NotCapital
Errorcore/kernel/nparser/nparser.php:1103PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace
Errorcore/kernel/nparser/nparser.php:1103PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace
Errorcore/kernel/nparser/nparser.php:1106PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace
Errorcore/kernel/nparser/nparser.php:1106PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace
Errorcore/kernel/nparser/nparser.php:1150PHPCS.E.CodingStandard.Commenting.InlineComment.InvalidEndCharCodingStandard.Commenting.InlineComment.InvalidEndChar
Errorcore/kernel/nparser/nparser.php:1150PHPCS.E.CodingStandard.Commenting.InlineComment.NotCapitalCodingStandard.Commenting.InlineComment.NotCapital
Errorcore/kernel/nparser/nparser.php:1154PHPCS.E.CodingStandard.Commenting.InlineComment.InvalidEndCharCodingStandard.Commenting.InlineComment.InvalidEndChar
Errorcore/kernel/nparser/nparser.php:1154PHPCS.E.CodingStandard.Commenting.InlineComment.NotCapitalCodingStandard.Commenting.InlineComment.NotCapital
Warningcore/kernel/nparser/nparser.php:1043PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Unit
No Unit Test Coverage
Build Status
Buildable 824
Build 824: arc lint + arc unit

Event Timeline

alex created this revision.Dec 12 2017, 10:00 AM
alex edited the test plan for this revision. (Show Details)Dec 12 2017, 10:01 AM
alex added a project: Restricted Project.Dec 12 2017, 10:11 AM
erik edited edge metadata.Dec 12 2017, 2:00 PM

Part 1 test not passed. - https://www.screencast.com/t/n8hWHlZ8zes

Others parts not tested due lack of time this day.

alex edited the test plan for this revision. (Show Details)Dec 13 2017, 12:50 AM
In D330#6498, @erik wrote:

Part 1 test not passed. - https://www.screencast.com/t/n8hWHlZ8zes

Others parts not tested due lack of time this day.

My apologies. I've totally forgot that to make template caching work a memcache caching needs to be enabled + system setting for tag caching needs to be turned on. Updated preparations part of test plan.

erik requested changes to this revision.Dec 14 2017, 6:36 AM

Tested, all tests passed, excepting Test2 in part "value after T_ADD_VAR[test]: haven't changed" - this value changed in this test
https://www.screencast.com/t/25QIBxii

This revision now requires changes to proceed.Dec 14 2017, 6:36 AM