<commit_before>package RSGet::Plugin::AutoUpdate;
# This file is an integral part of rsget.pl downloader.
#
# 2009-2010 (c) <NAME> <<EMAIL>>
#		This program is free software,
# you may distribute it under GPL v2 or newer.

use strict;
use warnings;
use RSGet::Config;
use RSGet::Curl;
use RSGet::SQL;
#use RSGet::Plugin::Plugin;
use Digest::MD5 qw(md5_hex);

RSGet::Config::register_settings(
	plugin_uri => {
		desc => "http path to rsget.pl plugins updater.",
		default => 'http://rsget.pl/download/plugins.php',
		allowed => qr{https?://.{4,}/.+},
	},
);

sub update
{
	my $arr = RSGet::SQL::dbh->selectall_arrayref(
		"SELECT name, md5 FROM ${RSGet::SQL::prefix}plugin"
	);
	my %plugins = map { $_->[0], $_->[1] } @$arr;

	new RSGet::Curl
		RSGet::Config::get( undef, "plugin_uri" ),
		\&_process,
		post => \%plugins;
	
	warn "Updating plugins.\n";
	
	return 1;
}

sub _process
{
	my $error = shift;
	my $obj = shift;

	my $time = time;

	local $_;
	$_ = $obj->{body};

	my $updated = 0;<commit_msg>- updated for RSGet::Curl changes<commit_after>package RSGet::Plugin::AutoUpdate;
# This file is an integral part of rsget.pl downloader.
#
# 2009-2010 (c) <NAME> <<EMAIL>>
#		This program is free software,
# you may distribute it under GPL v2 or newer.

use strict;
use warnings;
use RSGet::Config;
use RSGet::Curl;
use RSGet::SQL;
#use RSGet::Plugin::Plugin;
use Digest::MD5 qw(md5_hex);

RSGet::Config::register_settings(
	plugin_uri => {
		desc => "http path to rsget.pl plugins updater.",
		default => 'http://rsget.pl/download/plugins.php',
		allowed => qr{https?://.{4,}/.+},
	},
);

sub update
{
	my $arr = RSGet::SQL::dbh->selectall_arrayref(
		"SELECT name, md5 FROM ${RSGet::SQL::prefix}plugin"
	);
	my %plugins = map { $_->[0], $_->[1] } @$arr;

	new RSGet::Curl
		RSGet::Config::get( undef, "plugin_uri" ),
		\&_process,
		post => \%plugins;
	
	warn "Updating plugins.\n";
	
	return 1;
}

sub _process
{
	my $obj = shift;
	return if $obj->{error};

	my $time = time;

	local $_;
	$_ = $obj->{body};

	my $updated = 0;
{'fraction_non_alphanumeric': 0.1848574237954769, 'fraction_numerical': 0.01671583087512291, 'mean_word_length': 4.113065326633166, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4301505', 'n_tokens_mistral': 850, 'n_tokens_neox': 776, 'n_words': 207}