×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    MediaWiki/reverse engineering: Difference between revisions

    Content added Content deleted
    imported>mutante
    mNo edit summary
    imported>mutante
    Line 36: Line 36:
    ==== get old_id of matching page ====
    ==== get old_id of matching page ====


    select old_id from text where old_text LIKE "%finn%" limit 5;


    select old_id from text where old_text LIKE "%vollmilch%" limit 1;
    we get a list like

    +--------+
    +--------+
    | old_id |
    | old_id |
    +--------+
    +--------+
    | 19561 |
    | 32778 |
    | 12621 |
    | 12622 |
    | 12682 |
    | 12683 |
    +--------+
    +--------+


    Now we would have to check for all of them


    ==== get rev_id's from old_id's ====
    ==== get rev_id from old_id ====


    select rev_id from revision where rev_text_id IN (19561,12621,12622,12682,12683);
    select rev_id from revision where rev_text_id=32778;


    +--------+
    +--------+
    | rev_id |
    | rev_id |
    +--------+
    +--------+
    | 12621 |
    | 32816 |
    | 12622 |
    | 12682 |
    | 12683 |
    | 19561 |
    +--------+
    +--------+




    ==== result / page_title ====
    arrr, still i dont get this somehow..

    select page_title from page where page_latest=32816;

    +------------+
    | page_title |
    +------------+
    | Sandbox |
    +------------+

    Revision as of 23:05, 5 January 2006

    Ok, enough of trying to find the right queries after the upgrade to 1.5 mediawiki.

    Lets just log the sql queries from the server.

    A page being requested

    get page_id

    SELECT page_id FROM `page` WHERE page_namespace = '0' AND page_title = 'Ogg' LIMIT 1;

    get page_latest

    SELECT page_id,page_namespace,page_title,page_restrictions,page_counter,page_is_redirect,page_is_new,page_random,page_touched,page_latest,page_len FROM `page` WHERE page_id = '17369' LIMIT 1;

    after having page_latest (32808) ,which is = rev_id in revision we can:

    get revision_text_id

    SELECT rev_text_id from revision where rev_id=32808;

    after having rev_text_id (32770), which is = old_id, we can finally:

    get the actual content

    SELECT old_text,old_flags FROM `text` WHERE old_id = '32770';


    brion: mutante: old_id=rev_text_id
    brion: rev_id=page_latest
    

    Searching for content

    To seach for content in pages and return page titles that much, we have to revert the process:

    get old_id of matching page

    select old_id from text where old_text LIKE "%vollmilch%" limit 1;

    +--------+ | old_id | +--------+ | 32778 | +--------+


    get rev_id from old_id

    select rev_id from revision where rev_text_id=32778;

    +--------+ | rev_id | +--------+ | 32816 | +--------+


    result / page_title

    select page_title from page where page_latest=32816;

    +------------+ | page_title | +------------+ | Sandbox | +------------+

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.