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



    s23
    3,186Articles

    How to search ((Mediawiki)) wiki pages from IRC (current).[edit]

    --> see TclScripts/Mediawiki

    OBSOLETE[edit]

    Go to Efnet #wiki and use the triggers:

    .title <string>

    To search the titles of Wiki pages.

    Example: .title Debian

    .content <string>

    To search the full text content of Wiki pages.

    Example: .content Sex

    Additional triggers include (.stats (statistics) .sysops (sysop emails) and .rc (show last 5 changes).


    will be extended with source code of scripts etc..

    How to search (UseMod) wiki pages from IRC (outdated & the ugly way)[edit]

    ---

    Using

    set data10 [exec bash -c "/home/kallisti/egg/scripts/wiki.sh $text"];
    

    is a security risk, as everyone can run commands on your box. Don't do that. The code below is untested, but it should protect from exploits. -- thanks for your input, updated that.

    
    bind pub - !wiki wikisearch
    
    proc wikisearch {nick host hand chan text} {
      set quotedtext [string map {\' \'\\\'\'} $text];
      set data [exec bash -c "/home/kallisti/egg/scripts/wiki.sh '$quotedtext'"];
      regsub -all {
    } $data {} output;
      putlog "$output";   
    putserv "PRIVMSG $chan :$output";
    
    }
    
    


    ---


    Yup,(almost) all it does is execute a shell script (wiki.sh), thats the ugly part about it ,because one could also do the whole job inside the .tcl (please add here if you like)

    • add the wiki.sh

    ---

    #/bin/bash
    tempfile="wikisearch.tmp"
    
    echo "`grep -i -R -l -h $1 /var/www/wiki/page/* | cut -d/ -f7 | cut -d. -f1`" > $tempfile
    wcount=`less $tempfile | wc -l`
    echo "Found '$1' in $wcount wiki pages. Outputting 1 random hit: http://wiki.s23.org/wiki.pl?`rl -c1 $tempfile` Find the rest on http://wiki.s23.org/wiki.pl?search=$1&dosearch=Go!"
    

    ---

    This greps recursively thru /var/www/wiki/page/* (the place all the wiki pages are stored), uses "cut" to get the right piece of text and dumps it to a tempfile. Then it counts the number of hits using "wc" and outputs 1 random hit (using 'rl' = randomline command) and adds the link to the wiki search function.

    The result is :

    If you type !wiki <keyword> on a channel you can search the wiki pages for your keyword and click the right link without having to first go to the wiki search function.

    thats it so far,, make it more elegant if you like..

    mutante

    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.