Class: JekyllImport::Importers::Drupal7
- Inherits:
-
JekyllImport::Importer
- Object
- JekyllImport::Importer
- JekyllImport::Importers::Drupal7
- Extended by:
- JekyllImport::Importers::DrupalCommon::ClassMethods
- Includes:
- DrupalCommon
- Defined in:
- lib/jekyll-import/importers/drupal7.rb
Constant Summary
Constants included from JekyllImport::Importers::DrupalCommon::ClassMethods
JekyllImport::Importers::DrupalCommon::ClassMethods::DEFAULTS
Class Method Summary collapse
- .aliases_query(prefix) ⇒ Object
- .build_query(prefix, types, engine) ⇒ Object
- .post_data(sql_post_data) ⇒ Object
Methods included from JekyllImport::Importers::DrupalCommon::ClassMethods
process, require_deps, specify_options
Methods included from DrupalCommon
#aliases_query, #build_query, #post_data, #validate
Methods inherited from JekyllImport::Importer
inherited, run, stringify_keys, subclasses
Class Method Details
.aliases_query(prefix) ⇒ Object
51 52 53 |
# File 'lib/jekyll-import/importers/drupal7.rb', line 51 def self.aliases_query(prefix) "SELECT source, alias FROM #{prefix}url_alias WHERE source = ?" end |
.build_query(prefix, types, engine) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jekyll-import/importers/drupal7.rb', line 11 def self.build_query(prefix, types, engine) types = types.join("' OR n.type = '") types = "n.type = '#{types}'" tag_group = if engine == "postgresql" " (SELECT STRING_AGG(td.name, '|')\n FROM \#{prefix}taxonomy_term_data td, \#{prefix}taxonomy_index ti\n WHERE ti.tid = td.tid AND ti.nid = n.nid) AS tags\n" else " (SELECT GROUP_CONCAT(td.name SEPARATOR '|')\n FROM \#{prefix}taxonomy_term_data td, \#{prefix}taxonomy_index ti\n WHERE ti.tid = td.tid AND ti.nid = n.nid) AS 'tags'\n" end query = " SELECT n.nid,\n n.title,\n fdb.body_value,\n fdb.body_summary,\n n.created,\n n.status,\n n.type,\n u.name,\n u.mail,\n \#{tag_group}\n FROM \#{prefix}node AS n\n LEFT JOIN \#{prefix}field_data_body AS fdb\n ON fdb.entity_id = n.nid AND fdb.entity_type = 'node'\n RIGHT JOIN \#{prefix}users AS u\n ON u.uid = n.uid\n WHERE (\#{types})\n" query end |
.post_data(sql_post_data) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/jekyll-import/importers/drupal7.rb', line 55 def self.post_data(sql_post_data) content = sql_post_data[:body_value].to_s summary = sql_post_data[:body_summary].to_s = (sql_post_data[:tags] || "").downcase.strip data = { "excerpt" => summary, "categories" => .split("|"), } [data, content] end |