Skip to content
Permalink
Browse files

Item4795: major refactoring of internal APIs in preparation for a new

database store module. This is only phase one of several.

Foswiki::Meta is now a "handle" to a store element. A store element may
be a topic, a web, or the root of repository. You create a new handle
for a topic using $topicObject = Foswiki::Meta->new($session, $web,
$topic). At first the new object is just a stub; the topic isn't loaded
until you (1) call a function such as text() which loads the topic from
the store (if it exists) (2) explicitly load a revision of the topic by
calling $topicObject->reload(). You can create a new stub and load it in
one move using $topicObject = Foswiki::Meta->load($session, $web,
$topic). Most of the methods that you would have previously called on
{store} are now invoked on a handle. Attachments and forms do not have
their own store handles; it would have been stretching the point too far
at this stage.

Use of {store} has been driven out of most code modules except
Foswiki::Meta and Foswiki. All other modules should use the Meta object.

The store itself has been refactored to make the Foswiki::Store class an
interface (pure virtual base class in C++ terms). A subclass,
Foswiki::Store::VCStore, inherits the responsibilities of the old
Foswiki::Store class. Foswiki::Store::VCStore is a factory class that
works with Foswiki::Store::VCHandler. Foswiki::Store::VCHandler= is
extended by Foswiki::Store::RcsLiteHandler= and
Foswiki::Store::RcsWrapHandler (c.f. old RcsFile, RcsWrap and RcsLite).
In this way the various store layers are decoupled, making it much, much
easier to plug in an alternate store implementation.

Finally bit the bullet and rationalised the getRevisionInfo problem,
where callers had to know whether to recover revision info from the meta
object, or from the store.

Refactored the Prefs to much cleaner code. One effect of this is that
there are fewer methods exposed, and most preferences are recovered
using a simple getPreference call on the $topicObject (or $webObject),
and %SESSION_TAGS no longer exists (phew).

The expansion of macros and the rendering of TML are no longer invoked
directly via the singletons. Instead they are invoked via the object,
for example, $this->{session}->handleCommonTags($text, $web, $topic) is now
called using $topicObject->expandMacros($text) and
$this->{session}->renderer->getRenderedVersion($text, $topic, $web)
becomes $topicObject->renderTML($text)=

Macro expansion methods are now passed a topic object rather than web,
topic. The interface to tag handlers registered by plugins remains
unchanged.

Broke out the rename functionality from Manage.pm, and the password
management from Register.pm

Added unit tests for WEBLIST and TOPICLIST macros.

Ran all the code through perltidy



git-svn-id: http://svn.foswiki.org/trunk@2957 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
CrawfordCurrie CrawfordCurrie
CrawfordCurrie authored and CrawfordCurrie committed Mar 10, 2009
1 parent 1d7ecc1 commit 142fd927aa4a8cfb6d70d714ee4e9ac767083b11
Showing with 15,786 additions and 14,102 deletions.
  1. +11 −7 CommentPlugin/lib/Foswiki/Plugins/CommentPlugin.pm
  2. +181 −121 CommentPlugin/lib/Foswiki/Plugins/CommentPlugin/Comment.pm
  3. +1 −1 CommentPlugin/test/unit/CommentPlugin/CommentPluginSuite.pm
  4. +267 −252 CommentPlugin/test/unit/CommentPlugin/CommentPluginTests.pm
  5. +1 −1 EditTablePlugin/test/unit/EditTablePlugin/EditTablePluginSuite.pm
  6. +14 −19 EditTablePlugin/test/unit/EditTablePlugin/EditTablePluginTests.pm
  7. +7 −7 EmptyPlugin/lib/Foswiki/Plugins/EmptyPlugin.pm
  8. +2 −2 EmptyPlugin/test/unit/EmptyPlugin/EmptyPluginSuite.pm
  9. +48 −39 InterwikiPlugin/lib/Foswiki/Plugins/InterwikiPlugin.pm
  10. +51 −48 JSCalendarContrib/lib/Foswiki/Contrib/JSCalendarContrib.pm
  11. +26 −26 JSCalendarContrib/lib/Foswiki/Form/Date.pm
  12. +139 −109 MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm
  13. +57 −47 MailerContrib/lib/Foswiki/Contrib/MailerContrib/Change.pm
  14. +28 −20 MailerContrib/lib/Foswiki/Contrib/MailerContrib/CompatibilityHacks.pm
  15. +3 −2 MailerContrib/lib/Foswiki/Contrib/MailerContrib/Constants.pm
  16. +63 −54 MailerContrib/lib/Foswiki/Contrib/MailerContrib/Subscriber.pm
  17. +24 −22 MailerContrib/lib/Foswiki/Contrib/MailerContrib/Subscription.pm
  18. +13 −12 MailerContrib/lib/Foswiki/Contrib/MailerContrib/TopicContext.pm
  19. +3 −4 MailerContrib/lib/Foswiki/Contrib/MailerContrib/UpData.pm
  20. +140 −117 MailerContrib/lib/Foswiki/Contrib/MailerContrib/WebNotify.pm
  21. +64 −57 MailerContrib/test/unit/MailerContrib/MailerContribSuite.pm
  22. +1 −1 PreferencesPlugin/test/unit/PreferencesPlugin/PreferencesPluginSuite.pm
  23. +59 −53 PreferencesPlugin/test/unit/PreferencesPlugin/PreferencesPluginTests.pm
  24. +13 −17 SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin.pm
  25. +132 −106 SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/SlideShow.pm
  26. +1 −1 SmiliesPlugin/data/System/SmiliesPlugin.txt
  27. +31 −23 SmiliesPlugin/lib/Foswiki/Plugins/SmiliesPlugin.pm
  28. +72 −42 TWikiCompatibilityPlugin/lib/Foswiki/Plugins/TWikiCompatibilityPlugin.pm
  29. +2 −1 TWikiCompatibilityPlugin/lib/TWiki.pm
  30. +1 −1 TWikiCompatibilityPlugin/lib/TWiki/Form.pm
  31. +94 −93 TWikiCompatibilityPlugin/lib/TWiki/Func.pm
  32. +3 −3 TWikiCompatibilityPlugin/lib/TWiki/LineIterator.pm
  33. +2 −2 TWikiCompatibilityPlugin/lib/TWiki/ListIterator.pm
  34. +1 −1 TWikiCompatibilityPlugin/lib/TWiki/Meta.pm
  35. +1 −1 TWikiCompatibilityPlugin/lib/TWiki/Plugins.pm
  36. +17 −15 TWikiCompatibilityPlugin/lib/TWiki/Prefs.pm
  37. +4 −4 TWikiCompatibilityPlugin/lib/TWiki/Sandbox.pm
  38. +8 −8 TWikiCompatibilityPlugin/lib/TWiki/Time.pm
  39. +8 −8 TWikiCompatibilityPlugin/lib/TWiki/UI.pm
  40. +1 −1 TWikiCompatibilityPlugin/test/unit/TWikiCompatibilityPlugin/TWikiCompatibilityPluginSuite.pm
  41. +543 −452 TWikiCompatibilityPlugin/test/unit/TWikiCompatibilityPlugin/TWikiFuncTests.pm
  42. +1 −1 TablePlugin/test/unit/TablePlugin/TablePluginSuite.pm
  43. +33 −32 TablePlugin/test/unit/TablePlugin/TablePluginTests.pm
  44. +53 −43 TinyMCEPlugin/lib/Foswiki/Plugins/TinyMCEPlugin.pm
  45. +167 −163 TopicUserMappingContrib/lib/Foswiki/Users/TopicUserMapping.pm
  46. +49 −37 TopicUserMappingContrib/test/unit/TopicUserMappingContrib/TopicUserMappingContribTests.pm
  47. +79 −73 TopicUserMappingContrib/test/unit/TopicUserMappingContrib/TopicUserMappingTests.pm
  48. +1 −1 TwistyPlugin/test/unit/TwistyPlugin/TwistyPluginSuite.pm
  49. +34 −33 TwistyPlugin/test/unit/TwistyPlugin/TwistyPluginTests.pm
  50. +307 −249 WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin.pm
  51. +97 −74 WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/Constants.pm
  52. +59 −46 WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML.pm
  53. +48 −32 WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Base.pm
  54. +13 −11 WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Leaf.pm
  55. +536 −392 WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm
  56. +32 −32 WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/WC.pm
  57. +276 −203 WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
  58. +1,039 −977 WysiwygPlugin/test/unit/WysiwygPlugin/TranslatorTests.pm
  59. +1 −1 WysiwygPlugin/test/unit/WysiwygPlugin/WysiwygPluginSuite.pm
  60. +140 −117 WysiwygPlugin/test/unit/WysiwygPlugin/WysiwygPluginTests.pm
  61. +8 −8 core/data/System/VarWEBLIST.txt
  62. +3 −1 core/data/TestCases/TestCaseAutoIncludeAttachment.txt
  63. +1 −2 core/data/TestCases/TestCaseAutoIncludes.txt
  64. +2 −2 core/data/TestCases/TestCaseAutoSearch.txt
  65. +474 −626 core/lib/Foswiki.pm
  66. +0 −234 core/lib/Foswiki/Access.pm
  67. +1 −0 core/lib/Foswiki/AggregateIterator.pm
  68. +36 −63 core/lib/Foswiki/Attach.pm
  69. +5 −3 core/lib/Foswiki/Attrs.pm
  70. +44 −7 core/lib/Foswiki/Compatibility.pm
  71. +1 −0 core/lib/Foswiki/Contrib/core/MANIFEST
  72. +5 −3 core/lib/Foswiki/Engine.pm
  73. +1 −1 core/lib/Foswiki/Engine/CGI.pm
  74. +7 −6 core/lib/Foswiki/Engine/CLI.pm
  75. +1 −0 core/lib/Foswiki/EngineException.pm
  76. +82 −0 core/lib/Foswiki/FilterIterator.pm
  77. +80 −93 core/lib/Foswiki/Form.pm
  78. +2 −2 core/lib/Foswiki/Form/Checkbox.pm
  79. +14 −4 core/lib/Foswiki/Form/FieldDefinition.pm
  80. +3 −5 core/lib/Foswiki/Form/Label.pm
  81. +5 −9 core/lib/Foswiki/Form/ListFieldDefinition.pm
  82. +3 −5 core/lib/Foswiki/Form/Radio.pm
  83. +2 −2 core/lib/Foswiki/Form/Select.pm
  84. +2 −3 core/lib/Foswiki/Form/Text.pm
  85. +2 −4 core/lib/Foswiki/Form/Textarea.pm
  86. +256 −188 core/lib/Foswiki/Func.pm
  87. +14 −12 core/lib/Foswiki/I18N.pm
  88. +1 −1 core/lib/Foswiki/I18N/Extract.pm
  89. +6 −2 core/lib/Foswiki/I18N/Fallback.pm
  90. +31 −104 core/lib/Foswiki/If/OP_allows.pm
  91. +2 −134 core/lib/Foswiki/If/OP_defined.pm
  92. +1 −2 core/lib/Foswiki/If/OP_dollar.pm
  93. +1 −2 core/lib/Foswiki/If/OP_isempty.pm
  94. +3 −4 core/lib/Foswiki/If/OP_istopic.pm
  95. +3 −3 core/lib/Foswiki/If/OP_isweb.pm
  96. +9 −8 core/lib/Foswiki/IncludeHandlers/doc.pm
  97. +27 −33 core/lib/Foswiki/IncludeHandlers/http.pm
  98. +1 −2 core/lib/Foswiki/IncludeHandlers/https.pm
  99. +10 −7 core/lib/Foswiki/LineIterator.pm
  100. +29 −0 core/lib/Foswiki/ListIterator.pm
  101. +48 −38 core/lib/Foswiki/Logger/PlainFile.pm
  102. +41 −29 core/lib/Foswiki/LoginManager.pm
  103. +14 −15 core/lib/Foswiki/LoginManager/ApacheLogin.pm
  104. +5 −3 core/lib/Foswiki/LoginManager/Session.pm
  105. +8 −10 core/lib/Foswiki/LoginManager/TemplateLogin.pm
  106. +1,761 −185 core/lib/Foswiki/Meta.pm
  107. +36 −22 core/lib/Foswiki/Net.pm
  108. +3 −1 core/lib/Foswiki/Net/HTTPResponse.pm
  109. +9 −8 core/lib/Foswiki/OopsException.pm
  110. +37 −27 core/lib/Foswiki/Plugin.pm
  111. +22 −20 core/lib/Foswiki/Plugins.pm
  112. +1 −0 core/lib/Foswiki/Plurals.pm
  113. +334 −211 core/lib/Foswiki/Prefs.pm
  114. +137 −0 core/lib/Foswiki/Prefs/Cache.pm
  115. +22 −50 core/lib/Foswiki/Prefs/Parser.pm
  116. +0 −304 core/lib/Foswiki/Prefs/PrefsCache.pm
  117. +69 −0 core/lib/Foswiki/ProcessIterator.pm
  118. +2 −1 core/lib/Foswiki/Query/HoistREs.pm
  119. +5 −3 core/lib/Foswiki/Query/OP_length.pm
  120. +1 −1 core/lib/Foswiki/Query/OP_ref.pm
  121. +460 −618 core/lib/Foswiki/Render.pm
  122. +26 −17 core/lib/Foswiki/Sandbox.pm
  123. +266 −314 core/lib/Foswiki/Search.pm
  124. +171 −0 core/lib/Foswiki/Search/InfoCache.pm
  125. +225 −1,672 core/lib/Foswiki/Store.pm
  126. +5 −6 core/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm
  127. +10 −814 core/lib/Foswiki/Store/RcsLite.pm
  128. +833 −0 core/lib/Foswiki/Store/RcsLiteHandler.pm
  129. +10 −458 core/lib/Foswiki/Store/RcsWrap.pm
  130. +541 −0 core/lib/Foswiki/Store/RcsWrapHandler.pm
  131. +9 −7 core/lib/Foswiki/Store/SearchAlgorithms/Forking.pm
  132. +3 −2 core/lib/Foswiki/Store/SearchAlgorithms/PurePerl.pm
  133. +304 −374 core/lib/Foswiki/Store/{RcsFile.pm → VCHandler.pm}
  134. +684 −0 core/lib/Foswiki/Store/VCStore.pm
  135. +38 −46 core/lib/Foswiki/Templates.pm
  136. +102 −82 core/lib/Foswiki/Time.pm
  137. +33 −56 core/lib/Foswiki/UI.pm
  138. +120 −0 core/lib/Foswiki/UI/Attach.pm
  139. +9 −11 core/lib/Foswiki/UI/ChangeForm.pm
  140. +18 −23 core/lib/Foswiki/UI/Changes.pm
  141. +135 −130 core/lib/Foswiki/UI/Edit.pm
  142. +115 −1,268 core/lib/Foswiki/UI/Manage.pm
  143. +9 −8 core/lib/Foswiki/UI/Oops.pm
  144. +379 −0 core/lib/Foswiki/UI/Passwords.pm
  145. +23 −19 core/lib/Foswiki/UI/Preview.pm
  146. +98 −67 core/lib/Foswiki/UI/RDiff.pm
  147. +131 −432 core/lib/Foswiki/UI/Register.pm
  148. +1,343 −0 core/lib/Foswiki/UI/Rename.pm
  149. +3 −1 core/lib/Foswiki/UI/Rest.pm
  150. +265 −295 core/lib/Foswiki/UI/Save.pm
  151. +33 −53 core/lib/Foswiki/UI/Search.pm
  152. +92 −97 core/lib/Foswiki/UI/Statistics.pm
  153. +62 −148 core/lib/Foswiki/UI/Upload.pm
  154. +78 −224 core/lib/Foswiki/UI/View.pm
  155. +197 −0 core/lib/Foswiki/UI/Viewfile.pm
  156. +1 −0 core/lib/Foswiki/UserMapping.pm
  157. +6 −2 core/lib/Foswiki/Users.pm
  158. +2 −2 core/lib/Foswiki/Users/ApacheHtpasswdUser.pm
  159. +18 −13 core/lib/Foswiki/Users/BaseUserMapping.pm
  160. +15 −9 core/lib/Foswiki/Users/HtPasswdUser.pm
  161. +70 −0 core/lib/Foswiki/WebFilter.pm
  162. +4 −3 core/lib/Monitor.pm
  163. +5 −1 core/templates/foswiki.tmpl
@@ -13,10 +13,12 @@ use vars qw( $VERSION $RELEASE $SHORTDESCRIPTION $NO_PREFS_IN_TOPIC );

our $VERSION = '$Rev$';
our $RELEASE = 'Foswiki-1.0.1';
our $SHORTDESCRIPTION = 'Quickly post comments to a page without an edit/preview/save cycle';
our $SHORTDESCRIPTION =
'Quickly post comments to a page without an edit/preview/save cycle';
our $NO_PREFS_IN_TOPIC = 1;

sub initPlugin {

#my ( $topic, $web, $user, $installWeb ) = @_;
return 1;
}
@@ -27,19 +29,21 @@ sub commonTagsHandler {
require Foswiki::Plugins::CommentPlugin::Comment;

my $query = Foswiki::Func::getCgiQuery();
return unless( defined( $query ));
return unless ( defined($query) );

return unless $_[0] =~ m/%COMMENT({.*?})?%/o;

# SMELL: Nasty, tacky way to find out where we were invoked from
my $scriptname = $ENV{'SCRIPT_NAME'} || '';

# SMELL: unreliable
my $previewing = ($scriptname =~ /\/(preview|gnusave|rdiff|compare)/);
Foswiki::Plugins::CommentPlugin::Comment::prompt( $previewing,
$_[0], $web, $topic );
my $previewing = ( $scriptname =~ /\/(preview|gnusave|rdiff|compare)/ );
Foswiki::Plugins::CommentPlugin::Comment::prompt( $previewing, $_[0], $web,
$topic );
}

sub beforeSaveHandler {

#my ( $text, $topic, $web ) = @_;

require Foswiki::Plugins::CommentPlugin::Comment;
@@ -49,8 +53,8 @@ sub beforeSaveHandler {

my $action = $query->param('comment_action');

return unless( defined( $action ) && $action eq 'save' );
Foswiki::Plugins::CommentPlugin::Comment::save( @_ );
return unless ( defined($action) && $action eq 'save' );
Foswiki::Plugins::CommentPlugin::Comment::save(@_);
}

1;
Oops, something went wrong.

0 comments on commit 142fd92

Please sign in to comment.
You can’t perform that action at this time.