]> mj.ucw.cz Git - gallery.git/blobdiff - gal2/gal-cache
Gallery2: Delete old theme "nrt"
[gallery.git] / gal2 / gal-cache
index 99095075e1b216f81f1993ca550d11045086a3b3..7d581a632dd21d8dd2a29dab4bd7f90b1a76345d 100755 (executable)
@@ -7,7 +7,7 @@ use warnings;
 
 use FindBin;
 use lib $FindBin::Bin;
-use UCW::Gallery qw(%CF);
+use UCW::Gallery;
 
 use Image::Magick;
 use IO::Handle;
@@ -16,18 +16,18 @@ use File::Path;
 
 STDOUT->autoflush(1);
 
-UCW::Gallery::LoadConfig;
+my $gal = UCW::Gallery->load_config;
 
 print "Reading gallery.list\n";
-my $orig_list = UCW::Gallery::ReadList('gallery.list') or die "Cannot read gallery.list: $!\n";
+my $orig_list = $gal->read_list('gallery.list') or die "Cannot read gallery.list: $!\n";
 
-my $photo_dir = $CF{'PhotoDir'};
+my $photo_dir = $gal->get('PhotoDir');
 my $photo_meta = File::Spec->catfile($photo_dir, 'gallery.meta');
 print "Reading meta-data from $photo_meta\n";
 -f $photo_meta or die "Cannot load $photo_meta\n";
-my $meta = UCW::Gallery::ReadMeta($photo_meta);
+my $meta = $gal->read_meta($photo_meta);
 
-my $cache_dir = $CF{'CacheDir'};
+my $cache_dir = $gal->get('CacheDir');
 if (-d $cache_dir) {
        print "Deleting old cache directory: $cache_dir\n";
        File::Path::remove_tree($cache_dir);
@@ -43,7 +43,7 @@ for my $f (@$orig_list) {
        $m->{title} = $f->{title};
 }
 
-for my $thumb_fmt (keys %{$CF{'ThumbFormats'}}) {
+for my $thumb_fmt (keys %{$gal->get('ThumbFormats')}) {
        my ($tw, $th) = ($thumb_fmt =~ m{^(\d+)x(\d+)$}) or die "Cannot parse thumbnail format $thumb_fmt\n";
        print "Generating $thumb_fmt thumbnails\n";
        my $thumb_meta = {};
@@ -93,4 +93,4 @@ for my $thumb_fmt (keys %{$CF{'ThumbFormats'}}) {
 
 my $cache_meta = File::Spec->catfile($cache_dir, 'cache.meta');
 print "Writing meta-data to $cache_meta\n";
-UCW::Gallery::WriteMeta($cache_meta, $meta);
+$gal->write_meta($cache_meta, $meta);