Tags:
dakar1Add my vote for this tag development1Add my vote for this tag upgrade1Add my vote for this tag create new tag
, view all tags
Note: I use the word "Dakar" where I really mean "DEVELOP"

OO crib sheet

If you have mangled TWiki for you own purposes, or written a plugin or add-on that pokes into the core, then you need this crib sheet. In the shift from Cairo to Dakar, a large number of internal interfaces have changed. This will not affect you if you used only the Func interface but if you short-circuited that interface, some functions you used may have changed or disappeared entirely. This crib sheet shows the mapping between functions in Cairo and their equivalents in Dakar, to assist in porting.

One important thing to understand is the effect of eliminating global variables, in order to support mod_perl. This has been done by creating objects with only one instance that represent the packages in TWiki - for example, instead of there being a "Prefs module" that holds preferences in global variables, there is now a "preferences object" that contains those preferences.

Global data in the TWiki module has also been formally split into "site" and "session" data. Site data comes from the TWikiDotCfg file, and is not expected to change, so it is still in the old global variables, but these must be treated as _constants. Session data is specific to a single query, and has been moved into the TWiki "session object", $TWiki::T. This session object also contains references to a number of other session-specific objects corresponding to the different TWiki modules; for example,

  • Store - TWiki:T->{store}
  • Access - TWiki:T->{security}
  • Prefs - TWiki:T->{prefs}
  • etc

From a programmer perspective the main impact this has is to change the way you call core functions and refer to session global variables. Instead of calling functions using syntax like "TWiki::Prefs::getPreferencesVariable", you now have to indirect via the TWiki session object. e.g. TWiki::T->{prefs}->getPreferencesValue(...)=. Per-session variables such as the old $TWiki::webName are now accessed via $TWiki::T->{webName}.

Not all packages are affected, only those with data in global variables, and not all functions in the affected packages - some are purely static (do not refer to global data), and have been left that way. If you are unsure, look at the core code. If the method you want to use has a new first parameter $this or $self it has become an object method and must be called via the session object.

Having said all that, if your extension is referring to $TWiki::T you are doing something wrong. You should probably be using the FuncDotPm module, or campaigning to get that module extended to support your extension! And a word of warning; if you module has any session-specific global variables it will probably not work under mod_perl.

There are also changes to the location and/or naming of many methods. The table below gives the approximate mapping. It has been generated during the changes and may be inaccurate in some ways, but you should be able to resolve any unknowns by reading the code. Note that any methods that now start with an underscore are now private to the module and _must not be called from outside that module_, even by other core modules. No mapping has been given for methods that were private in Cairo; you are on your own if you've been crazy enough to call these.

Cairo Use instead:
$TWiki::Store::readTopicPermissionFailed $TWiki::T->{store}->accessFailed()
TWiki::UI::Upload::_addLinkToEndOfTopic dead
  $TWiki::T->{store}->attachmentExists
TWiki::cleanupIncludedHTML private
  $TWiki::T->{store}->cleanUpRevID
TWiki::Meta::cleanValue dead
TWiki::Store::convert2metaFormat dead
TWiki::Store::RcsFile::delete dead
TWiki::Render::emitList private
TWiki::Render::emitTR private
TWiki::Store::erase dead
TWiki::Render::externalLink private
TWiki::Attach::filenameToIcon $TWiki::T->{renderer}->filenameToIcon
TWiki::Render::fixedFontText private
TWiki::fixIncludeLink private
TWiki::fixN private
TWiki::fixURL private
TWiki::Prefs::formatAsFlag private
TWiki::Prefs::formatAsNumber dead
  $TWiki::T->{store}->getAttachmentStream
TWiki::getDataDir $TWiki::T->{dataDir}
  $TWiki::T->{store}->getDebugText
TWiki::getEmailNotifyList pending User module rewrite
TWiki::getEmailOfUser pending User module rewrite
TWiki::Store::getFileName  
TWiki::Form::getFormDefinition dead
TWiki::Render::getFormField TWiki::_handleFORMFIELD
TWiki::Form::getFormInfoFromMeta dead
TWiki::Access::getGroupsUserIsIn $TWiki::T->{security}->getGroupsUserIsIn
TWiki::Access::getListOfGroups private
TWiki::Attach::getOldAttachAttr private
TWiki::getPageMode $TWiki::T->{renderer}->{MODE}
TWiki::Prefs::getPreferencesFlag TWiki::Func::getPreferencesFlag
TWiki::Prefs::getPreferencesNumber TWiki::Func::getPreferencesNumber
TWiki::Prefs::getPreferencesValue TWiki::Func::getPreferencesValue
TWiki::Prefs::getPrefsFromTopic $TWiki::T->{prefs}->getPrefsFromTopic
TWiki::getPubDir TWiki::Func::getPubDir
TWiki::getPubUrlPath $TWiki::T->{pubUrlPath}
TWiki::Render::getRenderedVersion TWiki::Func::renderText
TWiki::Store::getRevisionInfoFromMeta TWiki::Meta::getRevisionInfo
TWiki::Store::getRevisionNumberX $TWiki::T->{store}->getTopic
TWiki::getSessionValue dead
TWiki::Store::getSubWebs private
TWiki::Store::getTopicNames TWiki::Func::getTopicList
  $TWiki::T->{store}->getTopicParent
TWiki::Prefs::getTopicPrefs dead
TWiki::Access::getUsersOfGroup private
TWiki::Access::prvGetUsersOfGroup private
TWiki::Access::prvGetWebTopicName private
TWiki::getWikiUserTopic dead
TWiki::Plugins::handleActivatedPlugins private
TWiki::handleEnvVariable private
TWiki::handleIcon private
TWiki::handleIncludeFile private
TWiki::handleIncludeUrl private
TWiki::handleInternalTags TWiki::Func::expandCommonVariables
TWiki::handleIntUrlEncode private
| TWiki::handleNativeUrlEncode | =TWiki::nativeUrlEncode
= TWiki::handleUrlEncode TWiki::_urlEncode TWiki::entityEncode
TWiki::handleMetaSearch private
TWiki::handleMetaTags private
TWiki::Plugins::handlePluginDescription private
TWiki::Prefs::handlePreferencesTags TWiki::expandCommonVariables
TWiki::handleRelativeTopicPath private
TWiki::handleRevisionInfo private
TWiki::handleSearchWeb private
TWiki::handleTime private
TWiki::handleSpacedTopic private
TWiki::handleTmplP private
TWiki::Store::handleTmplP private
TWiki::handleToc private
TWiki::handleUrlParam private
TWiki::handleWebAndTopicList private
TWiki::Plugins::initialisationError private
TWiki::Access::initializeAccess dead use security object
TWiki::Prefs::initializePrefs dead use prefs object
TWiki::initializeRemoteUser $TWiki::T->{users}->initializeRemoteUser
TWiki::Render::initialize dead use renderer object
TWiki::Store::initialize dead use store object
TWiki::Prefs::initializeUserPrefs $TWiki::T->{prefs}->initializeUser
TWiki::Prefs::insertPrefsValue private
TWiki::Render::internalCrosswebLink dead
TWiki::invalidSiteCharset private
TWiki::isAbbrev TWiki::isValidAbbrev
TWiki::isGuest dead
TWiki::isWebName TWiki::isValidWebName
TWiki::isWikiName TWiki::isValidWikiWord TWiki::isValidTopicName
TWiki::Render::linkToolTipInfo private
TWiki::Store::lockTopicNew $TWiki::T->{store}->lockTopic
TWiki::Render::mailtoLinkFull private
TWiki::Render::mailtoLinkSimple private
TWiki::Render::mailtoLink private
TWiki::Render::makeAnchorHeading private
TWiki::Render::makeAnchorName $TWiki::T->{renderer}->makeAnchorName
TWiki::makeTopicSummary $TWiki::T->{renderer}->makeTopicSummary
TWiki::Store::metaAddTopicData dead
TWiki::Attach::migrateFormatForTopic dead
TWiki::Store::normalizeWebTopicName TWiki::normalizeWebTopicName
TWiki::Prefs::parseMeta $TWiki::T->{prefs}->Parser::parseMeta
TWiki::Prefs::parseText $TWiki::T->{prefs}->Parser::parseText
TWiki::Access::prvGetUserList private
TWiki::Access::permissionsSet $TWiki::T->{security}->permissionsSet
TWiki::processTags TWiki::_processTags
TWiki::Prefs::prvGetWebVariable $TWiki::T->{prefs}->getPreferencesValue + formatting
TWiki::putBackVerbatim $TWiki::T->{renderer}->putBackBlocks
TWiki::Store::readAttachmentVersion $TWiki::T->{store}->readAttachmentVersion
TWiki::Store::readFileHead $TWiki::T->{store}->readFile
TWiki::Store::readFile $TWiki::T->{store}->readFile
TWiki::Prefs::readPrefs $TWiki::T->{prefs}->TopicPrefs::readPrefs
TWiki::Store::readTemplateTopic TWiki::UI::readTemplateTopic
TWiki::Store::readTemplate TWiki::Templates::readTemplate
TWiki::Store::readTopicRaw $TWiki::T->{store}->readTopicRaw
TWiki::Store::readTopic $TWiki::T->{store}->readTopic
TWiki::Store::readTopicVersion $TWiki::T->{store}->readTopic
TWiki::Store::readTopMeta $TWiki::T->{store}->readTopic
TWiki::Meta::read dead
TWiki::Store::readWebTopic $TWiki::T->{store}->readTopicRaw
TWiki::Plugins::registerHandler private
TWiki::Plugins::registerPlugin private
TWiki::UI::Manage::relockRcsFiles dead
TWiki::Attach::removeFile dead
TWiki::Render::renderFormData private
TWiki::Render::renderMoved private
TWiki::Render::renderParent private
TWiki::Prefs::replacePreferencesTags TWiki::processTags
TWiki::Prefs::resetCache $TWiki::T->{prefs}->PrefsCache::resetCache
TWiki::revDate2EpSecs TWiki::Store::revDate2EpSecs
TWiki::Store::saveNew $TWiki::T->{store}->saveTopic $TWiki::T->{store}->saveAttachment
TWiki::Store::saveTopicNew =$TWiki::T->{store}->saveTopic
TWiki::Store::save $TWiki::T->{store}->saveTopic $TWiki::T->{store}->saveAttachment
TWiki::setPageMode $TWiki::T->{renderer}->setRenderMode
TWiki::setSessionValue  
TWiki::Store::setTopicRevisionTag private
TWiki::setupLocale private
TWiki::setupRegexes private
TWiki::showError private
TWiki::Search::spacedTopic TWiki::searchableTopic
TWiki::Render::specificLink private
TWiki::takeOutVerbatim $TWiki::T->{renderer}->takeOutBlocks
TWiki::Attach::updateAttachment TWiki::UI::Upload::updateAttachment
TWiki::Attach::updateProperties dead
TWiki::Store::updateReferingPages $TWiki::T->{store}->updateReferringPages
TWiki::Prefs::updateSetFromForm TWiki::Meta::updateSets
TWiki::Form::upgradeCategoryItem private
TWiki::userToWikiListInit See TWiki::User
TWiki::Store::RcsLite::validTo dead
TWiki::writeDebugTimes dead
TWiki::UI::writeDebugTimes dead
TWiki::Store::writeDebug $TWiki::T->writeDebug
TWiki::Meta::writeEnd private
TWiki::Store::writeLog $TWiki::T->writeLog
TWiki::Meta::write private
TWiki::Meta::writeStart private

-- CrawfordCurrie - 08 Dec 2004

Topic revision: r3 - 10 Dec 2004 - 09:03:16 - CrawfordCurrie
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback