First of sorry for my bad english I hope you understand me. I have now installed version 7 and it works quite well.

For me it is very important to upgrade from 6 to 7 to have.

I got to the database aligned to my pictures and galleries in version 7. I have 150 galleries are about 4700 images.

By aligning the database where it has worked, so I now see the galleries with pictures, the problem I have now is not working properly, the newly created galleries. I work next to it in order to find the error.

It will be because I've rewritten the database dirty and so now newly created galleries can not write to the database clean.

I wanted to provide feedback and am happy that the version 7 already works so perfectly. Since I'm not a good programmer, it's hard for me to upgrade from 6 to 7 to write but I get out which is really just the database must be aligned. I think.

When I have more information, I announce it.

Thank you very much.

it is a wonderful modules

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Title: Feedback to Version 7 » Upgrade path from Drupal 6 (3.x) to Drupal 7 (1.x) version
Category: bug » task

I'm adopting this issue as the request to include a D6 to D7 upgrade path. I'm on a site with around 200 galleries and 10,000 photos, so a similar situation to the original report. I'm quite comfortable writing upgrade paths, so I'll be happy to write this for the project. Huge kudos to @zengenuity for picking up this project and bringing it to Drupal 7.

zengenuity’s picture

Awesome! Thanks. I'm sure that's going to make a lot of people happy.

The code for the module is still in flux a bit, but I think the DB schema is pretty well set. I originally went through and ported all the D6 code, making relationships and relationship types entities in the process. However, I haven't taken full advantage their being entities yet, since my initial port was more or less function by function. I was able to get rid of a bunch of Views declarations last week by switching the code over to a ViewsController, but I've only just started working through the meat of the code to rewrite things "properly". I'm trying to keep the functions in place as much as I can, so it shouldn't disrupt what you're doing.

So, as you're going through, if you see code that looks old-fashioned (D6 style) or code that is never called, that's leftovers from the port. Still cleaning up.

quicksketch’s picture

Status: Active » Needs review
FileSize
6.29 KB

Great, I certainly appreciate your work! The new approach looks great. Utilizing the D7 systems while still functioning like the old system (which I quite liked also).

Here's my patch that includes a full upgrade from D6 to D7. It:

- Migrates all Node Gallery Relationships, setting up new entity types as needed through the Node Gallery API.
- Updates all individual galleries.
- Reassociates all images with their galleries.

The new D7 version has more information in its database tables than the D6 version, so I calculated that information as needed (i.e. node_gallery_galleries.item_count, node_gallery_galleries.pub_item_count).

Note that this upgrade is in the node_gallery.install file intentionally (not the node_gallery_api.install) because D6 users will not have had the node_gallery_api module installed, so the upgrade wouldn't run if it was contained in a new module (that's why system.install is responsible for doing updates on behalf of migrating upload.module to file.module for example).

I separated out the updates into 6 different updates (7000 - 2005) for both clarity and debugging purposes. If we get bug reports in the future, we'll have a better idea of which update is causing the problem.

The updates are all sanity checked for existing database tables, so if you're already running the D7 version of node gallery, it will seem that update.php is necessary with the new updates, but none of them will actually execute anything. All new installations of the D7 version of the module will start at the schema version node_gallery_update_7005().

quicksketch’s picture

Sorry that was an older version of the patch, this is the one I meant to upload (just fixes some inaccurate comments and a little better code clarity).

quicksketch’s picture

Status: Needs review » Needs work

Hm, I realized that a problem with this approach is that node_gallery_install() is never called with the new set up display modes. We'll need to split that out so that we can call it from the update hooks also.

quicksketch’s picture

Status: Needs work » Needs review
FileSize
10.56 KB

Okay the setup of display modes is now separated into a different function (unchanged otherwise). This fixes issues with thumbnails not working throughout the upgrade installation of node gallery.

scroogie’s picture

How awesome is that. Thanks a lot.

zengenuity’s picture

Status: Needs review » Needs work

I can't get this upgrade code to work. There are two problems that I see:

First, since the code has been added to node_gallery.install, there's a sequencing issue if you follow the official upgrade process for D6 -> D7 (http://drupal.org/node/570162). That says to disable all contrib modules, do the upgrade, then enable and upgrade the modules one-by-one. When you do that, NG API must be enabled before NG, which causes the error:

DatabaseSchemaObjectExistsException: Table <em class="placeholder">node_gallery_galleries</em> already exists. in DatabaseSchema->createTable() (line 657 of/Code/Testing/drupal_up/includes/database/schema.inc).

If I leave the modules enabled and upgrade them all at once with core, I think that issue can be avoided, but I still run into this error:

Update #7002
	•	Failed: DatabaseTransactionNoActiveException: in DatabaseConnection->rollback() (line 1019 of /Code/Testing/drupal_up/includes/database/database.inc).

After which point, if I try to run the update again, I get:

Update #7002
	•	Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY': INSERT INTO {node_gallery_relationship_type} (id, label, filefield_name, settings) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => Node Gallery Default [:db_insert_placeholder_2] => field_node_gallery_image [:db_insert_placeholder_3] => a:5:{s:12:"relationship";a:1:{s:4:"name";s:20:"Node Gallery Default";}s:9:"item_view";a:3:{s:17:"display_navigator";i:1;s:27:"view_navigator_item_display";s:39:"node_gallery_gallery_image_views:page_7";s:13:"page_fragment";i:0;}s:12:"manage_items";a:4:{s:12:"items_fields";a:8:{s:5:"title";s:5:"title";s:10:"body_field";i:0;s:20:"revision_information";i:0;s:6:"author";i:0;s:7:"options";i:0;s:16:"comment_settings";i:0;s:15:"image_navigator";i:0;s:24:"field_node_gallery_image";i:0;}s:14:"items_per_page";i:20;s:17:"show_gallery_list";b:0;s:15:"enable_rotation";b:1;}s:17:"relationship_type";a:2:{s:13:"gallery_types";a:1:{i:0;s:20:"node_gallery_gallery";}s:10:"item_types";a:1:{i:0;s:18:"node_gallery_image";}}s:10:"view_modes";a:2:{s:4:"full";a:1:{s:4:"view";s:39:"node_gallery_gallery_image_views:page_1";}s:6:"teaser";a:1:{s:4:"view";s:39:"node_gallery_gallery_image_views:page_2";}}} ) in drupal_write_record() (line 7036of /Code/Testing/drupal_up/includes/common.inc).

What do you think? It looks like we might need to move some of this code to node_gallery_api.install, or perhaps it'll be easier to change the node_gallery_galleries table name so there is no collision.

fugazi’s picture

many thanks for the upgrade path. For me, everything worked and I got no error message.

I can also create galleries and upload images.

After Updated to D7 I had to assign only migrate cck field. Perform update and then everything Worked.

Thanks

zengenuity’s picture

Okay, if other people are getting it to work, let me reset my D6 install and try the upgrade again.

quicksketch’s picture

That says to disable all contrib modules, do the upgrade, then enable and upgrade the modules one-by-one. When you do that, NG API must be enabled before NG, which causes the error:

Hmm, yeah the official upgrade docs aren't compatible with the way this needs to be run. Update.php runs upgrades for *all* modules, even those that are disabled. Because of the conflict with node_gallery_api colliding with the D6 node_gallery.module's database tables, you can't enable node_gallery_api module first. You have to run the upgrade *with node_gallery_api disabled*. If you're upgrading from Drupal 6 properly, the instructions say that all contrib modules should be disabled. If you short-cut the upgrade docs and left the node_gallery module enabled, the upgrade path will also work because we enable the module as part of node_gallery_update_7001().

I don't think we can move this code into node_gallery_api because (as you found) it's impossible to enable the module because the table names collide. And because the D6 version doesn't have node_gallery_api, there's no existing schema in D6, so any update hooks we add won't be executed upon upgrading... they have to be in a module that existed prior to the upgrade.

quicksketch’s picture

To solve this problem, I think we can add a hook_requirements to node_gallery_api and prevent it from trying to install its schema if a D6 version of the schema is present (which we can check easily by the existence of a node_gallery_images table).

quicksketch’s picture

Status: Needs work » Needs review
FileSize
11.83 KB

Here we are, with this hook_requirements() in node_gallery_api.install, it should prevent executing this in the wrong order.

zengenuity’s picture

Finally got some time to test this. I made a few modifications:

1. I updated the default views in node_gallery to take into account the migrated field from the D6 version. Images were missing otherwise.
2. I changed the update process to set the default views to match what they would be if you installed the D7 version from scratch. This will override any custom views you may have used on D6, but if I don't do this, the views from the D6 version are no longer there, so you get nothing displayed. People who used their own views should be savvy enough to re-apply them. (whereas users who had all defaults in D6 may not be savvy enough to fix the relationship type settings to apply the new views)
3. I changed the update process to apply the default view mode settings to the Node Gallery Image content type. Again, I want somebody who hasn't customized anything to end up with a gallery that matches the default D7 gallery.
4. Fixed a typo that was causing a PHP notice for uninitialized variable.

Patch attached. I think this is pretty much ready to go at this point, but it would be great if someone could test it before I commit it and roll it out.

quicksketch’s picture

Thanks @zengenuity!

I'm not sure about the changes to node_gallery_views_default_views(). It looks like you're committing to having backwards compatibility code in Node Gallery for the entire D7 release. My guess is that that kind of effort is going to cause you a headache. Any future changes to the default views aren't likely to be tested with upgrades from D6.

zengenuity’s picture

Yeah, I didn't feel great about that either. The fix is more complicated, but I think I have it working. What I'm doing now is setting up a node view mode for thumbnails, then using that in the default views. This way, all that needs to be done is to set up the view mode correctly for the migrated content type. (which I have working) This should also make it easier for users who have multiple relationship types to use the same views.

This approach has a couple downsides.
1. It requires another dependency to make the image thumbnails clickable. File Entity Link. There's an issue on File Entity to bring this functionality over, though, so this may go away: #1392900: Integrate File Entity Link's features into File Entity?
2. It's harder for novice users to customize or remove the titles in the default view. It can be done with Display Suite or Exclude Node Title, but people may not know that.

Still, this is probably the better approach.

In addition, I found one other issue with the upgrade process. If you are missing one of the dependencies, the process was throwing an error telling you that Node Gallery API was not installed. I added some code to give a better message about exactly which dependency is missing.

zengenuity’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.