Unexpected output: Affected paths: relative - resubmit patch.
⚙ D180 INP-1516 - Do not use "Web Request" and "Session" concepts in CLI
Page MenuHomeIn-Portal Phabricator

INP-1516 - Do not use "Web Request" and "Session" concepts in CLI
Changes PlannedPublic

Authored by alex on Dec 6 2015, 8:16 AM.

Details

Reviewers
erik
Test Plan

Files removed:

  • install.php (in each module) - because module install is allowed to "root" user, not whoever doesn't have permission checking enabled
  • modules_event_handler.php, modules_tag_processor.php - because module install is allowed to "root" user, not whoever doesn't have permission checking enabled
  • languates_event_handler.php, themes_eh.php - optimization moved to separate task
  • ost_eh.php, private_message_eh.php, topics_event_handler.php - optimization moved to separate task

Goals

  • execute every changed code fragment from CLI and Web
  • confirm, that every scheduled task can run from CLI
  • confirm, that deploy works from CLI
  • apply dependency patches & test them from CLI & web (when relevant) as well
  • test new kApplication::permissionCheckingDisabled method indirectly by confirming that:
    • in CLI no permissions are checked
    • in Web no permissions are checked for "root" user

TODO

Plan (output differencies between CLI and Web deploy)

NOTE: Memcache needs to be enabled for this part of the test.
  • in the CLI
    1. run the in-portal event:run adm:OnDeploy command
    2. confirm, that command output is present, when running do_update script
    3. confirm, that no errors happened
    4. run the in-portal command
    5. confirm, that available commands were listed
  • in Admin Console
    1. go to ToolsSystem Tools section
    2. enter master:last_cache_rebuild into Key Name field in the Memory Cache sub-section
    3. press the Get Value button next to Key Name input
    4. agree to data display in confirmation dialog, that appears
    5. confirm, that Key Value textarea contains value similar to this: CLI - 24/01/2016 13:42:01 (general format: CLI - DD/MM/YYYY HH:MM:SS)
    6. press the Deploy button in the Project Deployment sub-section
    7. enter master:last_cache_rebuild into Key Name field in the Memory Cache sub-section
    8. press the Get Value button next to Key Name input
    9. agree to data display in confirmation dialog, that appears
    10. confirm, that Key Value textarea contains value similar to this: vm.aik.ninja (10.0.0.1) - 24/01/2016 13:46:05 (general format: HTTP_HOST (REMOTE_ADDR) - DD/MM/YYYY HH:MM:SS)
    11. press the "Reset" button in "Reset Parsed and Cached System Data" sub-section
    12. confirm, that "Last operation has been successfully completed!" green message appeared on top
    13. press "Reset & Validate Config Files" button in "Reset Parsed and Cached System Data" sub-section
    14. confirm, that "Last operation has been successfully completed!" green message appeared on top
    15. confirm, that debugger report was opened automatically
    16. confirm, that debugger report contains list of problematic unit configs

Plan (...)

  • in PhpStorm:
    1. create "custom-sections:OnTest" event
    2. add an "echo" statement in it
  • in CLI:
    1. run the in-portal event:run custom-sections:OnTest command
    2. confirm, that output contains result of that "echo" statement

TODO

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.3.x
Lint
Lint ErrorsExcuse: Indentations issues and issues not related to changed code were ignored.
SeverityLocationCodeMessage
Errorcore/kernel/db/cat_event_handler.php:2887PHPCS.E.CodingStandard.Commenting.TypeComment.WrongStyleCodingStandard.Commenting.TypeComment.WrongStyle
Errorcore/kernel/managers/hook_manager.php:144PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace
Errorcore/kernel/managers/hook_manager.php:144PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBraceCodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace
Errorcore/units/categories/categories_event_handler.php:1686PHPCS.E.Generic.Files.LineLength.MaxExceededGeneric.Files.LineLength.MaxExceeded
Errorcore/units/categories/categories_event_handler.php:2217PHPCS.E.CodingStandard.Commenting.TypeComment.WrongStyleCodingStandard.Commenting.TypeComment.WrongStyle
Errorcore/units/helpers/permissions_helper.php:846PHPCS.E.CodingStandard.Classes.ClassDeclaration.SpaceBeforeCloseBraceCodingStandard.Classes.ClassDeclaration.SpaceBeforeCloseBrace
Errorcore/units/scheduled_tasks/scheduled_task_eh.php:280PHPCS.E.CodingStandard.Classes.ClassDeclaration.SpaceBeforeCloseBraceCodingStandard.Classes.ClassDeclaration.SpaceBeforeCloseBrace
Errormodules/in-commerce/units/addresses/addresses_event_handler.php:105PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExactGeneric.WhiteSpace.ScopeIndent.IncorrectExact
Errormodules/in-commerce/units/addresses/addresses_event_handler.php:401PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExactGeneric.WhiteSpace.ScopeIndent.IncorrectExact
Errormodules/in-commerce/units/addresses/addresses_event_handler.php:458PHPCS.E.CodingStandard.Classes.ClassDeclaration.SpaceBeforeCloseBraceCodingStandard.Classes.ClassDeclaration.SpaceBeforeCloseBrace
Errormodules/in-commerce/units/addresses/addresses_event_handler.php:458PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExactGeneric.WhiteSpace.ScopeIndent.IncorrectExact
Errormodules/in-link/units/link_validation/link_validation_eh.php:498PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExactGeneric.WhiteSpace.ScopeIndent.IncorrectExact
Warningcore/kernel/db/cat_event_handler.php:2772PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Unit
No Unit Test Coverage
Build Status
Buildable 646
Build 646: arc lint + arc unit

Event Timeline

alex updated this revision to Diff 429.Dec 6 2015, 8:16 AM
alex retitled this revision from to INP-1516 - Do not use "Web Request" and "Session" concepts in CLI.
alex updated this object.
alex edited the test plan for this revision. (Show Details)
alex added 1 JIRA issue(s): INP-1516.
alex updated this revision to Diff 430.Dec 6 2015, 8:32 AM
alex edited edge metadata.

Rollback changes, that were added through applying another needed patch.

alex edited the test plan for this revision. (Show Details)Dec 14 2015, 4:57 AM
alex updated this revision to Diff 471.Jan 23 2016, 2:52 PM

Resending same patch, because affected files were changed in recently applied/committed patches.

alex edited the test plan for this revision. (Show Details)Jan 24 2016, 4:25 AM
alex updated this revision to Diff 472.Jan 24 2016, 4:28 AM

Change isWebRequest checking way during address editing/removal to account for 5.2.x changes in checkItemStatus method.

alex planned changes to this revision.Jun 20 2016, 5:04 AM
alex edited reviewers, added: erik; removed: glebs.

Need to finalize test plan.

alex added inline comments.Nov 28 2016, 3:52 AM
core/units/languages/languages_event_handler.php
99–100 ↗(On Diff #472)

Remove.


Part of patch from http://jira.in-portal.org/browse/INP-1543 task.

core/units/themes/themes_eh.php
90–91 ↗(On Diff #472)

Remove.


Part of patch from http://jira.in-portal.org/browse/INP-1543 task.

core/units/users/users_event_handler.php
250–252 ↗(On Diff #472)

Revert.


Part of patch from http://jira.in-portal.org/browse/INP-1544 task.

modules/in-bulletin/units/posts/post_eh.php
402–405 ↗(On Diff #472)

Remove.


Part of patch from http://jira.in-portal.org/browse/MINB-26 task.

modules/in-bulletin/units/private_messages/private_message_eh.php
239–242 ↗(On Diff #472)

Remove.


Part of patch from http://jira.in-portal.org/browse/MINB-26 task.

modules/in-bulletin/units/topics/topics_event_handler.php
220–223 ↗(On Diff #472)

Remove.


Part of patch from http://jira.in-portal.org/browse/MINB-26 task.

alex updated this revision to Diff 677.Jan 7 2017, 10:26 AM

Rebuilt against current 5.3.x code. Fixed some CS issues along the way.

alex updated this revision to Diff 678.Jan 7 2017, 10:29 AM

Removed composer.lock file, that was added by accident.

alex planned changes to this revision.Jan 7 2017, 10:46 AM

I wasn't planning to send this one out for review, but arc diff --update did that automatically.

alex updated this revision to Diff 679.Jan 7 2017, 12:49 PM

Override kApplication::Run and kApplication::Done methods in ConsoleApplication class to perform CLI-specific actions.

alex planned changes to this revision.EditedJan 7 2017, 12:49 PM

I wasn't planning to send this one out for review, but arc diff --update did that automatically.

alex updated this revision to Diff 680.Jan 7 2017, 2:11 PM

Don't consider installation-specific code, that checks for root user as permission-related code.

alex planned changes to this revision.Jan 7 2017, 2:13 PM

I wasn't planning to send this one out for review, but arc diff --update did that automatically.

alex updated this revision to Diff 682.Jan 10 2017, 4:02 AM

Reconsidered relations between root user and permission system:

  • use root user (not permission system in general) for checking CATEGORY.VIEW instead of LINK.VIEW permission in PrintList of category items and their category selection
  • use permission checking when determening access to addr unit object instead of just doing that for web request
alex planned changes to this revision.Jan 10 2017, 4:03 AM

I wasn't planning to send this one out for review, but arc diff --update did that automatically.

alex edited the test plan for this revision. (Show Details)Jan 20 2017, 4:35 AM