Changeset 26 for trunk/index.php
- Timestamp:
- Sep 11, 2019, 9:20:29 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r25 r26 99 99 if ($Query != null) $URL .= '&query='.$Query; 100 100 if ($StartNumber != null) $URL .= '&startNumber='.$StartNumber; 101 //echo($URL.'<br/>'); 101 102 $Content = file_get_contents($URL); 102 103 $JSON = json_decode($Content, true); 103 //print_r($JSON);104 104 return $JSON; 105 105 } 106 106 107 function QueryRunnersAll($Category = 'all' )107 function QueryRunnersAll($Category = 'all', $Count = 0) 108 108 { 109 109 $ItemsPerPage = 30; 110 110 $MaxCount = 450 * 30; 111 if ($Count > 0) $MaxCount = $Count; 111 112 $Result = array(); 112 113 $I = 0; 113 114 while (true) 114 115 { 115 $Page = $I * $MaxCount / $ItemsPerPage;116 $Page = $I * floor($MaxCount / $ItemsPerPage); 116 117 $JSON = $this->QueryRunners($Category, $Page, null, null, null, $MaxCount); 117 118 foreach ($JSON['items'] as $Item) … … 119 120 $Result[] = $Item; 120 121 } 121 if ( $JSON['last'] == 'true') break;122 if (($JSON['last'] == 'true') or (count($JSON) == 0)) break; 122 123 if ($I > 10) break; // Safe limit if last would not work 123 124 $I++; … … 278 279 { 279 280 $Time = time(); 280 $Items = $this->QueryRunnersAll('teams' );281 $Items = $this->QueryRunnersAll('teams', 520); 281 282 $Items = array_merge($Items, $this->QueryRunnersAll('families')); 282 283 $Items = array_merge($Items, $this->QueryRunnersAll('')); … … 287 288 $ItemsWithoutProgress[] = $Item; 288 289 } 289 //print_r($Items);290 290 $Hash = md5(serialize($ItemsWithoutProgress)); 291 291 … … 295 295 $Import = $DbResult->fetch_assoc(); 296 296 } else $Import = array('Hash' => ''); 297 if ($Import['Hash'] != $Hash)297 //if ($Import['Hash'] != $Hash) 298 298 { 299 299 $this->Sync($Items, $Time);
Note:
See TracChangeset
for help on using the changeset viewer.