https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106329
Revision: 106329
Author: reedy
Date: 2011-12-15 14:42:05 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
Push more things into the settings file
Modified Paths:
--------------
trunk/tools/rotatebot/login.php
trunk/tools/rotatebot/rotbot.php
trunk/tools/rotatebot/settings.php
trunk/tools/rotatebot/upload.php
Modified: trunk/tools/rotatebot/login.php
===================================================================
--- trunk/tools/rotatebot/login.php 2011-12-15 14:34:15 UTC (rev 106328)
+++ trunk/tools/rotatebot/login.php 2011-12-15 14:42:05 UTC (rev 106329)
@@ -18,17 +18,15 @@
*/
-$cookies = "/home/lux/cks";
+include("settings.php");
// ############### EDIT WIKIPEDIA - FUNCTION ###############
function wikiedit($project,$page,$newtext,$description,$minor)
{
- global $cookies;
+ global $cookies, $useragent;
logfile("Funktion gestartet...");
logfile("Schreibe Text am ".date("r",time())." in die Seite '$page'.");
- $useragent = "Luxo (toolserver; php) [email protected]";
-
//$cookies
if(!$cookies["commonswikiUserName"] || !$cookies["commonswikiUserID"])
{
@@ -251,8 +249,8 @@
$postlogin =
"lgname=".urlencode($username)."&lgpassword=".urlencode($password)."&format=php";
- global $cookies;
- if(!$useragent) { $useragent = "Luxo (Toolserver; php)
[email protected]"; }
+ global $cookies, $useragent;
+
$ch = curl_init($project.$getrequest);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postlogin);
Modified: trunk/tools/rotatebot/rotbot.php
===================================================================
--- trunk/tools/rotatebot/rotbot.php 2011-12-15 14:34:15 UTC (rev 106328)
+++ trunk/tools/rotatebot/rotbot.php 2011-12-15 14:42:05 UTC (rev 106329)
@@ -15,8 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-$homedir = "/home/luxo/rotbot/";
-$exiftool = "/home/luxor/rotbot/exiftool/exiftool";
+include("settings.php");
$myLockfile = $homedir."rotatebotlock";
ini_set('memory_limit', '100M'); //Speicher auf 100 MBytes hochsetzen
@@ -54,7 +53,7 @@
logfile("Verbinde zur Datenbank!");
-include("settings.php");
+
$myslink = mysql_connect($databanknames, $userloginname, $databasepw) or
suicide ("Can't connect to MySQL");
$database = "commonswiki_p";
mysql_select_db($database, $myslink)
Modified: trunk/tools/rotatebot/settings.php
===================================================================
--- trunk/tools/rotatebot/settings.php 2011-12-15 14:34:15 UTC (rev 106328)
+++ trunk/tools/rotatebot/settings.php 2011-12-15 14:42:05 UTC (rev 106329)
@@ -1,7 +1,12 @@
<?php
-$databanknames = "";
+$homedir = "/home/luxo/rotbot/";
+$cookies = "/home/lux/cks";
+$exiftool = "/home/luxor/rotbot/exiftool/exiftool";
+$useragent = "Luxo (Toolserver; php) [email protected]";
-$userloginname = "";
-$databasepw = "";
+$databanknames = ""; // server
+$userloginname = ""; // database username
+$databasepw = ""; // database password
+
Modified: trunk/tools/rotatebot/upload.php
===================================================================
--- trunk/tools/rotatebot/upload.php 2011-12-15 14:34:15 UTC (rev 106328)
+++ trunk/tools/rotatebot/upload.php 2011-12-15 14:42:05 UTC (rev 106329)
@@ -18,14 +18,12 @@
wikiupload("commons.wikimedia.org","test2.jpg","Test for
Rotatebot.jpg","",$descri);*/
-$homedir = "/home/luxo/rotbot/";
+include("settings.php");
// ############### EDIT WIKIPEDIA - FUNCTION ###############
function wikiupload($project,$filename_local,$filename_wiki,$license,$desc)
{
- global $cookies;
- $username = "Rotatebot";
- $password = "**removed**";
+ global $cookies, $useragent;
logfile("Lade Bild '$filename_wiki' hoch am ".date("r",time()).".");
@@ -34,7 +32,7 @@
{
$username = "Rotatebot";
$password = "**removed**";
- $useragent = "Luxo (toolserver; php) [email protected]";
+
logfile("Login to $project!\n");
wikilogin($username,$password,$project,$useragent);
logfile("logged in to $project!\n");
@@ -90,8 +88,8 @@
function wiki_PostToHostFD ($host, $path, $data_l, $wiki, $cookies) //this
function was developed by [[:de:User:APPER]] (Christian Thiele)
{
+ global $useragent;
logfile("verbinde zu $host ...");
- $useragent = "Luxobot/1.1 (toolserver; php) [email protected]";
$dc = 0;
$bo="-----------------------------305242850528394";
$filename=$data_l['wpDestFile'];
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs