r106329 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106328‎ | r106329 | r106330 >
Date:14:42, 15 December 2011
Author:reedy
Status:ok
Tags:
Comment:
Push more things into the settings file
Modified paths:
  • /trunk/tools/rotatebot/login.php (modified) (history)
  • /trunk/tools/rotatebot/rotbot.php (modified) (history)
  • /trunk/tools/rotatebot/settings.php (modified) (history)
  • /trunk/tools/rotatebot/upload.php (modified) (history)

Diff [purge]

Index: trunk/tools/rotatebot/rotbot.php
@@ -15,8 +15,7 @@
1616 along with this program. If not, see <http://www.gnu.org/licenses/>.
1717 */
1818
19 -$homedir = "/home/luxo/rotbot/";
20 -$exiftool = "/home/luxor/rotbot/exiftool/exiftool";
 19+include("settings.php");
2120 $myLockfile = $homedir."rotatebotlock";
2221
2322 ini_set('memory_limit', '100M'); //Speicher auf 100 MBytes hochsetzen
@@ -54,7 +53,7 @@
5554
5655
5756 logfile("Verbinde zur Datenbank!");
58 -include("settings.php");
 57+
5958 $myslink = mysql_connect($databanknames, $userloginname, $databasepw) or suicide ("Can't connect to MySQL");
6059 $database = "commonswiki_p";
6160 mysql_select_db($database, $myslink)
Index: trunk/tools/rotatebot/settings.php
@@ -1,7 +1,12 @@
22 <?php
33
4 -$databanknames = "";
 4+$homedir = "/home/luxo/rotbot/";
 5+$cookies = "/home/lux/cks";
 6+$exiftool = "/home/luxor/rotbot/exiftool/exiftool";
 7+$useragent = "Luxo (Toolserver; php) luxo@ts.wikimedia.org";
58
6 -$userloginname = "";
7 -$databasepw = "";
 9+$databanknames = ""; // server
810
 11+$userloginname = ""; // database username
 12+$databasepw = ""; // database password
 13+
Index: trunk/tools/rotatebot/upload.php
@@ -18,14 +18,12 @@
1919
2020 wikiupload("commons.wikimedia.org","test2.jpg","Test for Rotatebot.jpg","",$descri);*/
2121
22 -$homedir = "/home/luxo/rotbot/";
 22+include("settings.php");
2323
2424 // ############### EDIT WIKIPEDIA - FUNCTION ###############
2525 function wikiupload($project,$filename_local,$filename_wiki,$license,$desc)
2626 {
27 - global $cookies;
28 - $username = "Rotatebot";
29 - $password = "**removed**";
 27+ global $cookies, $useragent;
3028
3129 logfile("Lade Bild '$filename_wiki' hoch am ".date("r",time()).".");
3230
@@ -34,7 +32,7 @@
3533 {
3634 $username = "Rotatebot";
3735 $password = "**removed**";
38 - $useragent = "Luxo (toolserver; php) luxo@ts.wikimedia.org";
 36+
3937 logfile("Login to $project!\n");
4038 wikilogin($username,$password,$project,$useragent);
4139 logfile("logged in to $project!\n");
@@ -90,8 +88,8 @@
9189
9290 function wiki_PostToHostFD ($host, $path, $data_l, $wiki, $cookies) //this function was developed by [[:de:User:APPER]] (Christian Thiele)
9391 {
 92+ global $useragent;
9493 logfile("verbinde zu $host ...");
95 - $useragent = "Luxobot/1.1 (toolserver; php) luxo@ts.wikimedia.org";
9694 $dc = 0;
9795 $bo="-----------------------------305242850528394";
9896 $filename=$data_l['wpDestFile'];
Index: trunk/tools/rotatebot/login.php
@@ -18,17 +18,15 @@
1919
2020 */
2121
22 -$cookies = "/home/lux/cks";
 22+include("settings.php");
2323
2424 // ############### EDIT WIKIPEDIA - FUNCTION ###############
2525 function wikiedit($project,$page,$newtext,$description,$minor)
2626 {
27 - global $cookies;
 27+ global $cookies, $useragent;
2828 logfile("Funktion gestartet...");
2929 logfile("Schreibe Text am ".date("r",time())." in die Seite '$page'.");
3030
31 - $useragent = "Luxo (toolserver; php) luxo@ts.wikimedia.org";
32 -
3331 //$cookies
3432 if(!$cookies["commonswikiUserName"] || !$cookies["commonswikiUserID"])
3533 {
@@ -251,8 +249,8 @@
252250
253251 $postlogin = "lgname=".urlencode($username)."&lgpassword=".urlencode($password)."&format=php";
254252
255 - global $cookies;
256 - if(!$useragent) { $useragent = "Luxo (Toolserver; php) luxo@ts.wikimedia.org"; }
 253+ global $cookies, $useragent;
 254+
257255 $ch = curl_init($project.$getrequest);
258256 curl_setopt($ch, CURLOPT_POST, TRUE);
259257 curl_setopt($ch, CURLOPT_POSTFIELDS, $postlogin);

Status & tagging log