Index: trunk/tools/rotatebot/rotbot.php |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | */ |
103 | 103 | |
104 | 104 | //noch restliche daten nachladen von api.php |
105 | | - |
| 105 | +$urlpageids = ''; |
106 | 106 | foreach($contentarray['pages'] as $picture) |
107 | 107 | { |
108 | 108 | $urlpageids .= "|".$picture['pageid']; |
— | — | @@ -173,40 +173,40 @@ |
174 | 174 | |
175 | 175 | foreach($picture['revisions'] as $key => $revisions) |
176 | 176 | { |
177 | | - if(trim($revisions['timestamp']) == $revitimestp) |
178 | | - { |
179 | | - $catcontent[$arraykey]['tmplsetter'] = $picture['revisions'][$key]['user']; |
180 | | - logfile("Template by: ".$catcontent[$arraykey]['tmplsetter']); |
181 | | - } |
182 | | - else |
183 | | - { |
184 | | - logfile("set time($revitimestp) not identical with this rv, ".$revisions['timestamp']."."); |
185 | | - //Rev's nachladen |
186 | | - $ctxctx = file_get_contents("http://commons.wikimedia.org/w/api.php?action=query&prop=revisions&pageids=".$picture['pageid']."&rvlimit=20&rvprop=timestamp|user|comment&format=php") or suicide("api error"); |
187 | | - $totrevs = unserialize($ctxctx); |
188 | | - logfile("ID: ".$picture['pageid']." "); |
189 | | - |
190 | | - if(is_array($totrevs)) |
| 177 | + if(trim($revisions['timestamp']) == $revitimestp) |
191 | 178 | { |
192 | | - foreach($totrevs['query']['pages'] as $cxxx) |
| 179 | + $catcontent[$arraykey]['tmplsetter'] = $picture['revisions'][$key]['user']; |
| 180 | + logfile("Template by: ".$catcontent[$arraykey]['tmplsetter']); |
| 181 | + } |
| 182 | + else |
| 183 | + { |
| 184 | + logfile("set time($revitimestp) not identical with this rv, ".$revisions['timestamp']."."); |
| 185 | + //Rev's nachladen |
| 186 | + $ctxctx = file_get_contents("http://commons.wikimedia.org/w/api.php?action=query&prop=revisions&pageids=".$picture['pageid']."&rvlimit=20&rvprop=timestamp|user|comment&format=php") or suicide("api error"); |
| 187 | + $totrevs = unserialize($ctxctx); |
| 188 | + logfile("ID: ".$picture['pageid']." "); |
| 189 | + |
| 190 | + if(is_array($totrevs)) |
193 | 191 | { |
194 | | - foreach($cxxx['revisions'] as $cxxxx) |
| 192 | + foreach($totrevs['query']['pages'] as $cxxx) |
195 | 193 | { |
196 | | - if($cxxxx['timestamp'] == $revitimestp) |
| 194 | + foreach($cxxx['revisions'] as $cxxxx) |
197 | 195 | { |
198 | | - $catcontent[$arraykey]['tmplsetter'] = $cxxxx['user']; |
199 | | - logfile("Older rev, template by: ".$catcontent[$arraykey]['tmplsetter']); |
| 196 | + if($cxxxx['timestamp'] == $revitimestp) |
| 197 | + { |
| 198 | + $catcontent[$arraykey]['tmplsetter'] = $cxxxx['user']; |
| 199 | + logfile("Older rev, template by: ".$catcontent[$arraykey]['tmplsetter']); |
| 200 | + } |
200 | 201 | } |
201 | 202 | } |
202 | 203 | } |
203 | | - } |
204 | | - else |
205 | | - { |
206 | | - logfile("API: Error: not a array!"); |
207 | | - logfile($totrevs); |
208 | | - } |
209 | | - } |
| 204 | + else |
| 205 | + { |
| 206 | + logfile("API: Error: not a array!"); |
| 207 | + logfile($totrevs); |
| 208 | + } |
210 | 209 | } |
| 210 | +} |
211 | 211 | |
212 | 212 | |
213 | 213 | //Benutzer prüfen! ######################################### |
— | — | @@ -227,7 +227,6 @@ |
228 | 228 | $a_row = $cachedbar["$wgAuthor"]; |
229 | 229 | } |
230 | 230 | |
231 | | - |
232 | 231 | $setuserid = $a_row[0]; |
233 | 232 | $user_registration = $a_row[2]; |
234 | 233 | $user_editcount = $a_row[3]; |
— | — | @@ -684,9 +683,9 @@ |
685 | 684 | //Cache leeren |
686 | 685 | foreach($catcontent2 as $filename => $arraycontent) |
687 | 686 | { |
688 | | -unlink("/home/luxo/rotbot/cache/".$filename.".".$arraycontent['filetype']); |
689 | | -unlink("/home/luxo/rotbot/cache/".$filename."_2.".$arraycontent['filetype']); |
690 | | -unlink("/home/luxo/rotbot/cache/".$filename."_2.".$arraycontent['filetype']."_original"); |
| 687 | + unlink("/home/luxo/rotbot/cache/".$filename.".".$arraycontent['filetype']); |
| 688 | + unlink("/home/luxo/rotbot/cache/".$filename."_2.".$arraycontent['filetype']); |
| 689 | + unlink("/home/luxo/rotbot/cache/".$filename."_2.".$arraycontent['filetype']."_original"); |
691 | 690 | } |
692 | 691 | logfile("cache cleared. Write log now."); |
693 | 692 | |
— | — | @@ -745,7 +744,7 @@ |
746 | 745 | |
747 | 746 | if($nodelete[$arraycontent['title']] == 1) |
748 | 747 | { |
749 | | - $logfilew .= "<big style='color:red;text-decoration:blink;'>'''Warning:''' Template not found, file probably still in the category!!</big>\n"; |
| 748 | + $logfilew .= "<big style='color:red;text-decoration:blink;'>'''Warning:''' Template not found, file probably still in the category!!</big>\n"; |
750 | 749 | } |
751 | 750 | |
752 | 751 | if($arraycontent['metadata']['Make'] and $arraycontent['metadata']['DateTimeDigitized']) |
— | — | @@ -984,7 +983,7 @@ |
985 | 984 | $regMin = substr($tstime,10,2); |
986 | 985 | $regSec = substr($tstime,12,2); |
987 | 986 | |
988 | | -return mktime($regHour, $regMin, $regSec, $regMonth, $regDay, $regYear); |
| 987 | + return mktime($regHour, $regMin, $regSec, $regMonth, $regDay, $regYear); |
989 | 988 | } |
990 | 989 | |
991 | 990 | function hexToStr($hex) |
Index: trunk/tools/rotatebot/upload.php |
— | — | @@ -70,7 +70,6 @@ |
71 | 71 | |
72 | 72 | function wiki_upload_file ($filename_local,$filename_wiki,$license,$desc,$wiki,$cookies) |
73 | 73 | { |
74 | | - $file1 = "";//Löschen wegen Speicherplatz |
75 | 74 | $file1 = file_get_contents("/home/luxo/rotbot/cache/".$filename_local) or die("Fehler - Datei nicht gefunden! ($filename_local)"); |
76 | 75 | |
77 | 76 | $data_l = array("file.file" => $file1, |
— | — | @@ -145,5 +144,4 @@ |
146 | 145 | fclose($fp); |
147 | 146 | file_put_contents("/home/luxo/rotbot/cache/log.txt",$res); |
148 | 147 | return $res; |
149 | | - $data_l = array(); |
150 | 148 | } |
Index: trunk/tools/rotatebot/login.php |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | |
100 | 100 | //cookie-header erneut generieren |
101 | 101 | $cookie = ""; |
102 | | - foreach ($cookies as $key=>$value) |
| 102 | + foreach ($cookies as $value) |
103 | 103 | { |
104 | 104 | $cookie .= trim($value).";"; |
105 | 105 | } |
— | — | @@ -291,7 +291,7 @@ |
292 | 292 | $data['login']['cookieprefix']."UserName" => $data['login']['cookieprefix']."UserName=".$data['login']['lgusername'], |
293 | 293 | $data['login']['cookieprefix']."Token" => $data['login']['cookieprefix']."Token=".$data['login']['lgtoken']); |
294 | 294 | } else { |
295 | | - die("Login nicht erfolgreich! (".$data['login']['result'].")"); |
| 295 | + die("Login nicht erfolgreich! (".$data['login']['result'].")"); |
296 | 296 | } |
297 | 297 | |
298 | 298 | curl_close($ch); |