\n
\n"; #ob_flush(); const DEBUG_TIME_SECS = 300; const PRODUCTION_TIME_SECS = 5; $fileContent = getCachedFileContentsOrUpdate($url, PRODUCTION_TIME_SECS); $fileContent = mb_convert_encoding($fileContent, 'UTF-8'); $fileLines = explode("\n", $fileContent); $twtFollowingList = []; foreach ($fileLines as $currentLine) { if (str_starts_with($currentLine, '#')) { if (!is_null(getDoubleParameter('follow', $currentLine))) { $twtFollowingList[] = getDoubleParameter('follow', $currentLine); } } } # Load all the files # Save a flag to know it's loading files in the background /* foreach ($twtFollowingList as $following) { echo "Updating: $following[1]
\n"; #ob_flush(); flush(); updateCachedFile($following[1]); } */ //echo 'Finished'; //ob_flush(); //header('Location: /'); //exit(); /* from: https://github.com/w3shaman/php-progress-bar */ echo '
'; echo '
'; $i = 1; foreach ($twtFollowingList as $following) { $total = count($twtFollowingList); // Calculate the percentation $percent = intval($i/$total * 100)."%"; // Javascript for updating the progress bar and information echo ''; // This is for the buffer achieve the minimum size in order to flush data echo "Updating: $following[1]"." (".$i."/".$total.")
\n"; updateCachedFile($following[1]); // Send output to browser immediately flush(); $i++; } echo 'Finished'; // Tell user that the process is completed echo '';