[TW5] An incremental load command for tiddler backups

159 views
Skip to first unread message

Mal

unread,
Mar 17, 2016, 11:37:46 PM3/17/16
to TiddlyWiki
All,

I am looking after some tiddlywikis with important content and have implemented a backup scheme that involves loading the tiddlywiki html files into a node instance and then taking file system (zfs) snapshots of the tiddlers folder.  The only problem is that the tiddlywiki --load command always loads and saves all tiddlers regardless of whether they have been changed, so the snapshot includes all tiddlers.  The ideal would be to have an incremental load command that only loads new or changed tiddlers into the tiddlers folder, giving a much smaller snapshot size.

As an attempt to achieve this, I created a "loadnew" command by cloning the "$:/core/modules/commands/load.js" tiddler to create a new tiddler "$:/core/modules/commands/loadnew.js" with appropriate code to limit the imported tiddlers to only those that do not already exist in the tiddlers folder, or have a newer "modified" date/time.

Although this seems to be working well, I am a very amateur coder and am not sure if this is a good way to achieve what I'm after, so I welcome any comments or suggestions.

For anyone interested, I've attached the resulting tid file for reference.  It is a simple matter of copying this to the node tiddlers folder to make the --loadnew command available.  However, I recommend treating this with caution due to my previously mentioned amateur coder status.

Regards,

Mal

$__core_modules_commands_loadnew.js.tid

Mal

unread,
Apr 18, 2016, 6:35:36 AM4/18/16
to TiddlyWiki
In case anyone has any interest in this, I have attached a new version of my "loadnew" command with a correction to the date comparison logic.

Regards,

Mal
$__core_modules_commands_loadnew.js.tid

Jeremy Ruston

unread,
Apr 18, 2016, 6:43:50 AM4/18/16
to tiddl...@googlegroups.com
Hi Mal

Good stuff. The code looks OK at a quick glance, but for me the exciting thing is the way that you were able to do this as a “very amateur coder”. I believe that software developers have accidentally created a world where we have all the advantages: we can readily mould and shape the technology around us to fit our needs, while non-coders are condemned to make do with the one-size-fits-all, mass market tools. A big goal of TiddlyWiki is to lower the barriers for everyone to create their own unique, customised environment that is optimised to their own needs. Sharing tweaks like this within the community is very valuable because it will help some people learn to do it themselves.

Anyhow, you may want to consider setting up a tiddlyspot or github site for sharing your stuff; I’ll happily link to it from tiddlywiki.com,

Best wishes

Jeremy.


-- 
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e8cd31dc-21d3-4722-942d-666aa848aa4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<$__core_modules_commands_loadnew.js.tid>

Mal

unread,
Apr 18, 2016, 7:06:17 AM4/18/16
to TiddlyWiki
Jeremy,

Thanks for the positive feedback - and I assure you, the customisability of Tiddlywiki is the main reason I have used it for a number of applications.

I'll take on board your suggestion about a tiddlyspot or github site, although I don't have much material to share at this stage.

Regards,

Mal



Mal

unread,
May 1, 2016, 1:39:06 AM5/1/16
to TiddlyWiki
As suggested by Jeremy, I've created a plugin for my "loadnew" command and published it on tiddlyspot.

I hope this is of some use and am happy to receive any comments, suggestions or questions.

Regards,

Mal

Jeremy Ruston

unread,
May 1, 2016, 9:20:37 AM5/1/16
to tiddl...@googlegroups.com
Thanks Mal, I’ve added a link for 5.1.12:


Best wishes

Jeremy.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Mal

unread,
May 2, 2016, 12:56:16 AM5/2/16
to TiddlyWiki
Jeremy,

Thanks for adding this link, but I think we have a problem - clicking on Community/Resources in the TOC gets us into some sort of infinite loop related to this item.  It appears that the apostrophe in the title (Mal's Sandbox) is causing a problem.  If I remove it, the recursion error goes away.

This is interesting given the recent discussion in the forums about the question of reserved characters in tiddler titles.

Regards,

Mal




Jeremy Ruston

unread,
May 2, 2016, 3:26:09 AM5/2/16
to tiddl...@googlegroups.com
Hi Mal

Thanks for adding this link, but I think we have a problem - clicking on Community/Resources in the TOC gets us into some sort of infinite loop related to this item.  It appears that the apostrophe in the title (Mal's Sandbox) is causing a problem.  If I remove it, the recursion error goes away.

This is interesting given the recent discussion in the forums about the question of reserved characters in tiddler titles.

Well spotted, thank you Mal. I’ve fixed the issue here:


I’ve uploaded a new prerelease:


Best wishes

Jeremy


Regards,

Mal





--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages