Changeset 8189


Ignore:
Timestamp:
07/16/10 00:59:44 (23 months ago)
Author:
SvenDowideit
Message:

Item2646: commited JulianLevens' windows quoting improvements. Unhappily, there are still many unit test failures using forking on windows - anyone interested in helping, remove the 'skip forking search' in Fn_SEARCH.pm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki/Store/SearchAlgorithms/Forking.pm

    r7967 r8189  
    6363    if ( $Foswiki::cfg{DetailedOS} eq 'MSWin32' ) { 
    6464 
    65         #try to escape the ^ ad "" for native windows grep and apache 
     65        #try to escape the ^ and "" for native windows grep and apache 
    6666        $searchString =~ s/\[\^/[^^/g; 
    67         $searchString =~ s/"/""/g; 
     67 
     68        # Fix escaping and quoting for Windows 
     69        $searchString =~ s#\\#\\\\#g; 
     70        $searchString =~ s#"#\\"#g; 
     71        $searchString = q(") . $searchString . q("); 
    6872    } 
    6973 
     
    7983    ##heck, on pre WinXP its only 2048, post XP its 8191 - http://support.microsoft.com/kb/830473 
    8084    if ( $Foswiki::cfg{DetailedOS} eq 'MSWin32' ) { 
     85 
    8186        #tune the number based on the length of "$sDir/WebSearchAdvanced.txt" 
    8287        #30 is a guess - wotamess 
    83         $maxTopicsInSet = ((8191-(length($program)+length($searchString)+30)) / (length("$sDir/LongWebSearchAdvanced.txt")+10)); 
     88        $maxTopicsInSet = 
     89          ( ( 8191 - ( length($program) + length($searchString) + 30 ) ) / 
     90              ( length("$sDir/LongWebSearchAdvanced.txt") + 10 ) ); 
     91 
    8492        #print STDERR "++++++++++++ $maxTopicsInSet \n"; 
    8593    } 
     
    161169 
    162170        my $webObject = Foswiki::Meta->new( $session, $web ); 
    163         my $thisWebNoSearchAll = Foswiki::isTrue( $webObject->getPreference('NOSEARCHALL') ); 
     171        my $thisWebNoSearchAll = 
     172          Foswiki::isTrue( $webObject->getPreference('NOSEARCHALL') ); 
    164173 
    165174        # make sure we can report this web on an 'all' search 
     
    231240            while ( $topicSet->hasNext() ) { 
    232241                my $webtopic = $topicSet->next(); 
    233                 my ( $itrWeb, $topic ) = Foswiki::Func::normalizeWebTopicName( $web, $webtopic ); 
     242                my ( $itrWeb, $topic ) = 
     243                  Foswiki::Func::normalizeWebTopicName( $web, $webtopic ); 
    234244 
    235245                if ( $options->{'casesensitive'} ) { 
     
    251261            my $textMatches = 
    252262              search( $tokenCopy, $web, $topicSet, $session, $options ); 
     263 
    253264            #bring the text matches into the topicMatch hash 
    254265            if ($textMatches) { 
     
    277288            @scopeTextList = keys(%topicMatches); 
    278289        } 
     290 
    279291        # reduced topic list for next token 
    280292        $topicSet = 
Note: See TracChangeset for help on using the changeset viewer.