It is currently Fri Sep 03, 2010 12:49
  • View your posts
  • FAQ
  • Register
  • Login

  • All times are UTC + 1 hour [ DST ]



    Post new topic Reply to topic  [ 38 posts ]  Go to page 1, 2, 3, 4  Next
    Author Message
     Post subject: Small Script to export ALL killmails:
    PostPosted: Fri Dec 14, 2007 12:15 
    Offline
     E-mail  WWW  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 896
    Location: Germany
    Cause many ppl asked:

    (hope no typos or syntax erros cause im writing in from memory at work^^)
    [code]
    require_once("common/includes/class.kill.php");

    define(EXPORT_DIR, "cache/export/");

    //Id of you last Killmail.
    define(MAX_KILL_ID, 870000);

    for ($id = 1, $id < MAX_KILL_ID, $id++){
    if ($kill = new Kill($id))
    {
    $file = EXPORT_DIR . $kill . ".txt";
    $fp = fopen($file,w);
    $fwrite($fp,$kill->getRawMail());
    $fclose(fp);
    }
    }
    [/code]
    (ignore the ; after the < its from the forum...)


    Top
     
     Post subject:
    PostPosted: Sat Dec 15, 2007 04:05 
    Offline
     E-mail  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 80
    Here is a working version for 1.2
    Ensure that max_execution_time=900 is set in your php.ini file for run time at least temporarily.

    I ran into a few errors that helped develop this code. If you have any problems, let me know and I can try to help.


    [code]


    require_once('common/db.php');
    require_once('common/class.killboard.php');
    require_once("common/class.kill.php");



    $killboard = new Killboard(KB_SITE);

    $config = $killboard->getConfig();

    define(EXPORT_DIR, "cache/export/");

    //Id of your last Killmail.
    define(MAX_KILL_ID, 9372);

    for ($id = 1; $id < MAX_KILL_ID; $id++){

    $qry = new DBQuery();

    $sql = "SELECT * FROM kb3_kills where kll_id=".$id;

    $qry->execute($sql);
    $row = $qry->getRow();

    if ($row['kll_id'] != $id || $row['kll_fb_plt_id'] == NULL) {

    echo "Kill ID ".$id." does not exist.<br>";

    } else {

    if ($kill = new Kill($id))
    {
    $file = EXPORT_DIR . $id . ".txt";
    $killmail = $kill->getRawMail();
    //echo "<table border=1><tr><Td>$killmail</td></tr></table><br>";


    if ($killmail != NULL) {
    echo "Killmail ".$id." Exported to ".$file.".<br>";
    $fp = fopen($file,w);
    fwrite($fp,$killmail);
    fclose($fp);
    } else {
    echo "Killmail ".$id." Failed to Export!!<br>";
    }


    }
    }
    }
    echo "Export Script Completed Run<br>";

    [/code]


    Top
     
     Post subject:
    PostPosted: Sat Dec 15, 2007 11:01 
    Offline
     E-mail  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 44
    [quote1197709197=ralle030583]
    Cause many ppl asked:

    (hope no typos or syntax erros cause im writing in from memory at work^^)
    [code]
    require_once("common/includes/class.kill.php");

    define(EXPORT_DIR, "/cache/export/");

    //Id of you last Killmail.
    define(MAX_KILL_ID, 870000);

    for ($id = 1, $id < MAX_KILL_ID, $id++){
    if ($kill = new Kill($id))
    {
    $file = EXPORT_DIR . $kill . ".txt";
    $fp = fopen($file,w);
    $fwrite($fp,$kill->getRawMail());
    $fclose(fp);
    }
    }
    [/code]
    (ignore the ; after the < its from the forum...)
    [/quote1197709197]
    Where about is this meant to go? And I guess there should be no / at start of export_dir (cache/export/, not /cache/export/)?


    Top
     
     Post subject:
    PostPosted: Sat Dec 15, 2007 11:07 
    Offline
     E-mail  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 162
    i too am confused how is this diffrent from the Kill Export - files feature in admin?


    Top
     
     Post subject:
    PostPosted: Sat Dec 15, 2007 20:30 
    Offline
     E-mail  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 80
    This should be its own file in root.. Sorry I should have stated that.

    eg fullexport.php

    the only thing you need to add is <?php and ?> to the file at the beginning and end.

    Then just point your browser to the file and voila.



    Top
     
     Post subject:
    PostPosted: Sun Dec 16, 2007 03:26 
    Offline
     E-mail  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 44
    Was refering to the first script, but thx for the reply.

    The first one even lacks a link to the DB include, so there's no way it works as is and/or just in it's own file :\


    Top
     
     Post subject:
    PostPosted: Sun Dec 16, 2007 08:09 
    Offline
     E-mail  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 80
    Yeah, the first one doesn't work. So I modified it to work. 8)


    Top
     
     Post subject:
    PostPosted: Thu Dec 27, 2007 01:56 
    Offline
     E-mail  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 9
    nm


    Top
     
     Post subject:
    PostPosted: Thu Dec 27, 2007 10:29 
    Offline
     E-mail  WWW  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 896
    Location: Germany
    as i stated before in firs post:
    [quote]
    (hope no typos or syntax erros cause im writing in from memory at work^^)
    [/quote]

    the difference is that this export dont seperate killmails on owner, dont use killlist's
    and cause of this it exports really all kills in DB and is a bit faster.

    thats also the reason why it havent any checks if kills exsists and so it,
    it ignores all and go straight through the killmails.
    so you will have some empty txt files, but it doesnt make probs during afterwards cause
    it will be ignored


    Top
     
     Post subject:
    PostPosted: Sat Dec 29, 2007 18:33 
    Offline
     E-mail  WWW  YIM  Profile

    Joined: Sat Jun 14, 2008 20:24
    Posts: 131
    Can someone help me with a copy of this script that works with 1.3 and also 1.4? Because I need a total dump of our old board plus a redump of the new one so I can re import everything to a fresh clean DB.

    Thanks,
    Blue Sassley

    _________________
    Image


    Top
     
    Display posts from previous:  Sort by  
    Post new topic Reply to topic  [ 38 posts ]  Go to page 1, 2, 3, 4  Next

    All times are UTC + 1 hour [ DST ]


    Who is online

    Users browsing this forum: underwoodr and 1 guest


    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum

    Search for:
    Jump to:  
    Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group  
    Style Designed By phpBBegypt