George S. Baugh 4 lat temu
rodzic
commit
95988d18de
2 zmienionych plików z 64 dodań i 1 usunięć
  1. 63 0
      bin/migrate3.pl
  2. 1 1
      www/templates/post_tags.tx

+ 63 - 0
bin/migrate3.pl

@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+# Migrate early on tcms3 flatfile sites to 'all posts are series code' (august 2021) code
+
+use FindBin;
+
+use lib "$FindBin::Bin/../lib";
+
+use Trog::Config;
+use Trog::Data;
+use List::Util;
+use UUID::Tiny;
+
+use Trog::SQLite;
+use Trog::SQLite::TagIndex;
+
+# Kill the post index
+unlink "$FindBin::Bin/../data/posts.db";
+$ENV{NOHUP} = 1;
+
+sub uuid { return UUID::Tiny::create_uuid_as_string(UUID::Tiny::UUID_V1, UUID::Tiny::UUID_NS_DNS); }
+
+# Modify these variables to suit your installation.
+my $user = 'george';
+my @extra_series = (
+);
+
+my $conf = Trog::Config::get();
+my $search_info = Trog::Data->new($conf);
+
+my @all = $search_info->get( raw => 1, limit => 0 );
+
+#TODO add in the various things we need to data
+
+# Rebuild the index
+Trog::SQLite::TagIndex::build_index($search_info);
+Trog::SQLite::TagIndex::build_routes($search_info);
+
+# Add in the series
+my $series = [
+        {
+            "acls"       => [],
+            aliases      => [],
+            "callback"   => "Trog::Routes::HTML::posts",
+            method       => 'GET',
+            "data"       => "All Posts",
+            "href"       => "/posts",
+            "local_href" => "/posts",
+            "preview"    => "/img/sys/testpattern.jpg",
+            "tags"       => [qw{series}],
+            visibility   => 'unlisted',
+            "title"      => "All Posts",
+            user         => $user,
+            form         => 'series.tx',
+            child_form   => 'series.tx',
+            aclname      => 'posts',
+        },
+];
+
+$search_info->add(@$series,@extra_series);

+ 1 - 1
www/templates/post_tags.tx

@@ -1,5 +1,5 @@
 <span id="<: $post.id :>-tags">
 : for $post.extra_tags -> $tag {
-    <a href="?tag=<: $tag :>" class="tag">🏷️ <: $tag :></a>
+    <a href="/posts?tag=<: $tag :>" class="tag">🏷️ <: $tag :></a>
 : }
 </span>