Файл: EasyHost v2.0/system/lib/transfer.pl
Строк: 27
<?php
sub go
{
use EasyHost::Display;
use EasyHost::Category;
use EasyHost::DBI;
use EasyHost::Directory;
use EasyHost::Email;
use EasyHost::File;
use EasyHost::FileExtension;
use EasyHost::Format;
use EasyHost::Log;
use EasyHost::Login;
use EasyHost::Package;
use EasyHost::Search;
use EasyHost::SearchFile;
use EasyHost::Service;
use EasyHost::Socket;
use EasyHost::Stats;
use EasyHost::System;
use EasyHost::User;
use EasyHost::UserDirectory;
use EasyHost::UserFile;
use EasyHost::UserSearchFile;
my $system = EasyHost::System->new(@_);
my $dir_length = length $system->config('root_dir');
$system->db->do('CREATE TABLE IF NOT EXISTS transfer (id INT UNSIGNED NOT NULL,bytes BIGINT UNSIGNED NOT NULL,date_online DATE NOT NULL,PRIMARY KEY (id,date_online))');
$system->db->do('REPLACE INTO config VALUES (?,?)',undef,'transfer','on');
my $time = time;
while (<STDIN>)
{
foreach (split /n/)
{
my ($bytes,$bytes2,$date,$path) = split /s+/,$_,4;
$bytes += $bytes2;
if ($bytes > 0 && substr($path,0,$dir_length) eq $system->config('root_dir'))
{
my $user = $system->service->user((split(///,substr($path,$dir_length)))[0]) || next;
$user->transfer_set($bytes,$date);
}
}
if ($time < time - 60)
{
EasyHost::Display->delete;
$time = time;
}
}
$system->db->do('DELETE FROM config WHERE name = ?',undef,'transfer');
}
1;
?>