Giter VIP home page Giter VIP logo

Comments (6)

Dahie avatar Dahie commented on June 1, 2024 1

Oh, respect for that wiki size. I'll have to look into it, but by default there is no way. I'll think about it.

from caramelize.

Dahie avatar Dahie commented on June 1, 2024 1

Actually it's not to hard. You can run a slightly changed version of the WikkaWiki adapter in which you modify the query to your database. For this you create a new custom wiki adapter. Create a wikka_wiki_resume_progress_at_id.rb in the directory where you run caramelize and add this content:

require 'caramelize/input_wiki/wiki'
require 'caramelize/input_wiki/wikkawiki'

# Within this method you can define your own Wiki-Connectors to Wikis
# not supported by default in this software

def input_wiki

  options = { host: "localhost",
              username: "user",
              database: "database_name",
              password: 'admin_password',
              markup: :wikka,
              filters: [ Caramelize::Wikka2Markdown]
            }

  wiki = Caramelize::InputWiki::Wiki.new(options)
  wiki.instance_eval do
    def read_pages
      start_progress_at_id = 47

      sql = "SELECT id, tag, body, time, latest, user, note FROM wikka_pages WHERE id > #{start_progress_at_id} ORDER BY time;"
      results = database.query(sql)
      results.each do |row|
        titles << row["tag"]
        author = authors[row["user"]]
        properties = { id: row["id"],
                       title: row["tag"],
                       body: row["body"],
                       markup: :wikka,
                       latest: row["latest"] == "Y",
                       time: row["time"],
                       message: row["note"],
                       author: author,
                       author_name: row["user"] }

        page = Caramelize::Page.new(properties)
        revisions << page
      end
      titles.uniq!
      revisions
    end
  end

  wiki
end

Modify the database credentials in the options and change the start_progress_at_id id in line 25 to the last id that was successfully imported in your first run.
Now run in your console:

$ caramelize run -c wikka_wiki_resume_progress_at_id.rb

It will prompt you if you want to overwrite the existing with a fresh repository, deny that.
It should continue to process your wiki and append to the git repository you created on the first run.

Let me know if it works. Good luck!

from caramelize.

Dahie avatar Dahie commented on June 1, 2024

Oh, by the way, by changing the SQL-query in line 27, you can also manually batch your export by defining id ranges you want to export.

from caramelize.

Dahie avatar Dahie commented on June 1, 2024

This is the same solution but with shorter code:

require 'caramelize/input_wiki/wikkawiki'

# Within this method you can define your own Wiki-Connectors to Wikis
# not supported by default in this software

def input_wiki
  options = { host: "localhost",
              username: "user",
              database: "database_name",
              password: 'admin_password',
              home_page_title: 'dahie',
            }

  wiki = Caramelize::InputWiki::WikkaWiki.new(options)
  wiki.instance_eval do
    def pages
      start_progress_at_id = 47

      sql = "SELECT id, tag, body, time, latest, user, note FROM wikka_pages WHERE id > #{start_progress_at_id} ORDER BY time;"
      @pages ||= database.query(sql)
    end
  end

  wiki
end

from caramelize.

unor avatar unor commented on June 1, 2024

I tested the first variant. It worked great!

Thank you so much for the solution, and for your quick response, Dahie :)

Now I’m trying to figure out why the Wikka2Markdown filter didn’t seem to work, but that’s a different issue.

from caramelize.

Dahie avatar Dahie commented on June 1, 2024

Alright, it worked!

I'll close this issue. If you find a problem in the wikka wiki conversion, make a new one, please. :)

from caramelize.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.