version 1.23, 2007/07/25 23:17:49
|
version 1.33, 2011/05/31 14:45:53
|
Line 93 FULLTEXT idx_language (language),
|
Line 93 FULLTEXT idx_language (language),
|
FULLTEXT idx_owner (owner), |
FULLTEXT idx_owner (owner), |
FULLTEXT idx_copyright (copyright)) |
FULLTEXT idx_copyright (copyright)) |
|
|
TYPE=MYISAM; |
ENGINE=MYISAM; |
|
|
=cut |
=cut |
|
|
Line 356 sub create_metadata_storage {
|
Line 356 sub create_metadata_storage {
|
$col_des.="(".$coldata->{'size'}.")"; |
$col_des.="(".$coldata->{'size'}.")"; |
} |
} |
} |
} |
|
if (($tablename =~ /allusers/) && ($column eq 'username')) { |
|
$col_des .= ' CHARACTER SET latin1 COLLATE latin1_general_cs'; |
|
} |
# Modifiers |
# Modifiers |
if (exists($coldata->{'restrictions'})){ |
if (exists($coldata->{'restrictions'})){ |
$col_des.=" ".$coldata->{'restrictions'}; |
$col_des.=" ".$coldata->{'restrictions'}; |
Line 381 sub create_metadata_storage {
|
Line 384 sub create_metadata_storage {
|
$text .= 'idx_'.$colname.' ('.$colname.')'; |
$text .= 'idx_'.$colname.' ('.$colname.')'; |
push (@Columns,$text); |
push (@Columns,$text); |
} |
} |
$request .= "(".join(", ",@Columns).") TYPE=MyISAM"; |
$request .= "(".join(", ",@Columns).") ENGINE=MyISAM"; |
return $request; |
return $request; |
} |
} |
|
|
Line 488 sub store_metadata {
|
Line 491 sub store_metadata {
|
|
|
=pod |
=pod |
|
|
=item () |
=item lookup_metadata() |
|
|
Inputs: database handle ($dbh) and a hash or hash reference containing |
Inputs: database handle ($dbh) and a hash or hash reference containing |
metadata which will be used for a search. |
metadata which will be used for a search. |
Line 935 sub process_dynamic_metadata {
|
Line 938 sub process_dynamic_metadata {
|
} |
} |
# |
# |
# put together comments |
# put together comments |
my $comments = '<div class="LCevalcomments">'; |
my $comments = ''; |
foreach my $evaluator (keys(%{$resdata->{'evaluation'}->{'comments'}})){ |
foreach my $evaluator (keys(%{$resdata->{'evaluation'}->{'comments'}})){ |
$comments .= |
$comments .= |
'<p>'. |
'<p>'. |
'<b>'.$evaluator.'</b>:'. |
'<b>'.$evaluator.'</b>: '. |
$resdata->{'evaluation'}->{'comments'}->{$evaluator}. |
$resdata->{'evaluation'}->{'comments'}->{$evaluator}. |
'</p>'; |
'</p>'; |
} |
} |
$comments .= '</div>'; |
if ($comments) { |
$data{'comments'} = $comments; |
$comments = '<div class="LCevalcomments">' |
|
.$comments |
|
.'</div>'; |
|
$data{'comments'} = $comments; |
|
} |
# |
# |
if (exists($resdata->{'stats'})) { |
if (exists($resdata->{'stats'})) { |
$data{'stats'} = $resdata->{'stats'}; |
$data{'stats'} = $resdata->{'stats'}; |
Line 1076 sub process_portfolio_access_data {
|
Line 1083 sub process_portfolio_access_data {
|
($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/); |
($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/); |
next if (($scope ne 'public') && ($scope ne 'guest')); |
next if (($scope ne 'public') && ($scope ne 'guest')); |
$acc_data->{scope} = $scope; |
$acc_data->{scope} = $scope; |
|
my $sqltime_error; |
if ($end != 0) { |
if ($end != 0) { |
$acc_data->{end} = &sqltime($end); |
$acc_data->{end} = &sqltime($end,\$sqltime_error); |
|
} |
|
$acc_data->{start} = &sqltime($start,\$sqltime_error); |
|
if ($sqltime_error) { |
|
$loghash{$key}{'err'} = $sqltime_error; |
} |
} |
$acc_data->{start} = &sqltime($start); |
|
if (! $simulate) { |
if (! $simulate) { |
my ($count,$err) = |
my ($count,$err) = |
&store_metadata($dbh,$newnames->{'access'}, |
&store_metadata($dbh,$newnames->{'access'}, |
Line 1123 sub process_portfolio_metadata {
|
Line 1134 sub process_portfolio_metadata {
|
if (-e $fullpath) { |
if (-e $fullpath) { |
my ($ref,$crs,$addedfields) = &portfolio_metadata($fullpath,$dom,$uname, |
my ($ref,$crs,$addedfields) = &portfolio_metadata($fullpath,$dom,$uname, |
$group); |
$group); |
&getfiledates($ref,$fullpath); |
my $sqltime_error; |
|
&getfiledates($ref,$fullpath,\$sqltime_error); |
if ($is_course) { |
if ($is_course) { |
$ref->{'groupname'} = $group; |
$ref->{'groupname'} = $group; |
} |
} |
Line 1138 sub process_portfolio_metadata {
|
Line 1150 sub process_portfolio_metadata {
|
); |
); |
my %loghash; |
my %loghash; |
if (! $simulate) { |
if (! $simulate) { |
|
if ($sqltime_error) { |
|
$loghash{'metadata'."\0"}{'err'} = $sqltime_error; |
|
} |
my ($count,$err) = |
my ($count,$err) = |
&store_metadata($dbh,$newnames->{'portfolio'},'portfolio_metadata', |
&store_metadata($dbh,$newnames->{'portfolio'},'portfolio_metadata', |
\%Data); |
\%Data); |
Line 1183 sub process_allusers_data {
|
Line 1198 sub process_allusers_data {
|
if ($udom eq '' || $uname eq '' ) { |
if ($udom eq '' || $uname eq '' ) { |
$error = 'No domain and/or username specified'; |
$error = 'No domain and/or username specified'; |
} else { |
} else { |
$delitem = 'domain = '.$dbh->quote($udom).' AND username = '. |
$delitem = 'domain = '.$dbh->quote($udom).' AND username '. |
$dbh->quote($uname); |
'COLLATE latin1_general_cs = '.$dbh->quote($uname); |
$error=&delete_metadata($dbh,$newnames->{'allusers'},$delitem); |
$error=&delete_metadata($dbh,$newnames->{'allusers'},$delitem); |
} |
} |
if (defined($error)) { |
if (defined($error)) { |
Line 1229 sub getfile {
|
Line 1244 sub getfile {
|
} |
} |
|
|
## |
## |
## &getfiledates() |
## &getfiledates($ref,$target,$sqltime_error) |
## Converts creationdate and modifieddates to SQL format |
## Converts creationdate and modifieddates to SQL format |
## Applies stat() to file to retrieve dates if missing |
## Applies stat() to file to retrieve dates if missing |
sub getfiledates { |
sub getfiledates { |
my ($ref,$target) = @_; |
my ($ref,$target,$sqltime_error) = @_; |
if (! defined($ref->{'creationdate'}) || |
if (! defined($ref->{'creationdate'}) || |
$ref->{'creationdate'} =~ /^\s*$/) { |
$ref->{'creationdate'} =~ /^\s*$/) { |
$ref->{'creationdate'} = (stat($target))[9]; |
$ref->{'creationdate'} = (stat($target))[9]; |
Line 1242 sub getfiledates {
|
Line 1257 sub getfiledates {
|
$ref->{'lastrevisiondate'} =~ /^\s*$/) { |
$ref->{'lastrevisiondate'} =~ /^\s*$/) { |
$ref->{'lastrevisiondate'} = (stat($target))[9]; |
$ref->{'lastrevisiondate'} = (stat($target))[9]; |
} |
} |
$ref->{'creationdate'} = &sqltime($ref->{'creationdate'}); |
$ref->{'creationdate'} = &sqltime($ref->{'creationdate'},$sqltime_error); |
$ref->{'lastrevisiondate'} = &sqltime($ref->{'lastrevisiondate'}); |
$ref->{'lastrevisiondate'} = &sqltime($ref->{'lastrevisiondate'},$sqltime_error); |
} |
} |
|
|
## |
## |
## &sqltime($timestamp) |
## &sqltime($timestamp,$sqltime_error) |
## |
## |
## Convert perl $timestamp to MySQL time. MySQL expects YYYY-MM-DD HH:MM:SS |
## Convert perl $timestamp to MySQL time. MySQL expects YYYY-MM-DD HH:MM:SS |
## |
## |
sub sqltime { |
sub sqltime { |
my ($time) = @_; |
my ($time,$sqltime_error) = @_; |
my $mysqltime; |
my $mysqltime; |
if ($time =~ |
if ($time =~ |
/(\d+)-(\d+)-(\d+) # YYYY-MM-DD |
/(\d+)-(\d+)-(\d+) # YYYY-MM-DD |
Line 1275 sub sqltime {
|
Line 1290 sub sqltime {
|
} elsif (! defined($time) || $time == 0) { |
} elsif (! defined($time) || $time == 0) { |
$mysqltime = 0; |
$mysqltime = 0; |
} else { |
} else { |
&log(0," sqltime:Unable to decode time ".$time); |
if (ref($sqltime_error) eq 'SCALAR') { |
|
$$sqltime_error = "sqltime:Unable to decode time ".$time; |
|
} |
$mysqltime = 0; |
$mysqltime = 0; |
} |
} |
return $mysqltime; |
return $mysqltime; |