我在编写dumpbackup命令时,遇到一个难题,希望能传入一个category的名字,从而进行筛选,获取该category下所有的页面,请问有没有大侠知道怎么办?谢谢。

解决方案 »

  1.   

    命令格式如下:
    用start和end参数来指定,如果页面不连续可以分多次执行。
    ========================================================================
    This script dumps the wiki page database into an XML interchange wrapper
    format for export or backup.XML output is sent to stdout; progress reports are sent to stderr.Usage: php dumpBackup.php <action> [<options>]
    Actions:
      --full      Dump complete history of every page.
      --current   Includes only the latest revision of each page.
      --logs      Dump action logs for every page.Options:
      --quiet     Don't dump status reports to stderr.
      --report=n  Report position and speed after every n pages processed.
                  (Default: 100)
      --server=h  Force reading from MySQL server h
      --start=n   Start from page_id n
      --end=n     Stop before page_id n (exclusive)

      --skip-header Don't output the <mediawiki> header
      --skip-footer Don't output the </mediawiki> footer
      --stub      Don't perform old_text lookups; for 2-pass dump
      --uploads   Include upload records (experimental)Fancy stuff:
      --plugin=<class>[:<file>]   Load a dump plugin class
      --output=<type>:<file>      Begin a filtered output stream;
                                  <type>s: file, gzip, bzip2, 7zip
      --filter=<type>[:<options>] Add a filter on an output branch
      

  2.   

    通过指定pageid是可以获得不同的页面,但现在的问题是,我并不可能事先知道一个category下面所有页面的id啊,能不能通过-filter参数来指定某一个category,从而筛选出其下的所有Page?。
      

  3.   

    没用过这个,但根据category能不能真接查数据库?里面有没有类似parent的字段,如果递归就递归一下。我们用的是semantic ask 查询,简单多了
      

  4.   

    我看wiki的页面上有个export功能,那里面可以根据category先筛选出来需要的page,然后再导出。。不知道能不能通过脚本来实现。。
      

  5.   

    脚本实现,用category查pageid,然后执行dumpBackup
      

  6.   

    楼上的大哥,怎么操作?具体点。。我完全没用过wiki。。最好能给个例子出来~谢谢。
      

  7.   

    -_-||| google出来的第二条就是本帖
    剩下的都是E文的,貌似老外没有遇到过类似的问题,实在不行我只能通过程序模拟http request来访问wiki页面了。。回到最开始的方法。。杯具了。
      

  8.   

    你不能用php写一个数据库查询语句吗?然后返回给备份脚本。
      

  9.   

    我对php一窍不通...我是搞.net的
      

  10.   

    硬啃呗,给查询参看给你,PHP手册上的例子先连接数据库
    http://www.php.net/manual/en/function.mysql-connect.php再查询
    http://www.php.net/manual/en/function.mysql-query.php
      

  11.   

    当然可以,我给你看了一下
    进下面这页Special:Export
    里面Add pages from category: 输入category:xxxx(或不带命名空间xxxx) ,点添加即可