Commit Graph

239 Commits (fd6fb4c5071d9317b4388a0db6b97037cc010477)

Author SHA1 Message Date
Joey Hess e3f5fdcf37 remove hook not used by cvs 2009-09-10 16:28:39 -04:00
Amitai Schlair c36d2fa896 Merge branch 'master' of git://github.com/joeyh/ikiwiki 2009-08-30 03:02:15 -04:00
Joey Hess 125c6ec650 <pedant>rename depends_exact to depends_simple
It's not "exact" since case munging has to be done, and I think
"simple" captures the optimisation better.</pedant>

With apologies to smcv, who probably has to rebuild his wiki now.
2009-08-28 15:13:45 -04:00
Simon McVittie 20a38fbf6d Avoid duplicating debug message for building a page due to a dependency
As per Joey's review
2009-08-28 15:42:07 +01:00
Simon McVittie 2a7f3b91d4 Force %depends_exact to lower case, fixing incorrect case-sensitivity 2009-08-28 15:42:04 +01:00
Simon McVittie ec2367cfbf Fix typo in dependency debug message 2009-08-28 15:34:35 +01:00
Simon McVittie c80a3cbcfd Add depends_exact: simplified dependency tracking for dependencies on a single page
Let E be the number of dependencies per page of the form "A depends on B and
nothing else", let D be the number of other dependencies per page,
let P be the total number of pages, and let C be the number of changed
pages in a refresh.

This patch should speed up a refresh from O(E*C*P + D*C*P) to
O(C + E*P + D*C*P), assuming that hash lookups are O(1).

In practice, plugins like inline and map produce a lot of these very simple
dependencies, and my album plugin's combination of inline with a large
number of pages causes it to suffer particularly badly.

In testing on a wiki with about 7000 objects (3500 full pages, 3500
images), a full rebuild continued to take about 5:30, and a refresh
after touching about 350 pages and 350 images reduced from 5:30 to 1:30.

As with my previous optimizations, this change will result in downgrades not
working correctly until the wiki is rebuilt.
2009-08-28 15:34:35 +01:00
Joey Hess 7dd9b65db4 don't use pagespec_match_list
This should be more efficient than pagespec_match_list since it short-circuits
after the first match is found.

The other problem with using pagespec_match_list here is it may throw an
error if a bad or failing pagespec somehow got into the dependencies.
2009-08-25 17:54:36 -04:00
Simon McVittie df8ab3406d use pagespec_match_list 2009-08-25 00:31:24 +01:00
Simon McVittie 7227c2debf Use a hash to de-duplicate dependencies 2009-08-25 00:31:16 +01:00
Simon McVittie fe4f176f72 Optimize the dependencies list
On a large wiki you can spend a lot of time reading through large lists
of dependencies to see whether files need to be rebuilt (album, with its
one-page-per-photo arrangement, suffers particularly badly from this).

The dependency list is currently a single pagespec, but it's not used like
a normal pagespec - in practice, it's a list of pagespecs joined with the
"or" operator.

Accordingly, change it to be stored as a list of pagespecs. On a wiki
with many tagged photo albums, this reduces the time to refresh after
`touch tags/*.mdwn` from about 31 to 25 seconds.

Getting the benefit of this change on an existing wiki requires a rebuild.
2009-08-24 23:18:10 +01:00
Amitai Schlair 3d6bc6e1b7 Add rsync plugin, though the only rsync-specific thing about it is the
assumption that uploading an entire site is efficient.
2009-08-23 15:18:41 -04:00
Joey Hess 82bb3af579 optimise brokenlinks by gathering the data when calculating backlinks
During backlink calulation, all links are examined and broken links can
be detected for free, so store a list of broken links and have brokenlinks
use it.

Exposing the %brokenlinks structure is a bit ugly, but the speedup seems
worth it: Around 1 second for wikis the size of the doc wiki that use
brokenlinks.
2009-08-14 01:11:53 -04:00
Joey Hess 830c9e59b2 Add discussionpage configuration setting
By adding this setting, we get both more configurability, and a minor
optimisation too, since gettext does not need to be called continually
to get the Discussion value.
2009-08-13 21:41:33 -04:00
Joey Hess 63ce4459f5 fix some more foreaches that clal functions to not use $_ 2009-08-12 12:49:16 -04:00
Joey Hess 3d27dac809 Merge commit 'remotes/smcv/ready/among' 2009-07-31 10:12:23 +02:00
Jonas Smedegaard 27071f0ba9 Change rendering→building in translatable strings, to ease translations. 2009-07-23 00:53:23 +02:00
Joey Hess 73ae87a4d4 split two helper functions of of render() 2009-07-20 05:23:16 +02:00
Simon McVittie 9c13e29d4f IkiWiki::Render: split out backlink_pages() function from backlinks()
This separates style from content - backlinks() performs lossy
transformations on the page names to get it in the form that the page
template wants.
2009-07-17 11:12:50 +01:00
Joey Hess 48a5f9f2d8 Disable the Preferences link if no plugin with an auth hook is enabled. 2009-06-09 15:39:00 -04:00
Joey Hess 059d6f01fa fix further places where translated discussion case was assumed
Another benefit is that consistently using gettext("Discussion")
eliminates the need to translate one string.
2009-06-04 13:20:52 -04:00
Joey Hess 6842328405 Avoid relying on translators preserving the case when translating "discussion", which caused Discussion pages to get unwanted Discussion links. 2009-06-04 13:15:05 -04:00
Joey Hess bb93fccf06 Coding style change: Remove explcit vim folding markers. 2008-12-17 15:22:16 -05:00
Joey Hess ae0a9d50be set ctime in --render mode if not known
Avoids some uninitialised value warnings.
2008-10-30 14:50:33 -04:00
Joey Hess 5b7677faba fix display of error msg 2008-10-29 13:38:26 -04:00
Joey Hess 2b569f99d9 fix relativedate timezone inclusion
The machine parseable date needs to include a timezone.

Also, simplified the interface for date display.
2008-10-19 19:21:44 -04:00
Joey Hess 7390a7a072 relativedate: New javascript-alicious plugin that makes all dates display relative, in a very nice way, if I say so myself. 2008-10-17 20:47:32 -04:00
Joey Hess 6b01fca253 use gettext 2008-09-29 17:06:56 -04:00
Joey Hess 9cbcda14ac Print a debug message if a page has multiple source files. 2008-09-23 13:32:41 -04:00
Joey Hess 0f67e7d969 editpage: New core plugin factoring out page editing to allow disabling it if desired. 2008-09-05 13:57:25 -04:00
Joey Hess cecd3bf725 historyurl can be undef 2008-07-26 19:37:25 -04:00
Gabriel McManus d9062864ee Rebuild pages that change their type.
Previously, if a page changed its type but not its mtime
(e.g. mv page.txt page.mdwn), then it would not be rebuilt.

Now, check if the source of a page has changed,
in which case force a rebuild of that page.
(cherry picked from commit b6a3b8a683fed7a7f6d77a5b3f2dfbd14c849843)
2008-07-23 16:00:26 -04:00
Joey Hess c2a2f71508 Add allow_symlinks_before_srcdir config setting
can be used to avoid a security check that is a good safe default, but
problimatic overkill in some situations.

I decided to underdocument this, because the option looks ugly, and I don't
want people randomly turning it on because it looks like a good idea. So if
you need it, you'll get an error message mentioning how to fix it.
2008-07-21 18:33:09 -04:00
Joey Hess 584f3e3061 Add a postscan hook.
* Add a postscan hook.
* search: Use postscan hook, avoid updating index when previewing.
2008-07-17 16:17:15 -04:00
intrigeri 35668b87d3 pedigree rename to parentlinks: rename/adapt everything
* Renamed to parentlinks every single variable or function called
  pedigree
* Removed the parentlinks function from Render.pm
* Enabled the new parentlinks plugin by default
* Adapted testsuite and documentation to reflate the above facts

Signed-off-by: intrigeri <intrigeri@boum.org>
2008-07-15 16:25:39 +02:00
Joey Hess 0b140ed1c8 avoid hardlinking files owned by others
If hardlinks are enabled, it would hardlink files from the underlay. That
was sorta annoying if you tried to edit by hand for some reason, so let's
not. Files that are hardlinked should be rare enough that a few extra stats
won't hurt.
2008-07-12 23:31:27 -04:00
Joey Hess 05124f9a86 editpage escaping fixes
* The editpage form now uses the raw page name, not the page title, in its
  'page' cgi parameter. Using the title was ambiguous and made it
  impossible to tell between some pages, like "foo/bar" and "foo__47__bar",
  sometimes causing the wrong page to be edited.
* This change means that some edit links need to be updated.
  Force a rebuild on upgrade to this version.
* Above change also allowed really fixing escaped slashes from the blogpost
  form.
2008-07-06 15:52:04 -04:00
Joey Hess d7ca2f8f9b fix expensive move code path 2008-07-01 13:48:07 -04:00
Joey Hess 0f8ea7ecca break out fast_file_copy 2008-07-01 00:42:23 -04:00
Joey Hess 1dddec0ba9 Pass a destpage parameter to the sanitize hook.
Because the search plugin needed it, also because it's one of the few
plugins that didn't already have it.

I also considered adding it to htmlize, but I really cannot imagine caring
what the destpage is when htmlizing. (I'll probably be poven wrong later.)
2008-06-04 01:24:23 -04:00
Joey Hess fab1333b67 Filter hooks are no longer called during the scan phase. This will prevent wikilinks added by filters from being scanned properly. But no known filter hook does that, and calling filters unncessarily during scan slowed down complex filters such as the one used to update the xapian index. 2008-06-04 00:15:15 -04:00
Joey Hess b7950d8d01 load plugins before printing messages
This allows plugins to getopt and change what is done before an incorrect
line is printed.
2008-05-08 16:08:02 -04:00
Joey Hess 9e6a4ccfdd amazon s3 support implemented and kinda working
pruning not yet implemented, however
2008-05-07 23:15:43 -04:00
Joey Hess ec866f8370 Optimised file statting code when scanning for modified pages; cut the number of system calls in half. (Still room for improvement.) 2008-05-07 14:11:56 -04:00
Joey Hess f6bd81db15 Added a hardlink option in the setup file, useful if the source and dest are on the same filesystem and the wiki includes large media files, which would normally be copied, wasting time and space. 2008-03-29 21:02:47 -04:00
Joey Hess f4773f6a83 avoid calling getctime on internal pages
internal pages won't be in revision control so this avoids some ugly noise
2008-02-24 18:02:34 -05:00
Joey Hess 4763514861 * Add the linkify and scan hooks. These hooks can be used to implement
custom, first-class types of wikilinks.
* Move standard wikilink implementation to a new wikilink plugin, which
  will of course be enabled by default.
2008-02-11 22:48:27 -05:00
Joey Hess f1fcb5be9c * Page templates can now use CTIME to show when the page was created. 2008-02-09 23:05:48 -05:00
Joey Hess 63e316f362 * Don't die if running with --getctime and rcs_getctime throws an error.
There are several cases (recentchanges files, aggregated files)
  where some source files are not in revision control.
2008-02-07 22:11:54 -05:00
Joey Hess 6a7c3d1209 * Revert preservation of input file modification times in output files,
since this leads to too many problems with web caching, especially with
  inlined pages. Properly solving this would involve tracking every page
  that contributes to a page's content and using the youngest of them all,
  as well as special cases for things like the version plugin, and it's just
  too complex to do.
2008-02-02 23:40:57 -05:00
Joey Hess 55e16be44a move recentchanges link enabling into a pagetemplate hook 2008-01-30 02:29:12 -05:00
Joey Hess 9e15bd27ea avoid temp var 2008-01-29 18:07:20 -05:00
Joey Hess 7125c7269a don't scan internal pages
scan() does too much. All that is needed is to preprocess the internal page
in scan-only mode.
2008-01-29 18:06:36 -05:00
Joey Hess 64a8c828b8 * meta: Add pagespec functions to match against title, author, authorurl,
license, and copyright. This can be used to create custom RecentChanges.
* meta: To support the pagespec functions, metadata about pages has to be
  retained as pagestate.
* Fix encoding bug when pagestate values contained spaces.
2008-01-29 17:16:51 -05:00
Joey Hess 9875bc10d1 avoid redundant recentpages action on the recentchanges page itself 2008-01-29 15:53:49 -05:00
Joey Hess 8b31c53366 added configuration for recentchanges
I kept it to a simple global configuration, rather than using the
preprocessor directive for recentchanges, because that had chicken and egg
problems and seemed overcomplicated. This should work reasonably well,
though it would be good to add some more metadata so that more customised
recentchanges pages can be made.
2008-01-29 15:51:32 -05:00
Joey Hess 47ee266163 improve support for internal pages
This makes it a lot quicker to deal with lots of recentchanges pages
appearing and disappearing. It avoids needing to clutter up pagespecs with
exclusions for those pages, by making normal pagespecs not match them.
2008-01-29 15:05:49 -05:00
Joey Hess e1ce482e41 add refresh hook 2008-01-29 13:08:32 -05:00
Joey Hess 152f32547f indicate that an internal page will be rendered even if skipping it
This is important to do because until will_render is called, ikiwiki doesn't
know that the page exists. This avoids recentchanges re-writing every change
page every run.
2008-01-29 12:39:28 -05:00
Joey Hess 7a4b7b1964 update RecentChanges action to point to page 2008-01-29 12:20:17 -05:00
Joey Hess 2ff726e875 don't render internal-use pages, and document them 2008-01-29 00:07:55 -05:00
Joey Hess b30fed47ea * Improved parentlinks special case for index pages. 2007-12-19 16:44:33 -05:00
Joey Hess 849f65a343 * Avoid unnecessary stat calls to get mtime when rendering pages, use
cached value.
* Preserve input file modification times in output files.
2007-12-12 14:43:35 -05:00
Joey Hess e15e3202eb releasing version 2.14 2007-11-26 15:30:44 -05:00
joey 9c5f4761d8 * Support for looking in multiple directories for underlay files.
* Plugins can add new directories to the search path with the add_underlay
  function.
* Split out smiley underlay files into a separate underlay, so if the plugin
  isn't used, the wiki isn't bloated with all those files.
2007-08-28 01:59:01 +00:00
joey 4a07e28acc typo 2007-07-28 21:37:22 +00:00
joey 40959ce76d * Add templatefile hook.
* Add pagetemplate plugin, which allows changing the template used for
  a page. (Not to be confused with the hook of the same name..)
2007-07-26 20:50:55 +00:00
joey 72c95e8434 * Fix re-rendering of pages when a linked to page goes away. This was broken
in version 1.50 with the addition of %destsources. Thanks, Ethan
  Glasser-Camp.
2007-07-26 19:41:04 +00:00
joey cf35ee04cd * Add a destpage parameter to the filter hook.
* Fix links to smilies generated by the smiley plugin for inlined pages. The
  old links were often wrong, but often still worked by accident.
2007-05-17 19:55:11 +00:00
joey 63995039be optimise backlinks counting for pagestats, simplify function returns again 2007-05-12 19:17:41 +00:00
joey 72c53650ad * Add the needsbuild hook. Plugins can use this to manipulate which files
ikiwiki builds when refreshing the wiki.
2007-05-09 00:48:09 +00:00
joey ee1ad53c4c * pagespec_match() has changed to take named parameters, to better allow
for extended pagespecs. The old calling convention will still work for
  back-compat for now.
* The calling convention for functions in the IkiWiki::PageSpec namespace
  has changed so they are passed named parameters.
* Plugin interface version increased to 2.00 since I don't anticipate any
  more interface changes before 2.0.
2007-04-27 02:55:52 +00:00
joey c490ad5ad8 oops 2007-04-08 01:03:42 +00:00
joey 072d097be1 magic 0 2007-04-07 16:55:16 +00:00
joey 02b9f69ba5 * Finally apply the index.html patch, with thanks to everyone who worked
on and supported creating it (especially Tumov). This adds a "usedirs"
  option that makes ikiwiki use foo/index.html instead of foo.html as
  output page names. It is not yet enabled by default.
2007-04-01 19:59:42 +00:00
joey a2cfdaaec5 * Hide excess backlinks and expand using CSS trick; control quantiy via
the numbacklinks setting.
2007-03-31 08:48:10 +00:00
joey bbb0b3e72f * Finally fixed the longstanding inline removal bug.
* Renamed %oldpagemtime to a more accurately named %pagemtime and fix it to
  actually store pages' mtimes.
* Add "mtime" sort parameter to inline plugin.
2007-03-24 15:10:58 +00:00
joey c1b698e418 * The underscore escaping support exposed a bug in edit links: Such links
were titlepage escaped in the urls, and then doubly escaped by the CGI
  when editing. To fix this, I removed the titlepage escaping in the edit
  urls.
* That means that *every edit link* on the wiki is potentially changed.
  Rebuilding wikis on upgrade to this version therefore necessary; enabled
  that in postinst.
2007-03-08 06:03:59 +00:00
joey b365d864c5 My fix to support encoded underscores in page titles broke links to pages
with underscores in their filenames, since the link code also used
titlepage. Create a new linkpage function and have the link code use that
instead.
2007-03-07 09:48:59 +00:00
joey fa52a730ff * Changed calling convention for httmllink slightly. The first three
parameters remain the same, but additional options are now passed in using
  named parameters.
* Change plugin interface version to 1.02 to reflect this change.
* Add a new anchor option to htmllink. Thanks Ben for the idea.
* Support anchors in wikilinks.
* Add a "more" plugin based on one contributed by Ben to allow implementing
  those dreaded "Read more" links in blogs.
2007-02-20 03:05:47 +00:00
joey d4c61b7281 * Many changes to make ikiwiki very resistant to write failures
including out of disk space situations. ikiwiki should never leave
  truncated files, and if the error occurs during a web-based file edit,
  the user will be given an opportunity to retry.
  Inspired by the many ways Moin Moin destroys itself when out of disk. :-)
* Fix syslogging of errors.
2007-02-15 02:22:08 +00:00
joey 58141a0ebc * Patch based on a patch from Ethan to support relative matching in
PageSpecs, by using "./". pagespec_match() has grown a new third parameter
  to support this.
2007-02-06 21:17:25 +00:00
joey 97aea86162 code checking for locked pages into a new "lockedit" plugin. Both are
* Avoid using lots of memory when copying large non-html files.
  Yes, you can keep videos in the wiki..
2007-02-03 03:27:33 +00:00
joey f6e917fcce * Fix handling of discussion links on discussion pages when l10n is used. 2007-01-18 15:06:57 +00:00
joey 178ab4c51c * Don't put discussion links on discussion pages. 2006-12-29 04:45:09 +00:00
joey 912521ef07 * Initial work on internationalization of the program code. po/ikiwiki.pot
is available for translation.
* Export gettext() from IkiWiki module.
2006-12-29 04:38:40 +00:00
joey 8323bc5214 * Improve code that ignores files in the underlaydir if the srcdir has a
file building the same page. Now it will work even if the extensions of
  the source files differ.
2006-12-28 22:15:38 +00:00
joey 201d11da0a the problem with coding while drunk -- idiotic mistakes 2006-12-23 06:48:56 +00:00
joey 829e0b1b65 * Avoid creating edit links when not in cgi mode.
* Avoid displaying discussion links at all, if there's not a discussion
  page, when not in cgi mode.
2006-12-23 06:18:55 +00:00
joey 472dabbb60 * Turn $config{wiki_file_prune_regexps} into an array that is easier to
manipulate.
* Only exclude rss and atom files from processing if the inline plugin
  is enabled and that feed type is enabled. Else it's just a copyable file
  type.
* Move rss and atom option handling code into the inline plugin.
* Applied a rather old patch from Recai to fix the "pruning is too strict"
  issue. Now you can have wiki source directories inside dotdirs and the
  like, if you want.
2006-12-21 19:36:15 +00:00
joey f8cbf79735 foo 2006-11-26 19:42:40 +00:00
joey 35ee7e44a6 * Make sure to check for errors from every eval. 2006-11-08 21:03:33 +00:00
joey 5a82103526 * Implemented expiry options for aggregate plugin.
* Use precalculated backlinks info when determining if files need an update
  due to a page they link to being added/removed. Mostly significant if
  there are lots of pages.
* Remove duplicate link info when saving index. In some cases it could
  pile up rather badly. (Probably not the best way to deal with this
  problem.)
2006-11-01 05:41:37 +00:00
joey 74b5fb09aa fix a bug 2006-10-28 22:24:18 +00:00
joey db3b72c482 instead of over and over. Typical speedup is ~4x. Max possible speedup:
8x.
* Add "scan" parameter to hook(), which is used to make the hook be called
  during the scanning pass, as well as the render pass. The meta and tag
  plugins need to use the new scan parameter, so will any others that modify
  %links.
* Now that links are calculated in a separate pass, it can also 
  precalculate backlinks in one pass, which is O(N^2) instead of the
  previous code that was O(N^3). A very nice speedup for wikis with lots
  (thousands) of pages.
2006-10-28 05:07:56 +00:00
joey 49bf877701 * Add a separate pass to find page links, and only render each page once,
instead of over and over. This is up to 8 times faster than before!
  (This could have introduced some subtle bugs, so it needs to be tested
  extensively.)
2006-10-28 03:27:10 +00:00
joey cefbe6210f * Change %renderedfiles to store an array of files rendered from a given
source file, to allow tracking of extra rendered files like rss feeds.
* Note that plugins that accessed this variable will need to be updated!
  The plugin interface has been increased to version 1.01 for this change.
* Add will_render function to the plugin interface, used to register that a
  page renders a destination file, and do some security checks.
* Use will_render in the inline and linkmap plugins.
* Previously but no longer rendered files will be cleaned up.
* You will need to rebuild your wiki on upgrade to this version.
2006-10-08 21:56:50 +00:00
joey c35444826c * Add --render mode, which can be used to preview an edit at the command
line by test rendering a single page.
2006-09-21 21:34:29 +00:00
joey dae0f48e91 * Work on firming up the plugin interface:
- Plugins should not need to load IkiWiki::Render to get commonly
    used functions, so moved some functions from there to IkiWiki.
  - Picked out the set of functions and variables that most plugins
    use, documented them, and made IkiWiki export them by default,
    like a proper perl module should.
  - Use the other functions at your own risk.
  - This is not quite complete, I still have to decide whether to
    export some other things.
* Changed all plugins included in ikiwiki to not use "IkiWiki::" when
  referring to stuff now exported by the IkiWiki module.
* Anyone with a third-party ikiwiki plugin is strongly enrouraged
  to make like changes to it and avoid use of non-exported symboles from
  "IkiWiki::".
* Link debian/changelog and debian/news to NEWS and CHANGELOG.
* Support hyperestradier version 1.4.2, which adds a new required phraseform
  setting.
2006-09-09 22:50:27 +00:00
joey 575cfa085c drop the loop number to 3, 10 seems a bit much.. 2006-08-31 19:47:41 +00:00