https://bugzilla.wikimedia.org/show_bug.cgi?id=59384

--- Comment #12 from Bugzilla Bug Importer (valhallasw) 
<wmf.bugconver...@gmail.com> ---
-------------------------------------------------------------------------------
From: Hoo man <h...@online.de>
Date: Fri, 01 Apr 2011 11:45:03
-------------------------------------------------------------------------------

A few more days and it would been finished...

Code (wrote it in php cause I was to lazy for bash ![][1], but that doesn't
matter):

    #!/usr/bin/php -q
    <?php
    $current = '201103';
    $month =  '05';
    $year = '2007';
    $log_file = '/mnt/user-store/hoo/dbq-129.log.txt';
    $save_file_pre = '/mnt/user-store/hoo/dbq/dbq-129-';
    $db = 'enwiki_p';
    $server = '10.24.1.33';
    while(true) {
            $month++;
            if($month > 12) {
                    $month = '01';
                    $year++;
            }
            if(strlen($month) == 1) {
                    $month = '0' . $month;
            }
            if($current < $year . $month) {
                    break;
            }
            while(true) {
                    $query = "SELECT /* SLOW_OK */ rev_user, COUNT(*) as edits,
LEFT(rev_timestamp, 6) as month FROM revision WHERE rev_timestamp LIKE '" .
$year . $month . "%' AND rev_user != 0 GROUP BY rev_user;";
                    $file = $save_file_pre . $year . '-' . $month . '.txt';
                    exec('mysql --host=' . $server . ' --database=' . $db . '
-e"' . $query . '" | cat > ' . $file);
                    if(filesize($file) != 0) {
                            break;
                    }
            }
    }
    ?>


Result:  
http://toolserver.org/~hoo/dbq/dbq-129/ (dir with the per month files)  
http://toolserver.org/~hoo/dbq/dbq-129/full.txt (everything in one file (plain
text ~125MB), I haven't tested it, but I hope it's going to import fine ![][2]
)

   [1]: https://jira.toolserver.org/images/icons/emoticons/tongue.gif
   [2]: https://jira.toolserver.org/images/icons/emoticons/wink.gif

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to