Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

There is no such concept as "Web Request" and "Session" or even "User is Logged In" concepts when In-Portal is executed from CLI (command-line). Yet the corresponding access methods for objects representing these concepts (GetVar, SetVar, RecallVar, StoreVar) still work and are used in In-Portal.

Solution

I propose, that we:

  1. sub-class the kApplication class and use that sub-class instead of kApplication class from CLI
  2. find usages of above mentioned methods, that at least make some sense in CLI
  3. extract those particular usages into methods on kApplication class
  4. change extracted methods in the CLI kApplication class version to return sane values
ConceptIn Web RequestIn CLI
logged-in user id$this->Application->RecallVar('user_id')
  • no session
  • no permission checking
  • no logged-in user concept
  • always return fixed user id
is ajax request$this->Application->GetVar('ajax') == 'yes'
  • no web request
  • always return false
current language id$this->Application->GetVar('m_lang')
  • no web request
  • always return primary language id
current theme id$this->Application->GetVar('m_theme')
  • no web request
  • always return primary theme id
automatic object loading by ID in urlcode inside "kDBEventHandler::StoreSelectedIDs" method
  • no web request
  • throw an exception on loading attempt
getting current site domain field$this->Application->siteDomainField('FieldName')
  • no web request
  • no domains
  • always return false
current session id$this->Application->GetSID()
  • no session
  • always return ID of current process ID (PID)
main popup window identifier$this->Application->GetTopmostWid()
  • no windows in CLI
  • always return an empty string
popup window identifier$this->Application->GetVar('m_wid')
  • no windows in CLI
  • always return an empty string
is current user logged-in$this->Application->LoggedIn()
  • no session
  • no permission checking
  • no logged-in user concept
  • always return false
website visitor IP address$this->Application->getClientIP()
  • no web request
  • always return empty string
attempt to read/write web request data
  • $this->Application->GetVar(..., ...)
  • $this->Application->SetVar(..., ...)
  • $this->Application->DeleteVar(...)
  • no web request
  • create in-memory storage to be used instead of session
  • used during url building a lot
attempt to read/write web request dataother methods
  • always throw an exception
attempt to read/write session data
  • $this->Application->StoreVar(..., ...)
  • $this->Application->RecallVar(..., ...)
  • $this->Application->RemoveVar(...)
  • no session
  • create in-memory storage to be used instead of session
  • used in some scheduled tasks as temp storage
attempt to read/write session dataother methods
  • always throw an exception

Even though most of methods mentioned makes no sense in CLI they still return value that makes sense to avoid changing every call site.

Related Tasks

  • No labels