Overview.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <!DOCTYPE html>
  2. <html dir="ltr">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  5. <title>Dev/Command-line/Overview - XOWA</title>
  6. <link rel="shortcut icon" href="https://gnosygnu.github.io/xowa/xowa_logo.png" />
  7. <link rel="stylesheet" href="https://gnosygnu.github.io/xowa/xowa_common.css" type="text/css">
  8. <style>
  9. .console {font-family: monospace; color: #EEEEEE ; background-color: black ; border: medium solid black;}
  10. .code
  11. ,.path
  12. ,.url {font-family: monospace; color: black ; background-color: #f9f9f9 ; border: medium solid #f9f9f9;}
  13. .bold {font-weight: 900;}
  14. </style>
  15. <style>
  16. .console {font-family: monospace; color: #EEEEEE ; background-color: black ; border: medium solid black;}
  17. .code
  18. ,.path
  19. ,.url {font-family: monospace; color: black ; background-color: #f9f9f9 ; border: medium solid #f9f9f9;}
  20. .bold {font-weight: 900;}
  21. </style>
  22. </head>
  23. <body class="mediawiki ltr sitedir-ltr ns-0 ns-subject skin-vector action-submit vector-animateLayout" spellcheck="false">
  24. <div id="mw-page-base" class="noprint"></div>
  25. <div id="mw-head-base" class="noprint"></div>
  26. <div id="content" class="mw-body">
  27. <h1 id="firstHeading" class="firstHeading"><span>Dev/Command-line/Overview</span></h1>
  28. <div id="bodyContent" class="mw-body-content">
  29. <div id="siteSub">From XOWA: the free, open-source, offline wiki application</div>
  30. <div id="contentSub"></div>
  31. <div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
  32. <p>
  33. XOWA can import a wiki using a plain text file and a command-line.
  34. </p>
  35. <div id="toc" class="toc">
  36. <div id="toctitle">
  37. <h2>
  38. Contents
  39. </h2>
  40. </div>
  41. <ul>
  42. <li class="toclevel-1 tocsection-1">
  43. <a href="#Import_simple.wikipedia.org_through_the_command-line"><span class="tocnumber">1</span> <span class="toctext">Import simple.wikipedia.org through the command-line</span></a>
  44. </li>
  45. <li class="toclevel-1 tocsection-2">
  46. <a href="#Import_a_different_wiki_by_editing_the_build_script"><span class="tocnumber">2</span> <span class="toctext">Import a different wiki by editing the build script</span></a>
  47. </li>
  48. <li class="toclevel-1 tocsection-3">
  49. <a href="#Import_a_wiki_with_a_manual_download"><span class="tocnumber">3</span> <span class="toctext">Import a wiki with a manual download</span></a>
  50. <ul>
  51. <li class="toclevel-2 tocsection-4">
  52. <a href="#Download_the_wiki_dump"><span class="tocnumber">3.1</span> <span class="toctext">Download the wiki dump</span></a>
  53. </li>
  54. <li class="toclevel-2 tocsection-5">
  55. <a href="#Specify_location_of_the_wiki_dump"><span class="tocnumber">3.2</span> <span class="toctext">Specify location of the wiki dump</span></a>
  56. </li>
  57. </ul>
  58. </li>
  59. <li class="toclevel-1 tocsection-6">
  60. <a href="#Script"><span class="tocnumber">4</span> <span class="toctext">Script</span></a>
  61. </li>
  62. </ul>
  63. </div>
  64. <h2>
  65. <span class="mw-headline" id="Import_simple.wikipedia.org_through_the_command-line">Import simple.wikipedia.org through the command-line</span>
  66. </h2>
  67. <ul>
  68. <li>
  69. Open up a command-line. For example, on Windows, run <span class='bold'>cmd</span>
  70. </li>
  71. <li>
  72. Run the following: <span class='console'>java -jar C:\000\200_dev\110_java\400_xowa\bin\ --cmd_file C:\xowa\xowa_build.gfs --app_mode cmd</span>
  73. </li>
  74. <li>
  75. Wait about 10 minutes for the script to complete
  76. </li>
  77. <li>
  78. Launch XOWA and enter <span class='url'>simple.wikipedia.org</span> in the URL bar
  79. </li>
  80. </ul>
  81. <h2>
  82. <span class="mw-headline" id="Import_a_different_wiki_by_editing_the_build_script">Import a different wiki by editing the build script</span>
  83. </h2>
  84. <ul>
  85. <li>
  86. Open the following file in a <a href="http://xowa.org/home/wiki/Dev/Environment/Text_editor.html" id="xolnki_2" title="Dev/Environment/Text editor">text editor</a>: <span class='path'>C:\xowa\xowa_build.gfs</span>. See Script below for the full text.
  87. </li>
  88. <li>
  89. Replace all instances of <span class='bold'>simple.wikipedia.org</span> with the domain name. For example, for English Wikipedia, use <span class='bold'>en.wikipedia.org</span>
  90. </li>
  91. <li>
  92. Run the command-line import again.
  93. </li>
  94. <li>
  95. Launch XOWA and enter in the domain name in the the URL bar.
  96. </li>
  97. </ul>
  98. <h2>
  99. <span class="mw-headline" id="Import_a_wiki_with_a_manual_download">Import a wiki with a manual download</span>
  100. </h2>
  101. <h3>
  102. <span class="mw-headline" id="Download_the_wiki_dump">Download the wiki dump</span>
  103. </h3>
  104. <ul>
  105. <li>
  106. Navigate to <a href="https://dumps.wikimedia.org/enwiki" rel="nofollow" class="external free">https://dumps.wikimedia.org/enwiki</a>
  107. </li>
  108. <li>
  109. Click on the <b>latest</b> directory
  110. </li>
  111. <li>
  112. Download the file just under "<b>Articles, templates, media/file descriptions, and primary meta-pages.</b>". It should read <b>enwiki-latest-pages-articles.xml.bz2</b>
  113. </li>
  114. </ul>
  115. <dl>
  116. <dd>
  117. The download is 11+ GB and may take anywhere between 2 and 5 hours to complete.
  118. </dd>
  119. <dd>
  120. If you also want talk pages, you should download the "<b>Recombine all pages, current versions only.</b>" version. It should read <b>enwiki-latest-pages-meta-current.xml.bz2</b>. Note that this dump is twice the size of the regular dump.
  121. </dd>
  122. </dl>
  123. <h3>
  124. <span class="mw-headline" id="Specify_location_of_the_wiki_dump">Specify location of the wiki dump</span>
  125. </h3>
  126. <ul>
  127. <li>
  128. In the build script, replace the following line:
  129. </li>
  130. </ul>
  131. <dl>
  132. <dd>
  133. <span class='code'>add ('simple.wikipedia.org', 'text.init') {src_bz2_fil = '/your_directory/simplewiki-20130103-pages-articles.xml.bz2';}</span>
  134. </dd>
  135. </dl>
  136. <h2>
  137. <span class="mw-headline" id="Script">Script</span>
  138. </h2>
  139. <pre class='code'>
  140. // do not show a "Press enter to continue" at the end of the script
  141. app.bldr.pause_at_end = 'n';
  142. // run xowa.gfs
  143. app.scripts.run_file_by_type('xowa_cfg_app');
  144. // import wiki; for more info see [[Dev/Command-line]]
  145. app.bldr.cmds {
  146. // delete all files in directory; note that subdirectories and file databases ("-file.xowa") will not be deleted
  147. add ('simple.wikipedia.org' , 'util.cleanup') {delete_all = 'y';}
  148. // download main dump file; contains all articles
  149. add ('simple.wikipedia.org' , 'util.download') {dump_type = 'pages-articles';}
  150. // download categorylinks file; contains links from category to pages
  151. add ('simple.wikipedia.org' , 'util.download') {dump_type = 'categorylinks';}
  152. // download page_props file; contains information on hidden categories
  153. add ('simple.wikipedia.org' , 'util.download') {dump_type = 'page_props';}
  154. // start wiki import
  155. add ('simple.wikipedia.org' , 'text.init');
  156. // import articles
  157. add ('simple.wikipedia.org' , 'text.page');
  158. // generate search data
  159. add ('simple.wikipedia.org' , 'text.search');
  160. // generate main category data
  161. add ('simple.wikipedia.org' , 'text.cat.core');
  162. // import category links
  163. add ('simple.wikipedia.org' , 'text.cat.link');
  164. // apply hidden categories
  165. add ('simple.wikipedia.org' , 'text.cat.hidden');
  166. // end import
  167. add ('simple.wikipedia.org' , 'text.term');
  168. // import css into wiki
  169. add ('simple.wikipedia.org' , 'text.css');
  170. // cleanup temp files; delete xml and bz2
  171. add ('simple.wikipedia.org' , 'util.cleanup') {delete_tmp = 'y'; delete_by_match('*.xml|*.sql|*.bz2|*.gz');}
  172. }
  173. // run cmds
  174. app.bldr.run;
  175. </pre>
  176. </div>
  177. </div>
  178. </div>
  179. <div id="mw-head" class="noprint">
  180. <div id="left-navigation">
  181. <div id="p-namespaces" class="vectorTabs">
  182. <h3>Namespaces</h3>
  183. <ul>
  184. <li id="ca-nstab-main" class="selected"><span><a id="ca-nstab-main-href" href="index.html">Page</a></span></li>
  185. </ul>
  186. </div>
  187. </div>
  188. </div>
  189. <div id='mw-panel' class='noprint'>
  190. <div id='p-logo'>
  191. <a style="background-image: url(https://gnosygnu.github.io/xowa/xowa_logo.png);" href="http://xowa.org/" title="Visit the main page"></a>
  192. </div>
  193. <div class="portal" id='xowa-portal-home'>
  194. <h3>XOWA</h3>
  195. <div class="body">
  196. <ul>
  197. <li><a href="http://xowa.org/index.html" title='Visit the main page'>Main page</a></li>
  198. <li><a href="http://xowa.org/screenshots.html" title='See screenshots of XOWA'>Screenshots</a></li>
  199. <li><a href="http://xowa.org/home/wiki/Help/Download_XOWA.html" title='Download the XOWA application'>Download XOWA</a></li>
  200. <li><a href="http://xowa.org/home/wiki/Dashboard/Image_databases.html" title='Download offline wikis and image databases'>Download wikis</a></li>
  201. </ul>
  202. </div>
  203. </div>
  204. <div class="portal" id='xowa-portal-started'>
  205. <h3>Getting started</h3>
  206. <div class="body">
  207. <ul>
  208. <li><a href="http://xowa.org/home/wiki/App/Setup/System_requirements.html" title='Get XOWA&apos;s system requirements'>Requirements</a></li>
  209. <li><a href="http://xowa.org/home/wiki/App/Setup/Installation.html" title='Get instructions for installing XOWA'>Installation</a></li>
  210. <li><a href="http://xowa.org/home/wiki/App/Import/Simple_Wikipedia.html" title='Learn how to set up Simple Wikipedia'>Simple Wikipedia</a></li>
  211. <li><a href="http://xowa.org/home/wiki/App/Import/English_Wikipedia.html" title='Learn how to set up English Wikipedia'>English Wikipedia</a></li>
  212. <li><a href="http://xowa.org/home/wiki/App/Import/Other_wikis.html" title='Learn how to set up other Wikipedias'>Other Wikipedias</a></li>
  213. </ul>
  214. </div>
  215. </div>
  216. <div class="portal" id='xowa-portal-android'>
  217. <h3>Android</h3>
  218. <div class="body">
  219. <ul>
  220. <li><a href="http://xowa.org/home/wiki/Android/Setup.html" title='Setup XOWA on your Android device'>Setup</a></li>
  221. </ul>
  222. </div>
  223. </div>
  224. <div class="portal" id='xowa-portal-help'>
  225. <h3>Help</h3>
  226. <div class="body">
  227. <ul>
  228. <li><a href="http://xowa.org/home/wiki/Help/About.html" title='Get more information about XOWA'>About</a></li>
  229. <li><a href="http://xowa.org/home/wiki/Help/Contents.html" title='View a list of help topics'>Contents</a></li>
  230. <li><a href="http://xowa.org/home/wiki/Help/Media.html" title='Read what others have written about XOWA'>Media</a></li>
  231. <li><a href="http://xowa.org/home/wiki/Help/Feedback.html" title='Questions? Comments? Leave feedback for XOWA'>Feedback</a></li>
  232. </ul>
  233. </div>
  234. </div>
  235. <div class="portal" id='xowa-portal-blog'>
  236. <h3>Blog</h3>
  237. <div class="body">
  238. <ul>
  239. <li><a href="http://xowa.org/home/wiki/Blog.html" title='Follow XOWA''s development process'>Current</a></li>
  240. </ul>
  241. </div>
  242. </div>
  243. <div class="portal" id='xowa-portal-links'>
  244. <h3>Links</h3>
  245. <div class="body">
  246. <ul>
  247. <li><a href="http://dumps.wikimedia.org/backup-index.html" title="Get wiki datababase dumps directly from Wikimedia">Wikimedia dumps</a></li>
  248. <li><a href="https://archive.org/search.php?query=xowa" title="Search archive.org for XOWA files">XOWA @ archive.org</a></li>
  249. <li><a href="http://en.wikipedia.org" title="Visit Wikipedia (and compare to XOWA!)">English Wikipedia</a></li>
  250. </ul>
  251. </div>
  252. </div>
  253. <div class="portal" id='xowa-portal-donate'>
  254. <h3>Donate</h3>
  255. <div class="body">
  256. <ul>
  257. <li><a href="https://archive.org/donate/index.php" title="Support archive.org!">archive.org</a></li><!-- listed first due to recent fire damages: http://blog.archive.org/2013/11/06/scanning-center-fire-please-help-rebuild/ -->
  258. <li><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector" title="Support Wikipedia!">Wikipedia</a></li>
  259. <!-- <li><a href="" title="Support XOWA! (but only after you've supported archive.org and Wikipedia)">XOWA</a></li> -->
  260. </ul>
  261. </div>
  262. </div>
  263. </div>
  264. </body>
  265. </html>