https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106321

Revision: 106321
Author:   reedy
Date:     2011-12-15 14:10:26 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
Few other minor bits of cleanup

Modified Paths:
--------------
    trunk/tools/rotatebot/login.php
    trunk/tools/rotatebot/rotbot.php
    trunk/tools/rotatebot/upload.php

Modified: trunk/tools/rotatebot/login.php
===================================================================
--- trunk/tools/rotatebot/login.php     2011-12-15 14:02:10 UTC (rev 106320)
+++ trunk/tools/rotatebot/login.php     2011-12-15 14:10:26 UTC (rev 106321)
@@ -98,7 +98,7 @@
 
        //cookie-header erneut generieren
        $cookie = "";
-       foreach ($cookies as $key=>$value)
+       foreach ($cookies as $value)
        {
                $cookie .= trim($value).";";
        }
@@ -291,7 +291,7 @@
                                         
$data['login']['cookieprefix']."UserName" => 
$data['login']['cookieprefix']."UserName=".$data['login']['lgusername'],
                                         $data['login']['cookieprefix']."Token" 
=> $data['login']['cookieprefix']."Token=".$data['login']['lgtoken']);
        } else {
-       die("Login nicht erfolgreich! (".$data['login']['result'].")");
+               die("Login nicht erfolgreich! (".$data['login']['result'].")");
        }
 
        curl_close($ch);

Modified: trunk/tools/rotatebot/rotbot.php
===================================================================
--- trunk/tools/rotatebot/rotbot.php    2011-12-15 14:02:10 UTC (rev 106320)
+++ trunk/tools/rotatebot/rotbot.php    2011-12-15 14:10:26 UTC (rev 106321)
@@ -101,7 +101,7 @@
 */
 
 //noch restliche daten nachladen von api.php
-
+$urlpageids = '';
 foreach($contentarray['pages'] as $picture)
 {
        $urlpageids .= "|".$picture['pageid'];
@@ -173,40 +173,40 @@
 
 foreach($picture['revisions'] as $key => $revisions)
 {
-  if(trim($revisions['timestamp']) == $revitimestp)
-  {
-       $catcontent[$arraykey]['tmplsetter'] = 
$picture['revisions'][$key]['user'];
-       logfile("Template by: ".$catcontent[$arraykey]['tmplsetter']);
-  }
-  else
-  {
-       logfile("set time($revitimestp) not identical with this rv, 
".$revisions['timestamp'].".");
-       //Rev's nachladen
-       $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");
-       $totrevs = unserialize($ctxctx);
-       logfile("ID: ".$picture['pageid']." ");
-
-       if(is_array($totrevs))
+       if(trim($revisions['timestamp']) == $revitimestp)
        {
-               foreach($totrevs['query']['pages'] as $cxxx)
+               $catcontent[$arraykey]['tmplsetter'] = 
$picture['revisions'][$key]['user'];
+               logfile("Template by: ".$catcontent[$arraykey]['tmplsetter']);
+       }
+       else
+       {
+               logfile("set time($revitimestp) not identical with this rv, 
".$revisions['timestamp'].".");
+               //Rev's nachladen
+               $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");
+               $totrevs = unserialize($ctxctx);
+               logfile("ID: ".$picture['pageid']." ");
+
+               if(is_array($totrevs))
                {
-                       foreach($cxxx['revisions'] as $cxxxx)
+                       foreach($totrevs['query']['pages'] as $cxxx)
                        {
-                               if($cxxxx['timestamp'] == $revitimestp)
+                               foreach($cxxx['revisions'] as $cxxxx)
                                {
-                                       $catcontent[$arraykey]['tmplsetter'] = 
$cxxxx['user'];
-                                       logfile("Older rev, template by: 
".$catcontent[$arraykey]['tmplsetter']);
+                                       if($cxxxx['timestamp'] == $revitimestp)
+                                       {
+                                               
$catcontent[$arraykey]['tmplsetter'] = $cxxxx['user'];
+                                               logfile("Older rev, template 
by: ".$catcontent[$arraykey]['tmplsetter']);
+                                       }
                                }
                        }
                }
-       }
-       else
-       {
-         logfile("API: Error: not a array!");
-         logfile($totrevs);
-       }
-  }
+               else
+               {
+                 logfile("API: Error: not a array!");
+                 logfile($totrevs);
+               }
 }
+}
 
 
 //Benutzer prüfen! #########################################
@@ -227,7 +227,6 @@
                $a_row = $cachedbar["$wgAuthor"];
        }
 
-
        $setuserid = $a_row[0];
        $user_registration = $a_row[2];
        $user_editcount = $a_row[3];
@@ -684,9 +683,9 @@
 //Cache leeren
 foreach($catcontent2 as $filename => $arraycontent)
 {
-unlink("/home/luxo/rotbot/cache/".$filename.".".$arraycontent['filetype']);
-unlink("/home/luxo/rotbot/cache/".$filename."_2.".$arraycontent['filetype']);
-unlink("/home/luxo/rotbot/cache/".$filename."_2.".$arraycontent['filetype']."_original");
+       
unlink("/home/luxo/rotbot/cache/".$filename.".".$arraycontent['filetype']);
+       
unlink("/home/luxo/rotbot/cache/".$filename."_2.".$arraycontent['filetype']);
+       
unlink("/home/luxo/rotbot/cache/".$filename."_2.".$arraycontent['filetype']."_original");
 }
 logfile("cache cleared. Write log now.");
 
@@ -745,7 +744,7 @@
 
        if($nodelete[$arraycontent['title']] == 1)
        {
-       $logfilew .= "<big 
style='color:red;text-decoration:blink;'>'''Warning:''' Template not found, 
file probably still in the category!!</big>\n";
+               $logfilew .= "<big 
style='color:red;text-decoration:blink;'>'''Warning:''' Template not found, 
file probably still in the category!!</big>\n";
        }
 
        if($arraycontent['metadata']['Make'] and 
$arraycontent['metadata']['DateTimeDigitized'])
@@ -984,7 +983,7 @@
        $regMin = substr($tstime,10,2);
        $regSec = substr($tstime,12,2);
 
-return mktime($regHour, $regMin, $regSec, $regMonth, $regDay, $regYear);
+       return mktime($regHour, $regMin, $regSec, $regMonth, $regDay, $regYear);
 }
 
 function hexToStr($hex)

Modified: trunk/tools/rotatebot/upload.php
===================================================================
--- trunk/tools/rotatebot/upload.php    2011-12-15 14:02:10 UTC (rev 106320)
+++ trunk/tools/rotatebot/upload.php    2011-12-15 14:10:26 UTC (rev 106321)
@@ -70,7 +70,6 @@
 
 function wiki_upload_file 
($filename_local,$filename_wiki,$license,$desc,$wiki,$cookies)
 {
-       $file1 = "";//Löschen wegen Speicherplatz
        $file1 = file_get_contents("/home/luxo/rotbot/cache/".$filename_local) 
or die("Fehler - Datei nicht gefunden! ($filename_local)");
 
        $data_l = array("file.file" => $file1,
@@ -145,5 +144,4 @@
        fclose($fp);
        file_put_contents("/home/luxo/rotbot/cache/log.txt",$res);
        return $res;
-       $data_l = array();
 }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to