Commit Graph

239 Commits (fd6fb4c5071d9317b4388a0db6b97037cc010477)

Author SHA1 Message Date
Joey Hess a71b92ed5c remember autofiles always
This fixes the problem that it did not remember if an autofile is deleted,
unless a plugin happened to register the autofile at the same time.

With the new code, we just never recreate an autofile more than once.

Only downside is that the list of autofiles is never pruned either.
And I don't really see a way to prune it.
2010-04-21 15:59:39 -04:00
Joey Hess 2a0e3787a0 bugfixes 2010-04-21 15:54:18 -04:00
Joey Hess 034b4e8266 remove verify_src_file
Splitting out this function bothered me. It is conceptially similar to
file_pruned, and yet also very specific to exactly the security needs of
find_src_files.

I liked that it got rid of duplicate code in the latter function. So
instead, put a helper sub in that, which I think allows refactoring
things more cleanly, and with less boilerplate.

As to the needs of gen_autofile, I'm not convinced this needs to handle
the same set of problems that verify_src_file did. So I sat down and
wrote a custom validator for autofiles, which turned out to seem to just
need three things: Make sure the candidate filename is not something
that would be pruned; untaint the candidate filename; and make sure that
srcdir doesn't already have something with its name. (Plus, of course,
all the other checks that were already in gen_autofile.)

(In passing, also fixed a bunch of bugs I had introduced in this branch.)
2010-04-21 15:05:59 -04:00
Joey Hess 34e8c78c1c Merge branch 'master' into autotag 2010-04-20 18:19:00 -04:00
Joey Hess d1a1f3ad21 fix minor bug if a page's name is "0" 2010-04-20 01:54:42 -04:00
Joey Hess de6167a3b0 change wording
This is more accurate when a file that is not a page is what is removed.
2010-04-19 23:48:24 -04:00
Joey Hess 2111bf0408 move message into if block 2010-04-19 22:14:22 -04:00
Joey Hess 831b891abd move File::Find control back into its code blocks
Ok, this is longer, but features less scary action at a distance.
2010-04-17 16:14:15 -04:00
Joey Hess f78e6798aa move decode_utf8 closer to reason for it
Filenames need to be decoded, as File::Find does not provide them in
decoded form, but other callers of verify_src_file will be using utf8.
2010-04-17 16:08:37 -04:00
Joey Hess b7d50abc0f refactor autofiles
Made add_autofile take a generator function, and just register the
autofile, for later possible creation. The testing is moved into Render,
which allows cleaning up some stuff.
2010-04-17 13:35:15 -04:00
Joey Hess 2269a4c74b whitespace 2010-04-17 13:05:04 -04:00
Joey Hess 54f600af14 Merge remote branch 'davrieb/autotag' into autotag
Conflicts:
	IkiWiki.pm
	IkiWiki/Plugin/tag.pm
2010-04-17 12:50:23 -04:00
Joey Hess dee2940c0b automatically run --gettime, and optimise it for git
* Automatically run --gettime the first time ikiwiki is run on
  a given srcdir.
* Optimise --gettime for git, so it's appropriatly screamingly
  fast. (This could be done for other backends too.)
* However, --gettime for git no longer follows renames.
* Use above to fix up timestamps on docwiki, as well as ensure that
  timestamps on basewiki files shipped in the deb are sane.
2010-04-16 18:30:56 -04:00
Joey Hess b14f84c4ac --gettime revamp
* Rename --getctime to --gettime. (The old name still works for
  backwards compatability.)
* --gettime now also looks up last modification time.
* Add rcs_getmtime to plugin API; currently only implemented
  for git.
2010-04-16 17:02:29 -04:00
Simon McVittie f127857676 Fix some typos that would break Render during changed-link calculation 2010-04-04 00:43:48 +01:00
Simon McVittie c1a42e76bc implement typed links; add tagged_is_strict config option 2010-04-04 00:43:48 +01:00
David Riebenbauer 981400177d Make sure deleted tag pages don't get recreated.
The reason to do this is basically a user interaction design decision.

It is achieved by adding an entry, associated to the creating plugin, to
%pagestate. To find out if files were deleted a new global hash %del_hash is
%introduced.
2010-04-03 22:20:48 +02:00
David Riebenbauer 628a52a6c4 Revert "Revert the effects of find_del_files() for (re)autoadded files."
This reverts commit 31680111f0062f07727d14fcf291c98978ad5a2f.
2010-04-03 22:20:48 +02:00
Joey Hess 799b93d258 don't check $@ after pagespec_translate
pagespec_translate may set $@ if it fails to parse a pagespec, but
due to memoization, this is not reliable. If a memoized call is repeated,
and $@ is already set for some other reason previously, it will remain
set through the call to pagespec_translate.

Instead, just check if pagespec_translate returns undef.
2010-03-28 20:23:22 -04:00
Joey Hess 60d2dd318f Add new --clean option; this makes ikiwiki remove all built files in the destdir, as well as wrappers and the .ikiwiki directory. 2010-02-28 00:12:47 -05:00
David Riebenbauer da5d29f95f fix bugs in `find_src_files()`.
Use `_` to avoid superfluous stat.

Check for `defined $file`, instead of just `$file`.

Add spaces after commas.

Change return values of `verify_src_file()` to not return the tainted filename.
Rename `$f` to `$file_untainted in `verify_src_file()`.
$f changes to `$file` in `find_src_files()`.

This attempts to fix commit f3abeac919.
For discussion see
<http://ikiwiki.info/todo/auto-create_tag_pages_according_to_a_template/>
2010-02-03 07:34:04 +01:00
David Riebenbauer f58f3e1bec Revert the effects of find_del_files() for (re)autoadded files.
This also means that if autoadded files are deleted they will just be
recreated.
2010-02-02 14:04:39 +01:00
David Riebenbauer f3c59ed3e5 Process files from @autofiles in refresh().
To make automatically added files render they have to be added to the $files,
$pages, $new, and $changed variables.

After that scan() is called on them.
2010-02-02 14:04:28 +01:00
David Riebenbauer f3abeac919 Code deduplication fin find_src_files()
This also has the advantage that I can use the resulting new function
elsewhere.
2010-02-02 14:04:28 +01:00
Joey Hess 4c89a26934 fix actions accounting 2010-01-04 12:51:45 -05:00
Joey Hess 7dd074e2e7 Fix several places that did not properly handle capitalization of the discussionpage setting.
Specifically, fixes discussion actions on discussion pages, and unbreaks the opendiscussion plugin.
2010-01-02 15:52:38 -05:00
Joey Hess ae161be8f9 fix inverted test 2009-12-02 13:07:58 -05:00
Joey Hess f1ddf4bd98 fix bestlink to not return just-deleted pages
bestlink was looking at whether %links existed for a page in order to tell
if the page exists, but just-deleted pages still have entries in there (for
reasons it may be best not to explore). So bestlink would return
just-deleted pages. Instead, make bestlink use %pagesources.

Also, when finding a deleted page, %pagecase was not cleared of that page.
This, again, made bestlink return just-deleted pages. Now that is cleared.

Fixing bestlink exposed another issue though. The backlink calculation code
uses bestlink. So when a page was deleted, no backlinks to it are found,
and pages that really did backlink to it were not updated, and had broken
links.

To fix that, the code that actually removes deleted pages had to be split
out from find_del_files, so it can run a bit later. It is run just after
backlinks are calculated. This way, backlink calculation still sees the
deleted pages, but everything afterwards does not.

However, it does not address the original bug report that started this
whole thing, [[bugs/bestlink_returns_deleted_pages]]. Because there
bestlink is run in the needsbuild hook. And that happens before backlink
calculation, and so bestlink still returns deleted pages then. Also in the
scan hook.

If bestlink needs to work consistently during those hooks, a more involved
fix will be needed.
2009-11-30 17:34:29 -05:00
Joey Hess 66b46576ec Moved the postscan hook to run on the raw html of a page, before the template is filled out. This improves the search plugin's indexing, since it will not include navigational elements from the page template or sidebar. 2009-11-08 13:48:07 -05:00
Joey Hess 587e0c3d21 Fix a bug introduced in the last version that caused ikiwiki to skip all files if a sourcedir of "./" was specified. 2009-10-21 13:50:49 -04:00
Joey Hess 37ec6a8243 Merge branch 'master' into dependency-types
Conflicts:
	IkiWiki.pm
	IkiWiki/Render.pm
	debian/changelog
2009-10-08 20:33:58 -04:00
Joey Hess 3bb00d142a Optimize away most expensive file prune calls, when refreshing
Benchmarking refresh of a a wiki with 25 thousand pages showed
file_pruned() using most of the time. But, when refreshing, ikiwiki already
knows about nearly all the files. So we can skip calling file_pruned() for
those it knows about. While tricky to do, this sped up a refresh (that
otherwise does no work) by 10-50%.
2009-10-08 20:27:56 -04:00
Joey Hess 136979fac6 fix backlink new change detection code 2009-10-07 14:08:03 -04:00
Joey Hess ee56af29e1 typo 2009-10-06 18:45:22 -04:00
Joey Hess ba1dfb4ec6 fix support of a single dependency that combines links and exists types
This is very common, and the code has to test each type differently, since
the list of candidates to test, as well as the test, will vary per type.
Much happier with this code now.
2009-10-06 18:09:46 -04:00
Joey Hess 2494a23fdd fix handling of links+content dependency
Such a dependency is unlikely, but can happen.
2009-10-06 04:45:57 -04:00
Joey Hess 2a0e6b782c refactor 3
Only left one new global
2009-10-06 02:00:34 -04:00
Joey Hess 96b1f95192 refresh refactor 2
killed one global
2009-10-06 00:10:20 -04:00
Joey Hess 577eed0e7e split up refresh
I'd rather have the global variables than the 300 line function
2009-10-05 23:54:29 -04:00
Joey Hess fd7b5767d3 new link change detection method and general code rework
This new method for determining when links on pages
have changed should be more efficient, since it avoids
double calculation of the bestlinks.

It also allows collecting data about the old links, before
the scan pass, so the data is accurate when pages move around
and bestlinks change.

Also got some code back to a saner indent level.
2009-10-05 22:21:25 -04:00
Joey Hess c6bf4228d5 make links dependencies fire if broken links change 2009-10-05 15:01:05 -04:00
Joey Hess 666a9613a1 implement links dependencies
Involved some code refactoring so that same code that detects
link changes for backlinks updating can be used for link dependency
checking. The nice thing is that link dep checking is thus
comopletly free!
2009-10-05 14:33:23 -04:00
Joey Hess 89b65695e7 typos 2009-10-05 13:40:35 -04:00
Joey Hess be032a7b87 rework dependency types code
Simplify, change default content depends number to 1,
change interface to make more sense.
2009-10-04 20:30:21 -04:00
Joey Hess 9403045b7e Merge branch 'dependency-types' into transitive-dependencies
Conflicts:
	IkiWiki/Render.pm
2009-10-04 16:33:58 -04:00
Joey Hess 26dbc09bd8 implement support for DEPEND_EXISTS
Preliminary support, anyway.

If a dependency only includes DEPEND_EXISTS, then only changes that
involved adding or deleting a page can trigger it.

This is complicated by internal pages, since the code did not previously
differentiate between add, delete, and change of internal pages.
Now it tracks change separately from add+delete, so DEPEND_EXISTS pagespecs
that actually match internal pages (which will probably be quite rare in
practice) should work.
2009-10-03 15:50:22 -04:00
Joey Hess 52134dc0ef minor optimisation
As soon as a change happens, we know we will need to rescan all
dependencies from the start, so bail out of the current scan partway to
avoid doing redundant work.

Only problem with this is that ikiwiki sometimes ends up printing out
dependencies that, while correct, are not obvious. Before:

building B, which depends on A
building C, which depends on A
building D, which depends on A

After:

building B, which depends on A
building C, which depends on B
building D, which depends on C
2009-10-02 15:41:09 -04:00
Joey Hess 71eabd44d5 handle transitive dependencies by re-running dep resolver
This is a rather expensive solution to the transitive dependency problem.
2009-10-02 15:38:04 -04:00
Joey Hess a7545978c7 got rid of the postrefresh hook after all
Instead, use the change and delete hooks, and launch rsync if either hook
is called.
2009-09-11 18:29:56 -04:00
Amitai Schlair b2bd2e93f0 Revivify unixauth and rsync plugins (and hook needed by rsync) lost in
the last merge. I should really put each feature on its own git branch.
2009-09-10 17:34:52 -04:00