View Single Post
Old 01-21-2004, 10:01 AM   #10
tester
Green Mole
 
Join Date: Jan 2004
Posts: 10
Thumbs up SOLUTION FOUND

So we (pardon all the we's and I's; there are two of us working on this) figured out what the problem was.

For some reason, PHPDig was not REALLY getting the MoodleSession out of the URI.

This caused the script to dig for a REALLY long time, not only with updating, but also with the initial index (1.5 hours for ~229 REAL file permutations; 11+ hours for the update).

I made a function called "adamize" that chops out the MoodleSession part of the URI altogether, so that PHPDig does not even know it exists. Ever.

I placed the function below at the bottom of the "robot_functions.php" page, and then made a reference to it at line 172 (in my file) in function phpdigRewriteUrl, under the "settype($eval,'string')" line:

PHP Code:
$eval adamize($eval); 
and for the bottom:

PHP Code:
function adamize($file)
{
//    Determines whether or not "MoodleSession" occurs within
//    a given filename (or actually a returned URI)
    
if(strstr($file,"MoodleSession"))
    {
//    The position in which MoodleSession is found.
        
$starts strpos($file,"MoodleSession");

//    Because MooodleSession (for me) ALWAYS will occur at the
//    end of a URI, just get the beginning of the string until
//    the occurance of MoodleSession.
        
$file substr($file,0,$starts);

//    Get the last character of the new file string.
        
$ends substr($file,strlen($file)-1);
    
//    Figure out if the end of the string is a ? or a &.
//    If it is either one, just cut it out of the string.    
        
if($ends == "?" || $ends == "&")
            
$file substr($file,0,strlen($file)-1);

//    Return the new "file" variable, with MoodleSession cut out.
        
return $file;
    }

//    If the filename doesn't have Moodle Session inside it,
//    simply return the file variable as it was.
    
else
        return 
$file;

If there any questions, post here.
tester is offline   Reply With Quote