Matanya has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/275886

Change subject: adding delete.php tool
......................................................................

adding delete.php tool

Change-Id: I099329a6f808d8ec956f04bc995cbabc8a4ce705
---
M hat-web-tool/delete.php
1 file changed, 34 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/stewardbots 
refs/changes/86/275886/1

diff --git a/hat-web-tool/delete.php b/hat-web-tool/delete.php
index 301ebf9..13f276e 100644
--- a/hat-web-tool/delete.php
+++ b/hat-web-tool/delete.php
@@ -1,15 +1,15 @@
 <html>
 <head><title>Delete</title></head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
 <style type="text/css">@import "blue/style.css";</style>
-<script type="text/javascript" src="jquery-latest.js"></script>
-<script type="text/javascript" src="jquery.tablesorter.js"></script>
+<script type="text/javascript" src="jquery-latest.js"></script> 
+<script type="text/javascript" src="jquery.tablesorter.js"></script> 
 <script type="text/javascript">
-$(document).ready(function()
-    {
-        $("#projects").tablesorter();
-    }
-);
+$(document).ready(function() 
+    { 
+        $("#projects").tablesorter(); 
+    } 
+); 
 </script>
 <?php
 
@@ -20,16 +20,16 @@
 function get_post($var) { return mysql_real_escape_string($_POST[$var]); }
 
        require_once 'login.php';
-
+       
        $db_server = mysql_connect("metawiki.labsdb", $db_username, 
$db_password);
        if (!$db_server) die ("Unable to connect to MySQL: " . mysql_error());
-
+       
        mysql_select_db("meta_p", $db_server) or die ("Unable to select 
database: " . mysql_error());
        $admins = 0;
-
+       
        if (isset($_POST['number'])) {
                $admins = get_post('number');
-       }
+       }       
        if ($admins > 10) {
                        $admins=10;
        }
@@ -53,45 +53,45 @@
 
        $query = "SELECT dbname,REPLACE(url, 'http://', 'https://') AS domain, 
slice FROM wiki WHERE url IS NOT NULL AND is_closed=0;";
        $result = mysql_query($query);
-
+       
        if (!$result) die ("Database access failed: " . mysql_error());
-
+       
        $rows = mysql_num_rows($result);
 
        for ($j = 0; $j < $rows; ++$j)
        {
                $row = mysql_fetch_row($result);
-
+               
                $db_server_temp = mysql_connect($row[2], $db_username, 
$db_password);
                if (!$db_server_temp) die ("Unable to connect to MySQL: " . 
mysql_error());
-
+       
                mysql_select_db($row[0]."_p", $db_server_temp) or die ("Unable 
to select database: " . mysql_error());
 
                $query2 = "SELECT sum(if(ug_group = 'sysop', 1, 0)) FROM 
user_groups;";
                $result2 = mysql_query($query2);
-
+       
                if (!$result2) die ("Database access failed: " . mysql_error());
-
+               
                $row2 = mysql_fetch_row($result2);
-
+               
                $numAdmins = ($row2[0]?$row2[0]:0);
-
+               
                if ($numAdmins <= $admins) {
-
+               
                        $queryL = "SELECT user_name, log_timestamp FROM logging 
JOIN user ON user_id = log_user JOIN user_groups ON ug_user = user_id WHERE 
log_type IN ('delete', 'block', 'protect') AND ug_group = 'sysop' ORDER BY 
log_timestamp DESC LIMIT 1;";
                        $resultL = mysql_query($queryL);
-
+       
                        if (!$resultL) die ("Database access failed: " . 
mysql_error());
-
+               
                        $rowL = mysql_fetch_row($resultL);
-
+               
                        $query3 = "SELECT pl_title FROM pagelinks LEFT JOIN 
page ON page_id = pl_from WHERE page_title = 'Delete' AND page_namespace = 10 
AND page_is_redirect = 1 LIMIT 1;";
                        $result3 = mysql_query($query3);
-
+       
                        if (!$result3) die ("Database access failed: " . 
mysql_error());
-
+               
                        $template = "Delete";
-
+               
                        if (!$result3) {
                             $template = "Delete";
                        } elseif (mysql_num_rows($result3) == 1) {
@@ -99,14 +99,14 @@
                        } else {
                  $template = "Delete";
                }
-
+        
                $query4 = "SELECT page_title, rev_timestamp, rev_user_text, 
rev_comment, rev_id FROM page LEFT JOIN templatelinks ON tl_from = page_id LEFT 
JOIN revision ON rev_page = page_id WHERE tl_title = '" . $template . "' AND 
tl_namespace=10 AND rev_timestamp = (SELECT max(rev_timestamp) FROM revision AS 
r WHERE rev_page = page_id)";
                        $result4 = mysql_query($query4);
-
+       
                        if (!$result4) die ("Database access failed: " . 
mysql_error());
-
+               
                        $rows4 = mysql_num_rows($result4);
-
+               
                        for ($k = 0; $k < $rows4; ++$k)
                        {
                                $rowD = mysql_fetch_row($result4);
@@ -125,6 +125,8 @@
 </tbody>
 </table>
 <br />
-<p>This tool was originally written by <a 
href="https://meta.wikimedia.org/wiki/User:Rschen7754";>Rschen7754</a>. 
Acknowledgements to <a href="http://tools.wmflabs.org/erwin85/";>erwin85</a> for 
the original tool and many of the queries, and to <a 
href="http://tools.wmflabs.org/pathoschild-contrib/";>Pathoschild</a> for 
creating the extensive suite of tools that were used as an example. Mantained 
by the stewardbots project.</p>
+<p>Acknowledgements to <a href="http://tools.wmflabs.org/erwin85/";>erwin85</a> 
for the 
+original tool and many of the queries, and to <a 
href="http://tools.wmflabs.org/pathoschild-contrib/";>Pathoschild</a> 
+for creating the extensive suite of tools that I used as an example.</p>
 </body>
 </html>
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/275886
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I099329a6f808d8ec956f04bc995cbabc8a4ce705
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/stewardbots
Gerrit-Branch: master
Gerrit-Owner: Matanya <mata...@foss.co.il>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to