Remove the tag support; nobody is using it anymore.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 19 Nov 2015 17:29:50 +0000 (18:29 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 19 Nov 2015 17:29:50 +0000 (18:29 +0100)
19 files changed:
perl/Sesse/pr0n/Common.pm
perl/Sesse/pr0n/Index.pm
perl/Sesse/pr0n/Listing.pm
perl/Sesse/pr0n/pr0n.pm
sql/pr0n.sql
templates/bilder.knatten.com/tag-listing [deleted file]
templates/bilder.knatten.com/tag-title [deleted file]
templates/default/mainmenu-events [deleted file]
templates/default/mainmenu-tags [deleted file]
templates/default/tag-listing [deleted file]
templates/default/tag-title [deleted file]
templates/images.tg05.gathering.org/tag-listing [deleted file]
templates/images.tg05.gathering.org/tag-title [deleted file]
templates/itk-bilder.samfundet.no/tag-listing [deleted file]
templates/itk-bilder.samfundet.no/tag-title [deleted file]
templates/skoyen.bilder.knatten.com/tag-listing [deleted file]
templates/skoyen.bilder.knatten.com/tag-title [deleted file]
templates/skoyen.bildereks.knatten.com/tag-listing [deleted file]
templates/skoyen.bildereks.knatten.com/tag-title [deleted file]

index 0569ef90fbd3bdb37a32c97a775e3759ac0ffb49..c4ceba03fde8e2207803aa2184524905b42ec7a3 100644 (file)
@@ -304,25 +304,6 @@ sub update_image_info {
                         undef, $width, $height, $datetime, $model, $lens, $id)
                        or die "Couldn't update width/height in SQL: $!";
                
-               # Tags
-               my @tags = $exiftool->GetValue('Keywords', 'ValueConv');
-               if (scalar @tags == 0) {
-                       # This is XMP-dc:Subject, an RDF bag of tags.
-                       @tags = $exiftool->GetValue('Subject', 'ValueConv');
-               }
-               $dbh->do('DELETE FROM tags WHERE image=?',
-                       undef, $id)
-                       or die "Couldn't delete old tag information in SQL: $!";
-
-               $q = $dbh->prepare('INSERT INTO tags (image,tag) VALUES (?,?)')
-                       or die "Couldn't prepare inserting tag information: $!";
-
-
-               for my $tag (@tags) {
-                       $q->execute($id, guess_charset($tag))
-                               or die "Couldn't insert tag information in database: $!";
-               }
-
                # update the last_picture cache as well (this should of course be done
                # via a trigger, but this is less complicated :-) )
                $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?),last_update=CURRENT_TIMESTAMP WHERE (vhost,event)=(SELECT vhost,event FROM images WHERE id=?)',
index 8500f9be457bf88e089db1c2e879f563417e6cb4..eca84793e1c6ebe0f338673a5a2ed0ff0cf3697c 100644 (file)
@@ -9,18 +9,11 @@ sub handler {
        my $r = shift;
        my $dbh = Sesse::pr0n::Common::get_dbh();
 
-       my ($event, $abspath, $datesort, $tag);
+       my ($event, $abspath, $datesort);
        if ($r->path_info =~ /^\/\+all\/?/) {
                $event = '+all';
                $abspath = 1;
-               $tag = undef; 
 
-               $datesort = 'DESC NULLS LAST';
-       } elsif ($r->path_info =~ /^\/\+tags\/([a-zA-Z0-9-]+)\/?$/) {
-               $tag = $1;
-               $event = "+tags/$tag";
-               $abspath = 1;
-               
                $datesort = 'DESC NULLS LAST';
        } else {
                # Find the event
@@ -28,7 +21,6 @@ sub handler {
                        or return error($r, "Could not extract event");
                $event = $1;
                $abspath = 0;
-               $tag = undef;
                $datesort = 'ASC NULLS LAST';
        }
 
@@ -66,10 +58,7 @@ sub handler {
        );
        
        my $where;
-       if (defined($tag)) {
-               my $tq = $dbh->quote($tag);
-               $where = " AND id IN ( SELECT image FROM tags WHERE tag=$tq )";
-       } elsif ($event eq '+all') {
+       if ($event eq '+all') {
                $where = '';
        } else {
                $where = ' AND event=' . $dbh->quote($event);
@@ -151,7 +140,7 @@ sub handler {
 
        my ($date, $name);
 
-       if ($event eq '+all' || defined($tag)) {
+       if ($event eq '+all') {
                $ref = $dbh->selectrow_hashref("SELECT EXTRACT(EPOCH FROM MAX(last_update)) AS last_update FROM last_picture_cache WHERE vhost=?",
                        undef, Sesse::pr0n::Common::get_server_name($r))
                        or return error($r, "Could not list events", 404, "File not found");
@@ -191,12 +180,7 @@ sub handler {
        if ($settings{'fullscreen'}) {
                $res->content_type("text/html; charset=utf-8");
 
-               if (defined($tag)) {
-                       my $title = Sesse::pr0n::Templates::process_template($res, $io, "tag-title", { tag => $tag });
-                       Sesse::pr0n::Templates::print_template($r, $io, "fullscreen-header", { title => $title });
-               } else {
-                       Sesse::pr0n::Templates::print_template($r, $io, "fullscreen-header", { title => "$name [$event]" });
-               }
+               Sesse::pr0n::Templates::print_template($r, $io, "fullscreen-header", { title => "$name [$event]" });
 
                my @files = ();
                while (my $ref = $q->fetchrow_hashref()) {
@@ -227,12 +211,7 @@ sub handler {
                        infobox => $infobox
                });
        } else {
-               if (defined($tag)) {
-                       my $title = Sesse::pr0n::Templates::process_template($r, $io, "tag-title", { tag => $tag });
-                       Sesse::pr0n::Common::header($r, $io, $title);
-               } else {
-                       Sesse::pr0n::Common::header($r, $io, "$name [$event]");
-               }
+               Sesse::pr0n::Common::header($r, $io, "$name [$event]");
                if (defined($date)) {
                        Sesse::pr0n::Templates::print_template($r, $io, "date", { date => $date });
                }
index 9f75fefd2bb7da15deef07fe9d3edef3b5ac5cf4..fd9f9041e2114275eac2432b577ae0d7dbd8d600 100644 (file)
@@ -39,68 +39,35 @@ sub handler {
        #       return $rc;
        # }
        
-       if ($r->path_info =~ /^\/\+tags\/?/) {
-               # Tag cloud
-               my $q = $dbh->prepare('SELECT tag,COUNT(*) AS frequency FROM tags t JOIN images i ON t.image=i.id WHERE vhost=? GROUP BY tag ORDER BY COUNT(*) DESC LIMIT 75')
-                       or return dberror($r, "Couldn't list events");
-               $q->execute(Sesse::pr0n::Common::get_server_name($r))
-                       or return dberror($r, "Couldn't get events");
-               
-               Sesse::pr0n::Common::header($r, $io, Sesse::pr0n::Templates::fetch_template($r, 'tag-listing'));
-               Sesse::pr0n::Templates::print_template($r, $io, 'mainmenu-tags');
-
-               my $cloud = HTML::TagCloud->new;
-
-               while (my $ref = $q->fetchrow_hashref()) {
-                       my $tag = $ref->{'tag'};
-                       my $html = HTML::Entities::encode_entities($tag);    # is this right?
-                       my $uri = Sesse::pr0n::Common::pretty_escape($tag);  # and this?
-
-                       $cloud->add($html, "/+tags/$uri/", $ref->{'frequency'});
-               }
-
-               $io->print($cloud->html_and_css());
-               Sesse::pr0n::Common::footer($r, $io);
-
-               $q->finish();
-       } else {
-               # main listing
+       # main listing
 #              my $q = $dbh->prepare('SELECT t1.id,t1.date,t1.name FROM events t1 LEFT JOIN images t2 ON t1.id=t2.event WHERE t1.vhost=? GROUP BY t1.id,t1.date,t1.name ORDER BY COALESCE(MAX(t2.date),\'1970-01-01 00:00:00\'),t1.id') or
 #                      dberror($r, "Couldn't list events");
-               my $q = $dbh->prepare('SELECT event,date,name FROM events e JOIN last_picture_cache c USING (vhost,event) WHERE vhost=? ORDER BY last_picture DESC NULLS LAST')
-                       or return dberror($r, "Couldn't list events");
-               $q->execute(Sesse::pr0n::Common::get_server_name($r))
-                       or return dberror($r, "Couldn't get events");
-               
-               Sesse::pr0n::Common::header($r, $io, Sesse::pr0n::Templates::fetch_template($r, 'event-listing'));
+       my $q = $dbh->prepare('SELECT event,date,name FROM events e JOIN last_picture_cache c USING (vhost,event) WHERE vhost=? ORDER BY last_picture DESC NULLS LAST')
+               or return dberror($r, "Couldn't list events");
+       $q->execute(Sesse::pr0n::Common::get_server_name($r))
+               or return dberror($r, "Couldn't get events");
+       
+       Sesse::pr0n::Common::header($r, $io, Sesse::pr0n::Templates::fetch_template($r, 'event-listing'));
 
-               # See if there are any tags related to this vhost
-               my $ref = $dbh->selectrow_hashref('SELECT * FROM tags t JOIN images i ON t.image=i.id WHERE vhost=? LIMIT 1',
-                       undef, Sesse::pr0n::Common::get_server_name($r));
-               if (defined($ref)) {
-                       Sesse::pr0n::Templates::print_template($r, $io, 'mainmenu-events');
-               }
+       my $allcaption = Sesse::pr0n::Templates::fetch_template($r, 'all-event-title');
+       $io->print("    <ul>\n");
+       $io->print("      <li><a href=\"+all/\">$allcaption</a></li>\n");
+       $io->print("    </ul>\n");
+       
+       $io->print("    <ul>\n");
 
-               my $allcaption = Sesse::pr0n::Templates::fetch_template($r, 'all-event-title');
-               $io->print("    <ul>\n");
-               $io->print("      <li><a href=\"+all/\">$allcaption</a></li>\n");
-               $io->print("    </ul>\n");
+       while (my $ref = $q->fetchrow_hashref()) {
+               my $id = $ref->{'event'};
+               my $date = HTML::Entities::encode_entities($ref->{'date'});
+               my $name = HTML::Entities::encode_entities($ref->{'name'});
                
-               $io->print("    <ul>\n");
-
-               while (my $ref = $q->fetchrow_hashref()) {
-                       my $id = $ref->{'event'};
-                       my $date = HTML::Entities::encode_entities($ref->{'date'});
-                       my $name = HTML::Entities::encode_entities($ref->{'name'});
-                       
-                       $io->print("      <li><a href=\"$id/\">$name</a> ($date)</li>\n");
-               }
+               $io->print("      <li><a href=\"$id/\">$name</a> ($date)</li>\n");
+       }
 
-               $io->print("    </ul>\n");
-               Sesse::pr0n::Common::footer($r, $io);
+       $io->print("    </ul>\n");
+       Sesse::pr0n::Common::footer($r, $io);
 
-               $q->finish();
-       }
+       $q->finish();
 
        $io->setpos(0);
        $res->body($io);
index bddfe223e2192e884db28e34392c7ce77c216ebb..f10f9f41633599ebc592936a92ef72ce08648cb5 100644 (file)
@@ -16,7 +16,7 @@ sub handler {
        my $r = shift;
 
        my $uri = $r->path_info;
-       if ($uri eq '/' || $uri =~ /^\/\+tags\/?$/) {
+       if ($uri eq '/') {
                return Sesse::pr0n::Listing::handler($r);
        } elsif ($uri eq '/robots.txt' ||
                 $uri eq '/pr0n.css' ||
@@ -67,8 +67,7 @@ sub handler {
        } elsif ($uri =~ m#^/newevent$#) {
                return Sesse::pr0n::NewEvent::handler($r);
        } elsif ($uri =~ /^\/[a-zA-Z0-9-]+\/?$/ ||
-                $uri =~ /^\/\+all\/?$/ ||
-                $uri =~ /^\/\+tags\/[a-zA-Z0-9-]+\/?$/) {
+                $uri =~ /^\/\+all\/?$/) {
                return Sesse::pr0n::Index::handler($r);
        } elsif ($uri =~ m#^/[a-zA-Z0-9-]+/(\d+x\d+(\@\d+(\.\d+)?)?/|original/)((?:no)?box/)?[a-zA-Z0-9._()-]+$#) {
                return Sesse::pr0n::Image::handler($r);
index fb4fd71328cf24288edb7c6f94f8a2ffef9b4806..36d82d6d532009042904ca5f79f14519261f01b8 100644 (file)
@@ -91,14 +91,6 @@ CREATE TABLE exif_info (
 CREATE INDEX exif_info_key ON exif_info ( key );
 CLUSTER exif_info_key ON exif_info;
 
-CREATE TABLE tags (
-    image integer NOT NULL REFERENCES images (id) ON DELETE CASCADE,
-    tag varchar NOT NULL,
-
-    PRIMARY KEY ( image, tag )
-);
-CREATE INDEX tags_tag ON tags ( tag );
-
 GRANT INSERT ON TABLE deleted_images TO pr0n;
 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE events TO pr0n;
 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE fake_files TO pr0n;
@@ -107,5 +99,4 @@ GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE images TO pr0n;
 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE shadow_files TO pr0n;
 GRANT SELECT,UPDATE ON TABLE users TO pr0n;
 GRANT SELECT,INSERT,DELETE ON TABLE exif_info TO pr0n;
-GRANT SELECT,INSERT,DELETE ON TABLE tags TO pr0n;
 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE last_picture_cache TO pr0n;
diff --git a/templates/bilder.knatten.com/tag-listing b/templates/bilder.knatten.com/tag-listing
deleted file mode 100644 (file)
index d8fd95d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Tagsky
diff --git a/templates/bilder.knatten.com/tag-title b/templates/bilder.knatten.com/tag-title
deleted file mode 100644 (file)
index 80a6792..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Alle bilder som er tagget '%TAG%'
diff --git a/templates/default/mainmenu-events b/templates/default/mainmenu-events
deleted file mode 100644 (file)
index d40f0f3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<p class="mainmenu">Events | <a href="/+tags/">Tags</a></p>
diff --git a/templates/default/mainmenu-tags b/templates/default/mainmenu-tags
deleted file mode 100644 (file)
index a6f681e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<p class="mainmenu"><a href="/">Events</a> | Tags</p>
diff --git a/templates/default/tag-listing b/templates/default/tag-listing
deleted file mode 100644 (file)
index c89240a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Tag cloud
diff --git a/templates/default/tag-title b/templates/default/tag-title
deleted file mode 100644 (file)
index d6ec5dd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-All images tagged '%TAG%'
diff --git a/templates/images.tg05.gathering.org/tag-listing b/templates/images.tg05.gathering.org/tag-listing
deleted file mode 100644 (file)
index c89240a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Tag cloud
diff --git a/templates/images.tg05.gathering.org/tag-title b/templates/images.tg05.gathering.org/tag-title
deleted file mode 100644 (file)
index d6ec5dd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-All images tagged '%TAG%'
diff --git a/templates/itk-bilder.samfundet.no/tag-listing b/templates/itk-bilder.samfundet.no/tag-listing
deleted file mode 100644 (file)
index d8fd95d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Tagsky
diff --git a/templates/itk-bilder.samfundet.no/tag-title b/templates/itk-bilder.samfundet.no/tag-title
deleted file mode 100644 (file)
index 80a6792..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Alle bilder som er tagget '%TAG%'
diff --git a/templates/skoyen.bilder.knatten.com/tag-listing b/templates/skoyen.bilder.knatten.com/tag-listing
deleted file mode 100644 (file)
index d8fd95d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Tagsky
diff --git a/templates/skoyen.bilder.knatten.com/tag-title b/templates/skoyen.bilder.knatten.com/tag-title
deleted file mode 100644 (file)
index 80a6792..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Alle bilder som er tagget '%TAG%'
diff --git a/templates/skoyen.bildereks.knatten.com/tag-listing b/templates/skoyen.bildereks.knatten.com/tag-listing
deleted file mode 100644 (file)
index d8fd95d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Tagsky
diff --git a/templates/skoyen.bildereks.knatten.com/tag-title b/templates/skoyen.bildereks.knatten.com/tag-title
deleted file mode 100644 (file)
index 80a6792..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Alle bilder som er tagget '%TAG%'