Zum Inhalt springen

Wikipedia:WikiProjekt SVG/Stand/bot.php

aus Wikipedia, der freien Enzyklopädie

<syntaxhighlight lang="PHP"> <?php

 header("Content-Type: text/plain;");
 include("fnc.php");
 
 login("PmegBot", "");
 print("logged in \n");
 $category = list_category("Kategorie:In_SVG_konvertieren");
 print("got list\n");
 $x = 0;
 foreach($category as $file) {
   $usage = check_usage($file);
   
  
   $data[] = array("filename" => $file,
                 "totalusage" => count($usage),
                 "usage" => implode(", ", $usage));
   $x++;
   print($file." is used ".count($usage)." times \n");
   usleep(100000);
 }
 
 $tt .= "{| class='wikitable sortable' width='600'

|-class='hintergrundfarbe5' !Dateiname !! Benutzung\n";

 foreach($data as $row) {
   $tt .= "|-

| [[:".$row['filename']."]] || ".$row['totalusage']."\n";

 }$tt .= "\n|}";
 
 $ff = fopen("test.txt", "w+");
 fwrite($ff, $tt);
 fclose($ff);

?>

</syntaxhighlight>