| [20:05:52] | * mindcls[m] has joined #farmos |
| [23:21:09] | * mindcls[m] has quit (*.net *.split) |
| [23:49:04] | * mindcls[m] has joined #farmos |
| [10:29:57] | * Anonymous[m] has quit (Ping timeout: 240 seconds) |
| [10:32:55] | * scrdcow[m] has quit (Ping timeout: 240 seconds) |
| [10:33:09] | * scrdcow[m] has joined #farmos |
| [10:33:48] | * Anonymous[m] has joined #farmos |
| [10:33:56] | * spacespy[m] has quit (Ping timeout: 240 seconds) |
| [10:34:06] | * spacespy[m] has joined #farmos |
| [10:35:41] | <skalakm[m]> | I have successfully gotten drush to change drupal level stuff (eg file system, enabling modules, create users) but I'm stuck on trying to do farmos level stuff (eg import areas, various asset configuration stuff). Anyone have any suggestions? Basically I need to import a bunch of csvs as various assets. |
| [10:36:32] | <mstenta[m]> | One very powerful option is `drush php-script` |
| [10:36:50] | <mstenta[m]> | That will run an arbitrary PHP script via Drush in a bootstrapped Drupal context |
| [10:37:07] | <mstenta[m]> | Allowing you to do just about anything |
| [10:37:35] | <mstenta[m]> | Regarding CSV imports... I've never looked into what's possible via Drush or custom scripts |
| [10:38:53] | <mstenta[m]> | I do know that the Feeds module (which provides the CSV import features) splits up it's code into "fetch", "parse", and "process" classes |
| [10:39:15] | <mstenta[m]> | The "fetch" part is currently: upload a file |
| [10:39:54] | <mstenta[m]> | So you might need to override that somehow so that you can say: "the file is already uploaded, here it is" and just pass it off the to parser+processor |
| [10:40:28] | <mstenta[m]> | (this is all off the top of my head, not having looked at whether there are Feeds Drush commands already available) |
| [10:40:32] | * mindcls[m] has quit (*.net *.split) |
| [10:40:56] | * mindcls[m] has joined #farmos |
| [10:44:03] | <skalakm[m]> | There are feed drush commands. I'll look into those. |
| [10:44:03] | <mstenta[m]> | You could also consider writing your own Drush commands... Although that wouldn't give you much more than just using `drush php-script` |
| [10:44:04] | <mstenta[m]> | The other typical "fetch" plugin is HTTP request, where you point to a specific URL to get the data from |
| [10:44:06] | <mstenta[m]> | Maybe using that would help |
| [10:44:09] | <mstenta[m]> | In the CLI context |
| [14:21:11] | <skalakm[m]> | Feed drush commands work great. Thanks for that help. Now I am running into an issue with grouping assets. I have the assets and groups imported in but I can't seem to figure out a way to assign assets to groups. In the gui I can just check the boxes and then the group button appears. Any ideas on what module does this? I tried to look up drupal groups but that seems more like permissions-type stuff. |
| [14:21:51] | <mstenta[m]> | The "Groups" stuff is farmOS-specific |
| [14:22:18] | <mstenta[m]> | In order to assign assets to a group, you need to create a log that references assets and references groups via the "Group membership" fields |
| [14:22:31] | <mstenta[m]> | There's a helper function for doing this in code... let me find it... |
| [14:23:25] | <mstenta[m]> | https://github.com/farmOS/farmOS/blob/92f854b9be271e06f2e005f14d64653eb4... |
| [14:23:33] | <mstenta[m]> | `farm_group_membership_set()` |
| [14:23:46] | <mstenta[m]> | That will take an array of assets and groups and create the log for you |
| [14:24:07] | <mstenta[m]> | you can also specify a timestamp, otherwise it will default to "now" |
| [14:25:12] | <mstenta[m]> | One of the use-cases for Groups is keeping track of how an asset's Group membership changes over time |
| [14:25:29] | <mstenta[m]> | eg: a Cow moving from one herd to another |
| [14:26:14] | <mstenta[m]> | So "Group membership" is similar to "Location" in that regard... it is tracked via logs that reference the assets and their new group/areas |
| [14:26:44] | <mstenta[m]> | (In farmOS 2.x we will be standardizing those things a bit more) |
| [14:26:52] | <mstenta[m]> | (But same basic concept) |