diff -urN wiki-toolkit.orig/lib/Wiki/Toolkit/Store/Database.pm wiki-toolkit/lib/Wiki/Toolkit/Store/Database.pm
|
old
|
new
|
|
| 450 | 450 | Making sure that locking/unlocking/transactions happen is left up to |
| 451 | 451 | you (or your chosen subclass). This method shouldn't really be used |
| 452 | 452 | directly as it might overwrite someone else's changes. Croaks on error |
| 453 | | but otherwise returns true. |
| | 453 | but otherwise returns the version number of the update just made. |
| 454 | 454 | |
| 455 | 455 | Supplying a ref to an array of nodes that this ones links to is |
| 456 | 456 | optional, but if you do supply it then this node will be returned when |
| … |
… |
|
| 657 | 657 | } |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | | return 1; |
| | 660 | return $version; |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | # Returns the timestamp of now, unless epoch is supplied. |
diff -urN wiki-toolkit.orig/lib/Wiki/Toolkit/Store/MySQL.pm wiki-toolkit/lib/Wiki/Toolkit/Store/MySQL.pm
|
old
|
new
|
|
| 45 | 45 | |
| 46 | 46 | Locks the node, verifies the checksum, calls |
| 47 | 47 | C<write_node_post_locking> with all supplied arguments, unlocks the |
| 48 | | node. Returns 1 on successful writing, 0 if checksum doesn't match, |
| 49 | | croaks on error. |
| | 48 | node. Returns the version of the updated node on successful writing, 0 if |
| | 49 | checksum doesn't match, croaks on error. |
| 50 | 50 | |
| 51 | 51 | Note: Uses MySQL's user level locking, so any locks are released when |
| 52 | 52 | the database handle disconnects. Doing it like this because I can't seem |
diff -urN wiki-toolkit.orig/lib/Wiki/Toolkit/Store/Pg.pm wiki-toolkit/lib/Wiki/Toolkit/Store/Pg.pm
|
old
|
new
|
|
| 45 | 45 | |
| 46 | 46 | Locks the node, verifies the checksum, calls |
| 47 | 47 | C<write_node_post_locking> with all supplied arguments, unlocks the |
| 48 | | node. Returns 1 on successful writing, 0 if checksum doesn't match, |
| 49 | | croaks on error. |
| | 48 | node. Returns the version of the updated node on successful writing, 0 if |
| | 49 | checksum doesn't match, croaks on error. |
| 50 | 50 | |
| 51 | 51 | =cut |
| 52 | 52 | |
diff -urN wiki-toolkit.orig/lib/Wiki/Toolkit/Store/SQLite.pm wiki-toolkit/lib/Wiki/Toolkit/Store/SQLite.pm
|
old
|
new
|
|
| 56 | 56 | |
| 57 | 57 | Locks the node, verifies the checksum, calls |
| 58 | 58 | C<write_node_post_locking> with all supplied arguments, unlocks the |
| 59 | | node. Returns 1 on successful writing, 0 if checksum doesn't match, |
| 60 | | croaks on error. |
| | 59 | node. Returns the version of the updated node on successful writing, 0 if |
| | 60 | checksum doesn't match, croaks on error. |
| 61 | 61 | |
| 62 | 62 | =cut |
| 63 | 63 | |
diff -urN wiki-toolkit.orig/lib/Wiki/Toolkit.pm wiki-toolkit/lib/Wiki/Toolkit.pm
|
old
|
new
|
|
| 792 | 792 | is ignored except on new nodes. For existing nodes, use |
| 793 | 793 | $wiki->toggle_node_moderation to change the node moderation flag. |
| 794 | 794 | |
| 795 | | Returns 1 on success, 0 on conflict, croaks on error. |
| | 795 | Returns the version of the updated node on success, 0 on conflict, croaks on |
| | 796 | error. |
| 796 | 797 | |
| 797 | 798 | B<Note> on the metadata hashref: Any data in here that you wish to |
| 798 | 799 | access directly later must be a key-value pair in which the value is |
| … |
… |
|
| 852 | 853 | if ($search and $content) { |
| 853 | 854 | $search->index_node($node, $store->charset_encode($content) ); |
| 854 | 855 | } |
| 855 | | return 1; |
| | 856 | return $ret; |
| 856 | 857 | } |
| 857 | 858 | |
| 858 | 859 | =item B<format> |
diff -urN wiki-toolkit.orig/t/021_moderation.t wiki-toolkit/t/021_moderation.t
|
old
|
new
|
|
| 6 | 6 | if ( scalar @Wiki::Toolkit::TestLib::wiki_info == 0 ) { |
| 7 | 7 | plan skip_all => "no backends configured"; |
| 8 | 8 | } else { |
| 9 | | plan tests => ( 86 * scalar @Wiki::Toolkit::TestLib::wiki_info ); |
| | 9 | plan tests => ( 89 * scalar @Wiki::Toolkit::TestLib::wiki_info ); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | my $iterator = Wiki::Toolkit::TestLib->new_wiki_maker; |
| … |
… |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | # Update it |
| 64 | | ok( $wiki->write_node("Moderation", "yy", $mn_data{checksum}), |
| 65 | | "Can update where moderation is enabled" ); |
| | 64 | my $nmn_ver = $wiki->write_node("Moderation", "yy", $mn_data{checksum}); |
| | 65 | ok( $nmn_ver, "Can update where moderation is enabled" ); |
| 66 | 66 | my %nmn_data = $wiki->retrieve_node("Moderation"); |
| 67 | 67 | my %nmnv_data = $wiki->retrieve_node(name=>"Moderation", version=>2); |
| | 68 | is( $nmn_data{version}, '1', "Latest moderated version" ); |
| | 69 | is( $nmnv_data{version}, '2', "Latest unmoderated version" ); |
| | 70 | is( $nmn_ver, '2', "Latest (unmoderated) version returned by write_node" ); |
| 68 | 71 | |
| 69 | 72 | # Check content was updated right |
| 70 | 73 | is( $nmnv_data{content}, "yy", "Version 2 text"); |