I had a hard time upgrading the og module from 4.7 to 5.1.
The main problem I had was that the update.php script was freezing during the update.
I tried with the official release 5.x-1.0 and the dev 5.x-1.x-dev and experienced the same problem.
Starting with a 4.7 db with all modules disabled, I update the system.module without any prob with the drupal 5 scripts (many queries done from the 1000 on)...
I activate the other modules from the core that I usually use... update.php : only the statistics module needed a quick update.
I activate the latest views module 5.x-1.5 (views + views_rss). no update available, OK.
I activate the og 5.x-1.0 module. I went to the update.php page, and I see 2 warnings :

* user warning: Table 'dev.og_ancestry' doesn't exist query: SELECT is_public FROM og_ancestry WHERE nid = 978 LIMIT 0, 1 in /includes/database.mysql.inc on line 172.
* user warning: Table 'dev.og_ancestry' doesn't exist query: SELECT oga.group_nid, n.title FROM og_ancestry oga INNER JOIN node n ON oga.group_nid = n.nid WHERE oga.nid = 978 in /includes/database.mysql.inc on line 172.

normal since is the db has not yet been updated. I click on run the db update script. the selected og update is 14. I click on the update button.
I end up of the page update.php?op=selection saying :
Updating
Please wait while your site is being updated.
but without the progress bar, and it freezes, nothing happens. (same with the og 5.x-1.x-dev).

The only way I could make the update happen is, back at the beginning, by updating the system.module, and then with no core modules activated, I install views + views_rss, and og. I run the update.php, with still the 2 same warnings, but now the progress bar appears (still the update 14).
The update process finishes (update.php?op=finished), but the 14 and 15 queries both say "no queries". I check the node_access table, and it seems to have been updated :
gid realm grant_view grant_update grant_delete
742 og_subscriber 1 1 1
0 og_public 1 0 0
0 og_public 1 0 0
0 og_public 1 0 0
If I go again to the update page, it says there is no update for og.

I also forgot to mention that I disabled the og module in my previous drupal 4.7 version. Is that necessary for the update? it is not mentionned in the readme.txt file.

In a nutshell, the main questions are :
- why is the update script freezing in some configuration (only core modules active) ?
- why is there no query in the listing after the update ?
- if the update script says there is no update for og, does it mean that the 14 and 15 update went well ?

Comments

scor’s picture

Just did another test with og-5.x-1.0
From a 4.7 db with og properly disabled, no module activated and bluemarine theme.
node_access table looks like :

nid gid realm grant_view grant_update grant_delete
6 742 og_subscriber 1 1 1
54 0 og_all 1 0 0
113 0 og_all 1 0 0

I run the update script that updates the system.module (1000)

I activated the other core modules I need.
update.php : statistics (1000). OK
I activated views
I activated og
update.php : 2 warnings (like before).
I run the update for og (14).
Progress bar (taking a while), and finally it's done, but without any query logged.
the following error was logged :

Location http://.../update.php?op=do_update
Referrer http://.../update.php?op=selection
Message Invalid argument supplied for foreach() in .../includes/module.inc on line 272.

In the node_access table, all the records have realm set to 'all' and all the gid are '0'. (the og access control is still disabled).
I activate the og access control, and the node_access table becomes like this :

nid gid realm grant_view grant_update grant_delete
6 742 og_subscriber 1 1 1
12 0 og_public 1 0 0
13 0 og_public 1 0 0

I hope these extra info will help.

moshe weitzman’s picture

1. Perhaps because og5 requires Views. Not sure. Be sure to see the upgrade part of readme.txt for og
2. There are too many queries to list. Not sure how to give better feedback.
3. i can't say for sure. I think your site is fine though.

scor’s picture

I followed the update section of the readme.txt file. Both views and views_rss were installed before activating og, and updating it.

emilyf’s picture

I too had issues upgrading from 4.7 to 5. Both views and views rss were enabled when I did it. I first had the same issue as above where the update froze. This happened 3 times (let it sit until eventually timed out each time). Then I disabled pretty much every other module I have installed and tried again. It gave me this warning:

* user warning: Table 'og_ancestry' already exists query: CREATE TABLE og_ancestry ( nid int(11) NOT NULL, group_nid int(11) NOT NULL, is_public int(1) NULL, KEY (nid), KEY (group_nid) ) /*!40100 DEFAULT CHARACTER SET utf8 */; in /var/www/sandbox/dev/includes/database.mysql.inc on line 172.
* user warning: Table 'og_ancestry' already exists query: CREATE TABLE og_ancestry ( nid int(11) NOT NULL, group_nid int(11) NOT NULL, is_public int(1) NULL, KEY (nid), KEY (group_nid) ) /*!40100 DEFAULT CHARACTER SET utf8 */; in /var/www/sandbox/dev/includes/database.mysql.inc on line 172.

However, everything seemed ok. Until I went into my groups. Somehow none of my content on my site is associated with any groups anymore. Not one piece.

How can I remedy this buggy behavior?

damien_vancouver’s picture

I had this timeout problem during my 4.7 -> 5 upgrades on a site with lots of content. If you're lucky you can salvage the one you have there just by re-running og update 18 (which will also run 19).

Try going into update.php and manually select og Update 18, and let it run from there. Cross your fingers and it might magically correct itself if it gets to the success page.

If that doesn't work, it's restore your 4.7 backup and upgrade again time probably... or at least hack away in og.install as detailed below. The general strategy is to comment out bits of code so update.php is only doing as little work as possible each time you run it, and then nursing it through baby steps until all your updates are applied. It's not very user friendly but it will work. It might take several tries to get it right... just keep notes of what you are doing in what order and that really helps. When you find the exact order that works, go back and do it one final time in order so there are no errors...

steps are:
- go back to your 4.7 backup (you DID back up the DB first right?? :) )
- visit update.php, see what update og is trying to start running at - probably it will be 13 or 14... Make a note of which one but then set the og module's drop down so that it is not running any updates at first. Run the other essential drupal updates, such as system.module, content.module etc. first to get those out of the way. Once all those are applied and not showing any more, back up the DB again so you can start from this spot once you have the final recipe written down.
- Open a notepad or something as a temporary scratch area
- Cut out all the updates beyond the first one that wants to run. So say it wants to start at 14, go into og.install and either comment out with /* */ or cut and paste into another file og_update_15, og_update_16() and so on.... leaving only up to og_update_14() in the og.install file.
- run that first one and it should make it without timing out. Now your og is updated to 14.
- one update at a time, you uncomment the new ones so that update.php will only try and run one update.
- og_update_16, 17, and 18 are all the same command - node_access_rebuild(). You should only have to run this once. Also this is the function that was causing the timeout for me on my 4.7 - 5 upgrade on a large site... you can either get to 15, then uncomment all three and just run 18, or edit their contents, or whatever.
- finally run og update 19 by hand.

If you can make it do all the updates in order, you should be golden. Once you're at 5 again the upgrades are all smooth :). 4.7 - 5 is OK if you don't have a lot of content, but it times out if you do as you're experiencing. Good luck!

moshe weitzman’s picture

node_access_rebuild() is fixed in drupal6 so if you can get to there, you won't have to battle anymore.

emilyf’s picture

Unfortunately I can't upgrade to 6 right now because I am waiting on a great deal of contrib modules. I have to go to 5 for awhile first.

I've now been working on this for about 3 days with 0 results. I have tried every solution offered, and have come up with no success. I've had to push my php memory limit up to 350M to even get og updates to run! So I have about 40,000 records which are never associated with groups, but figured maybe those were clogging things up. I removed them from the node_access table, node_revision, node, and the data out of the content type table. Then I upgraded og and it went much better. Of course, it said no queries were executed like the post above. Now the interested thing is my group type is gone. So I created a new type called 'group'. My og table still holds all of my groups in it. But it is not associating them with the group type now. So then I try to edit one of my actual group nodes. When I click edit I get this error:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'og_node_form' was given in /var/www/sandbox/dev/includes/form.inc on line 218.

Why is my group type getting deleted from this upgrade now? I am disabling og in settings before turning off the module and following all instructions properly.
What is going on? I am pulling my hair out...all other modules are upgrading well and this is keeping me on 4.7!

moshe weitzman’s picture

og5 does not ship with og_basic module and provides no group type anymore. you need to create one using admin -> content types. likely the type name of your content type should be og. this is mentioned in the README in the section "UPGRADING FROM 4.7 TO 5.0"

emilyf’s picture

emilyf’s picture

moshe

thanks for the knock on the head...i had upgraded so many times (9 in all) that i had thought i created og but had named it group that time. and finally, it's working.

for others with this issue, i kinda did a combination of the above steps that ended in this order:
- Upgrade core 5
- Upgrade views
- Upgrade cck

Then, in order to not get timeouts or a final of groups intact but no posts in them, I had to remove a ton of data. I had a data type with 38,000 records in that is never associated with groups. I removed all of those entries from the node_access table and from that content table (keep the dumps). Backup here.

Then I pretty much followed above:
- Install OG but edit the install file to only allow upgrade 14. Then uncomment 15. Then 16, etc etc until they are all done. I ended up having to have my php mem at about 220M (better than it was with the 38,000 :) ) but then brought it back down after everything was finished.

- Create og node type (name it og like moshe reminds.....duh!).
- Enable og.

Still no posts. Then I ran upgrade 18 again manually, and it's all good. Then I upgraded the rest of my contrib modules (would not work unless I only did those major three first, but the rest last).

Thanks again for the help. Hopefully this can help someone as well.

moshe weitzman’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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