Jack Phoenix has submitted this change and it was merged.

Change subject: CHANGES - ashley this needs a sanity check please.
......................................................................


CHANGES - ashley this needs a sanity check please.

More descriptive comments, better redel support (I hope), include user ids with 
everything...

Change-Id: I7705dae5418f35b5459a4d5b2285becab0981b8f
---
M grabDeletedFiles.php
M grabDeletedText.php
M grabFiles.php
M grabImages.php
M grabInterwikiMap.php
M grabLogs.php
M grabNamespaceInfo.php
M grabNewText.php
M grabText.php
M grabUserGroups.php
M mediawikibot.class.php
11 files changed, 34 insertions(+), 22 deletions(-)

Approvals:
  Jack Phoenix: Verified; Looks good to me, approved



diff --git a/grabDeletedFiles.php b/grabDeletedFiles.php
old mode 100644
new mode 100755
index 666cd49..decc006
--- a/grabDeletedFiles.php
+++ b/grabDeletedFiles.php
@@ -10,7 +10,7 @@
  * @note Based on code by Jack Phoenix and Edward Chernenko.
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
diff --git a/grabDeletedText.php b/grabDeletedText.php
old mode 100644
new mode 100755
index c014c56..135069f
--- a/grabDeletedText.php
+++ b/grabDeletedText.php
@@ -11,7 +11,7 @@
  * @date 1 January 2013
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
diff --git a/grabFiles.php b/grabFiles.php
index 56d5921..8e98a5c 100755
--- a/grabFiles.php
+++ b/grabFiles.php
@@ -10,7 +10,7 @@
  * @note Based on code by Misza, Jack Phoenix and Edward Chernenko.
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
diff --git a/grabImages.php b/grabImages.php
old mode 100644
new mode 100755
index 8fffc21..f4c2411
--- a/grabImages.php
+++ b/grabImages.php
@@ -11,12 +11,8 @@
  * @date 20 June 2012
  */
 
-/**
- * Set the correct include path for PHP so that we can run this script from
- * $IP/extensions/ShoutWikiMaintenance and we don't need to move this file to
- * $IP/maintenance/.
- */
-# ini_set( 'include_path', dirname( __FILE__ ) . '/../../maintenance' );
+# Because we're in core/grabbers instead of core/maintenance
+ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
 
diff --git a/grabInterwikiMap.php b/grabInterwikiMap.php
index ab7aedf..434c6b2 100755
--- a/grabInterwikiMap.php
+++ b/grabInterwikiMap.php
@@ -20,7 +20,7 @@
  * - Edward Chernenko <[email protected]> (MediaWikiDumper 1.1.5, 
interwiki.pl)
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
diff --git a/grabLogs.php b/grabLogs.php
index 0c8e46c..c386a8d 100755
--- a/grabLogs.php
+++ b/grabLogs.php
@@ -13,7 +13,7 @@
  * - Edward Chernenko <[email protected]> (MediaWikiDumper 1.1.5, logs.pl)
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
@@ -71,6 +71,7 @@
                        'list' => 'logevents',
                        'lelimit' => 'max',
                        'ledir' => 'newer',
+                       'leprop' => 
'ids|title|type|user|userid|timestamp|comment|details',
                );
                if ( $carlb ) {
                        # Tone this down a bit
@@ -157,6 +158,7 @@
                }
                if ( isset( $entry['userhidden'] ) ) {
                        $entry['user'] = 'User hidden';
+                       $entry['userid'] = 0;
                        $revdeleted = $revdeleted | LogPage::DELETED_USER;
                }
 
@@ -182,7 +184,7 @@
                        'type' => $entry['type'],
                        'action' => $entry['action'],
                        'timestamp' => $ts,
-                       'user' => 0, # Unsassigned
+                       'user' => $entry['userid'],
                        'user_text' => $entry['user'],
                        'namespace' => $ns,
                        'title' => $title,
diff --git a/grabNamespaceInfo.php b/grabNamespaceInfo.php
index 4d33e91..94695b5 100755
--- a/grabNamespaceInfo.php
+++ b/grabNamespaceInfo.php
@@ -10,7 +10,7 @@
  * @date 1 January 2013
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( "Maintenance.php" );
diff --git a/grabNewText.php b/grabNewText.php
index 281c102..a6982e4 100755
--- a/grabNewText.php
+++ b/grabNewText.php
@@ -11,7 +11,7 @@
  * @date 1 January 2013
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
diff --git a/grabText.php b/grabText.php
index 3228fcd..f92af6d 100755
--- a/grabText.php
+++ b/grabText.php
@@ -11,7 +11,7 @@
  * @date 1 January 2013
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
@@ -193,7 +193,7 @@
                $localID = $pageID;
                $titleIsPresent = false;
 
-               $this->output( "Processing page $pageID: $title...\n" );
+               $this->output( "Processing page $pageID: $title\n" );
 
                # Trim and convert displayed title to database page title
                if( $ns != 0 ) {
diff --git a/grabUserGroups.php b/grabUserGroups.php
index 8879094..e9ac3b5 100755
--- a/grabUserGroups.php
+++ b/grabUserGroups.php
@@ -7,7 +7,7 @@
  * @author Kunal Mehta <[email protected]>
  */
 
-# Because we're not in maintenance
+# Because we're in core/grabbers instead of core/maintenance
 ini_set( 'include_path', dirname( __FILE__ ) . '/../maintenance' );
 
 require_once( 'Maintenance.php' );
diff --git a/mediawikibot.class.php b/mediawikibot.class.php
old mode 100644
new mode 100755
index 82b8aed..028e973
--- a/mediawikibot.class.php
+++ b/mediawikibot.class.php
@@ -106,11 +106,11 @@
 
        /** Constructor
         */
-       public function __construct( 
+       public function __construct(
                $url = 'http://example.com/w/api.php',
                $format = 'php',
-               $username = 'bot', 
-               $password = 'passwd', 
+               $username = 'bot',
+               $password = 'passwd',
                $useragent = 'WikimediaBot Framework by JKH',
                $cookies = 'cookies.tmp'
        ) {
@@ -122,7 +122,7 @@
                define( 'PASSWORD', $password );
                define( 'USERAGENT', $useragent );
                define( 'COOKIES', $cookies );
-               
+
        }
 
        /** Dynamic method server
@@ -204,6 +204,20 @@
                $url = $this->api_url( $method );
                # get the data
                $data = $this->curl_post( $url, $params, $multipart );
+               # check data for grabbers; shut up loops are confusing it's too 
early.
+               if ( !isset( $data[$method] ) ) {
+                       echo "API error: no results; retrying in 5s\n";
+                       sleep( 5 );
+                       $data = $this->curl_post( $url, $params, $multipart );
+                       if ( !isset( $data[$method] ) ) {
+                               echo "API error: no results; retrying in 30s\n";
+                               sleep( 30 );
+                               $data = $this->curl_post( $url, $params, 
$multipart );
+                               if ( !isset( $data[$method] ) ) {
+                                       echo "API error: no results found.\n";
+                               }
+                       }
+               }
                # set smwinfo
                $this->$method = $data;
                # return the data
@@ -290,7 +304,7 @@
         */
        private function urlize_params( $params ) {
                # url-ify the data for POST
-               $urlstring = '';                
+               $urlstring = '';
                foreach ( $params as $key => $value ) {
                        $urlstring .= $key . '=' . $value . '&';
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7705dae5418f35b5459a4d5b2285becab0981b8f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/grabbers
Gerrit-Branch: master
Gerrit-Owner: Isarra <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>

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

Reply via email to