From 27cff350e9e5fb832185bc14dee35b5b8f942a81 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 9 Nov 2005 17:14:54 +0000 Subject: =?UTF-8?q?=20*=20passati=20i=20template=20a=20HTML4,=20altrimenti?= =?UTF-8?q?=20l'autocompletamento=20non=20va=20=20*=20aggiunto=20autocompl?= =?UTF-8?q?etamento=20per=20i=20nomi=20di=20tag=20=20*=20migliorato=20il?= =?UTF-8?q?=20caricatore=20da=20YAML=20=20*=20aggiunto=20un=20convertitore?= =?UTF-8?q?=20XBEL=20->=20YAML=20=20*=20aggiunto=20campo=20'tipo=20icona'?= =?UTF-8?q?=20=20*=20aggiunta=20funzionalit=C3=A0=20di=20edit=20e=20delete?= =?UTF-8?q?=20di=20link=20=20*=20dopo=20ogni=20update=20di=20un=20link,=20?= =?UTF-8?q?i=20tag=20non=20pi=C3=B9=20riferiti=20vengono=20cancellati=20?= =?UTF-8?q?=20*=20migliorato=20il=20recupero=20favicon,=20con=20tipo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/check_icons.pl | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 script/check_icons.pl (limited to 'script/check_icons.pl') diff --git a/script/check_icons.pl b/script/check_icons.pl new file mode 100644 index 0000000..2afdc7d --- /dev/null +++ b/script/check_icons.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl +use strict; +use warnings; +use FindBin; +use DBI; +use MIME::Base64; +use File::MMagic; +use Path::Class; + +my $DBHOME=dir($FindBin::Bin)->parent->file('bookmarks.db'); +my $db=DBI->connect("dbi:SQLite:$DBHOME"); + +my $magic=File::MMagic->new(); + +my $sth=$db->prepare('select pk,icon from links'); +$sth->execute(); +my ($pk,$icon,$type); +my @to_clean=();my %to_update; +while (($pk,$icon)=$sth->fetchrow_array()) { + $icon=decode_base64($icon); + $type=$magic->checktype_contents($icon); + if ($type =~ /^text/) { + push @to_clean,$pk; + } + else { + $to_update{$pk}=$type; + } +} + +$sth=$db->prepare(q{update links set icon='' where pk=?}); +for $pk (@to_clean) { + $sth->execute($pk); +} +$sth=$db->prepare(q{update links set icon_type=? where pk=?}); +while (($pk,$type)=each %to_update) { + $sth->execute($type,$pk); +} + +$db->disconnect; -- cgit v1.2.3