Differences between revisions 19 and 20
Revision 19 as of 2005-05-30 07:05:36
Size: 7303
Editor: ReimarBauer
Comment:
Revision 20 as of 2005-05-30 07:57:43
Size: 7352
Comment:
Deletions are marked like this. Additions are marked like this.
Line 115: Line 115:
 A MB is 1000 KB, really :-) See DeWikiPedia:Byte

Introduction

Have you ever wondered why we have so many pages in the main distribution? Mostly because we do not have a format to deliver the help pages in one file. Or why installing a theme is not easy because you do not always know where to put the files?

AlexanderSchremmer has written a scripting framework for MoinMoin which simplifies installing extensions for MoinMoin very much. He will try to merge it into the main branch of MoinMoin as quickly as possible. It is already available in the DesktopEdition.

It works as following: you create a zip file which contains your files and a special file MOIN_PACKAGE, the installation script. The script contains one command (sounds complicated but is not really, look at the examples below) per line and gets executed from top to bottom.

The administrator (i.e. a user with admin permission) of the wiki will download your package file from somewhere, upload it to the wiki and then click install in the attached files view. Additionally, he could install the package using the command line (MoinMoin/packages.py i package.zip).

Example script:

MoinMoinPackage|1
ReplaceUnderlay|mypage.txt|HelpContents
AddRevision|mypage2.txt|FrontPage
InstallPlugin|myparser.py|global|parser|myparser.py
  • The first line simply marks the file as a script file and sets the revision of the used language. For now, it will be 1.
  • The second line replaces the underlay version of the page HelpContents with the file mypage.txt.

  • The third line adds a new revision to the page FrontPage, i.e. changes it.

  • The fourth line installs a new parser.

You could use this system to bundle specific templates which e.g. enhance your MoinMoin to be a CRM system. Or you could make your plugins/themes easier installable. Hopefully we will be able to separate the system pages depending on their languages and just offer the languages you like.

Implemented commands

Note that the commands are not case-sensitive.

  • Print|text

    • Prints the text into the script output, the user will see it afterwards.
  • IgnoreExceptions|boolean

    • Sets the ignore exceptions setting. If exceptions are ignored, the script does not stop if one is encountered.
  • SetThemeName|themename

    • Sets the name of the theme which will be altered next.
  • CopyThemeFile|filename|type|target

    • Copies a theme-related file (CSS, PNG, etc.) into a directory of the current theme.
    • Currently just supported on standalone-like servers.
    • Example: CopyThemeFile|screen.css|css|screen.css

  • InstallPlugin|filename|visibility|plugintype|target

    • Copies a plugin file from filename to target. Visibility may be local which selects the plugin folder of the current wiki or global will selects the folder of the MoinMoin python package. plugintype could be parser, macro, etc.

    • Example: InstallPlugin|myparser.py|global|parser|myparser.py

  • AddRevision|filename|pagename|author|comment|trivial

    • Adds a revision (read from the file filename) to the page pagename. author specifies the name of the editor and is optional. comment specifies the comment of the revision and is optional. trivial specifies if the revision was a trivial edit and is optional.

    • Example (installs new template files):

      AddRevision|cust.tpl|CustomerTemplate
      AddRevision|phone.tpl|PhoneTemplate
  • DeletePage|pagename|comment

    • Deletes the page pagename, optionally setting comment.

    • Example: DeletePage|FrontPage

  • ReplaceUnderlay|filename|pagename

    • Replaces the underlay version of the page. It can be used to install underlay pages or update them.
  • EnsureVersion|version|lines

    • Aborts the script or skips lines if the version criteria is not met and lines is specified.

    • This example supplies to different parsers and installs the correct one:

      EnsureVersion|1.3.3|2
      InstallPlugin|myparser.py_3|global|parser|myparser.py
      Exit
      EnsureVersion|1.3.2
      InstallPlugin|myparser.py_2|global|parser|myparser.py
  • Exit

    • Stops the script.
  • InstallPackage|Pagename|Filename

    • Installs another package which has to be an attachment called Filename of the page Pagename.

    • Example: InstallPackage|FrontPage|MyCoolPlugin.zip

Suggested commands

...

Discussion

I like it :-) -- AlexanderSchremmer DateTime(2005-05-27T15:14:24Z)

Nir sees several problems:

  1. Security - anyone with admin rights can now install and run arbitrary code on the server. One can use this to attack the server itself or other machines. Currently, if you have admin rights you can only login as other users and still their passwords and their very private preferences settings :) .

    • Indeed. Admin permissions should not be underestimated.
  2. Why do we need a script to install stuff? simply merge install tree with existing tree, e.g.
    • Plugin tree:
      plugin
          theme
              NewTheme.py
      htdocs
          newtheme
              css
                  ....
              img
                  ....
    If more then merging is needed, the installer can handle it automatically, e.g, if you merge new page revision, the installer can create it as new revision or by replacing the existing page.
    • Has various problems:
      • ZIP does not support unicode
      • How do unpack different plugins for different MoinMoin versions?

      • How do you delete pages?
      • How do you store comments, creators, the trivial flag?
      • How do you add many revisions of a single page at once?
  3. If more then merging is needed, then we need some kind of meta data for each installed item - like type of install: replace/new revision etc.
    • Your point being?
  4. If some kind of script is needed, then the delimiter used here is wired.
    • Yeah, your opinion. I love weird delimiters.
  5. Why not use existing installer framework like distutils?
    • ROTFL, why do you think that it would help?

Generally, I think this is a quick solution to a problem which was not defined yet. First describe the problem, then we can discuss what kind of solution is needed, what if should do, what it should not do, etc. -- NirSoffer DateTime(2005-05-27T19:25:19Z)

  • Look at the top of this page.

How about using tgz instead of zip? -- ThomasWaldmann DateTime(2005-05-28T09:41:46Z)

  • Very bad idea - it does not support random access. You would have to extract the files temporarily etc. But the code is written to be easily extendable, i.e. writing a tgz-interface is not a big problem. In fact, the ZIP specific code is less than 40 lines.

It does not set a log entry at the moment or is it supressed for RecentChanges? Probably it would be fine to see who has updated when something. -- ReimarBauer DateTime(2005-05-29T22:01:30Z)

  • It does not write log entries for underlay modifications. But AddRevision adds entries.

Would it be better to calc by real bytes 1024**2 instead of

+    single_file_size = 2.0 * 1000**2
+    attachments_file_space = 200.0 * 1000**2

I like to have 2MB as restriction and not 1.90735MB. Could it be that it is different shown on the different filespace calculators? -- ReimarBauer DateTime(2005-05-30T07:03:52Z)

  • A MB is 1000 KB, really :-) See Byte

Files

AttachList

MoinMoin: PackageInstaller (last edited 2008-01-03 01:46:43 by ThomasWaldmann)