remove WebGUI::Utility::isIn

This commit is contained in:
Graham Knop 2010-09-07 12:33:15 -05:00
parent 0e754a51e4
commit 6aa26c2e44
61 changed files with 126 additions and 148 deletions

View file

@ -121,7 +121,7 @@ sub addFiles {
print "\tAdding ".$file->{fullPathFile}." to the database.\n" unless ($quiet);
# Figure out whether the file is an image or not by its extension.
if (isIn(lc($file->{ext}),@nailable)) {
if (lc($file->{ext}) ~~ @nailable) {
$class = 'WebGUI::Asset::File::Image';
$templateId = 'PBtmpl0000000000000088';
}

View file

@ -43,7 +43,7 @@ print "\nLooking for orphans...\n" unless ($quiet);
my $orphansFound = 0;
my $rs = $session->db->read("select assetId from asset order by lineage");
while (my ($id) = $rs->array) {
unless (isIn($id, @found)) {
unless ($id ~~ @found) {
print "\tFound an orphan with an assetId of $id. Moving it to the import node.\n";
$session->db->write("update asset set parentId='PBasset000000000000002' where assetId=?",[$id]);
getDescendants($id);
@ -80,7 +80,7 @@ print "\nDon't forget to clear your cache.\n" unless ($quiet);
sub getDescendants {
my $parentId = shift;
my $depth = shift || 0;
if (isIn($parentId, @found)) {
if ($parentId ~~ @found) {
print "\nFound circular relationships involving $parentId. This requires manual intervention.\n" unless ($quiet);
exit;
}

View file

@ -398,13 +398,6 @@ sub installModule {
chdir $cwd;
}
#----------------------------------------
sub isIn {
my $key = shift;
$_ eq $key and return 1 for @_;
return 0;
}
#----------------------------------------
sub isRootRequirementMet {
if (getOs() eq "Linuxish") {
@ -437,7 +430,7 @@ sub prompt {
my $answer = <STDIN>;
chomp $answer;
$answer = $default if ($answer eq "");
$answer = prompt($question,$default,@answers) if (($#answers > 0 && !(isIn($answer,@answers))) || $answer eq "");
$answer = prompt($question,$default,@answers) if (($#answers > 0 && !($answer ~~ @answers)) || $answer eq "");
return $answer;
}

View file

@ -72,7 +72,7 @@ sub createThumbnail {
($x, $y) = $image->Get('width','height');
$r = $x>$y ? $x / $thumbnailSize : $y / $thumbnailSize;
$image->Scale(width=>($x/$r),height=>($y/$r)) if ($r > 0);
if (isIn($type, qw(tif tiff bmp))) {
if ( $type ~~ [qw(tif tiff bmp)] ) {
$image->Write('thumb-'.$fileName.'.png');
} else {
$image->Write($_[1].'/thumb-'.$fileName);
@ -88,7 +88,7 @@ sub shouldThumbnail {
return 0 if $fileName =~ m/thumb-/;
##I am not a graphics file, skip me
return 0 if !isIn($fileType, qw(jpg jpeg gif png tif tiff bmp));
return 0 if ! $fileType ~~ [qw(jpg jpeg gif png tif tiff bmp)];
##My thumbnail already exists and I was told not to do it again
return 0 if ($onlyMissingThumbnails && -e 'thumb-'.$fileName);

View file

@ -174,7 +174,7 @@ while(my $line = <FILE>) {
if $user{connectDN};
$auth->saveParams($u->userId,"WebGUI",{changePassword=>$user{changePassword}});
foreach my $field (keys %user) {
if (isIn($field, @profileFields)) {
if ($field ~~ @profileFields) {
$u->profileField($field,$user{$field});
}
}