|
From: <cl...@us...> - 2004-05-23 08:23:56
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20922/functions Modified Files: ical_parser.php Log Message: Added cache for All Combined. Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -d -r1.167 -r1.168 *** ical_parser.php 23 May 2004 05:36:30 -0000 1.167 --- ical_parser.php 23 May 2004 08:23:45 -0000 1.168 *************** *** 34,51 **** // reading the file if it's allowed $parse_file = true; ! if (($is_webcal == false) && ($save_parsed_cals == 'yes') && ($cal != $ALL_CALENDARS_COMBINED)) { ! $realcal_mtime = filemtime($filename); ! $parsedcal = $tmp_dir.'/parsedcal-'.$cal_filename.'-'.$this_year; ! if (file_exists($parsedcal)) { ! $parsedcal_mtime = filemtime($parsedcal); ! if ($realcal_mtime == $parsedcal_mtime) { $fd = fopen($parsedcal, 'r'); $contents = fread($fd, filesize($parsedcal)); fclose($fd); $master_array = unserialize($contents); ! if ($master_array['-1'] == 'valid cal file') { ! $parse_file = false; ! $calendar_name = $master_array['calendar_name']; ! $calendar_tz = $master_array['calendar_tz']; } } --- 34,84 ---- // reading the file if it's allowed $parse_file = true; ! if (($is_webcal == false) && ($save_parsed_cals == 'yes')) { ! if (sizeof ($cal_filelist) > 1) { ! $parsedcal = $tmp_dir.'/parsedcal-'.$cal_filename.'-'.$this_year; ! if (file_exists($parsedcal)) { $fd = fopen($parsedcal, 'r'); $contents = fread($fd, filesize($parsedcal)); fclose($fd); $master_array = unserialize($contents); ! $z=1; ! $y=0; ! if (sizeof($master_array['-4']) == (sizeof($cal_filelist))) { ! foreach ($master_array['-4'] as $temp_array) { ! $mtime = $master_array['-4'][$z]['mtime']; ! $fname = $master_array['-4'][$z]['filename']; ! $realcal_mtime = filemtime($fname); ! if ($mtime == $realcal_mtime) { ! $y++; ! } ! $z++; ! } ! if ($y == sizeof($cal_filelist)) { ! if ($master_array['-1'] == 'valid cal file') { ! $parse_file = false; ! $calendar_name = $master_array['calendar_name']; ! $calendar_tz = $master_array['calendar_tz']; ! } ! } ! } ! } ! if ($parse_file == true) unset($master_array); ! } else { ! foreach ($cal_filelist as $filename) { ! $realcal_mtime = filemtime($filename); ! $parsedcal = $tmp_dir.'/parsedcal-'.$cal_filename.'-'.$this_year; ! if (file_exists($parsedcal)) { ! $parsedcal_mtime = filemtime($parsedcal); ! if ($realcal_mtime == $parsedcal_mtime) { ! $fd = fopen($parsedcal, 'r'); ! $contents = fread($fd, filesize($parsedcal)); ! fclose($fd); ! $master_array = unserialize($contents); ! if ($master_array['-1'] == 'valid cal file') { ! $parse_file = false; ! $calendar_name = $master_array['calendar_name']; ! $calendar_tz = $master_array['calendar_tz']; ! } ! } } } *************** *** 72,75 **** --- 105,111 ---- if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($error_invalidcal_lang, $filename)); + //Mod time + $actual_mtime = filemtime($filename); + // Set a value so we can check to make sure $master_array contains valid data $master_array['-1'] = 'valid cal file'; *************** *** 121,124 **** --- 157,162 ---- if (!isset($master_array[-3][$calnumber])) $master_array[-3][$calnumber] = $actual_calname; + if (!isset($master_array[-4][$calnumber]['mtime'])) $master_array[-4][$calnumber]['mtime'] = $actual_mtime; + if (!isset($master_array[-4][$calnumber]['filename'])) $master_array[-4][$calnumber]['filename'] = $filename; // Handle DURATION *************** *** 1094,1098 **** // write the new master array to the file ! if (isset($master_array) && is_array($master_array) && $save_parsed_cals == 'yes' && $is_webcal == FALSE && $cal != $ALL_CALENDARS_COMBINED) { $write_me = serialize($master_array); $fd = fopen($parsedcal, 'w'); --- 1132,1136 ---- // write the new master array to the file ! if (isset($master_array) && is_array($master_array) && $save_parsed_cals == 'yes' && $is_webcal == FALSE) { $write_me = serialize($master_array); $fd = fopen($parsedcal, 'w'); *************** *** 1106,1110 **** //print '<pre>'; ! //print_r($master_array[20040529]); //print_r($overlap_array); //print_r($day_array); --- 1144,1148 ---- //print '<pre>'; ! //print_r($master_array['-4']); //print_r($overlap_array); //print_r($day_array); |