The biggest issue here is that the core module and the Tags submodule were renamed. However we already renamed most of the submodules in FBSS 6.x-3.x so there is a precedent for how to handle the transition gracefully.

I should note that we may want to consider renaming the other submodules while we're at it. Currently:

  • The core module is "statuses"
  • The Tags submodule is "statuses_tags"
  • The other submodules are "fbss_[name]"

"fbss_" doesn't make much sense given the name change, and "statuses_tags" is inconsistent with that, so it's worth considering a new naming scheme while we can get it all done at once.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

IceCreamYou’s picture

Status: Active » Needs work
FileSize
11.89 KB

Here is an initial (untested) patch. Still to do: update Flags, Rules, Mollom, Pathauto, Userpoints, and maybe Services and Views database records that reference "facebook_status" instead of "statuses."

IceCreamYou’s picture

(By the way, I decided it was too much trouble to rename the submodules, especially since their names in code are not user-facing. It will happen one day, but not today.)

Here is an overview of the status of integrations with all modules that FBSS supported.

Expected to be Working, No Remaining Upgrades Needed

User Relationships
Flag Friend
Input filters (core)
SMS Framework
Domain Access
Shorten URLs
Timeago
ImageCache Profile

I have reason to believe that all of these integrations are fully working. Upgrading from D6 to D7 does not require manual steps from the site administrator to upgrade these integrations; additionally, either no automatic upgrade steps are required or these steps are already included in the patch in #1.

Expected to be Working, Manual Upgrade Steps Required

Rules
Views
Pathauto

People will have to recreate any custom Rules and Views or modifications to the default Views as part of the D6 -> D7 transition. There's really not much we can do about this. We only provide one default Rule which is useless and disabled by default, and I recommend that we remove it.

All Pathauto users will need to completely reconfigure their Pathauto settings after upgrading from D6 to D7 because of the changes to Token in D7.

Expected to be Working, Manual Theming Changes May Be Required

User profile (core)
Author Pane
Statuses (itself)

Statuses provides variables to the user profile and author pane theming templates. The names of these variables have changed. Similarly, the names of variables for the statuses-item.tpl.php template have changed, and CSS classes and IDs are different, so CSS and template changes may be required.

No Longer Supported

Activity (#1415020: Activity integration is broken)
Notifications (most likely - #1255280: Document alternative to Notifications integration)
Modal Frame (no D7 version - #1591586: Remove Modalframe integration)
Mentions (no D7 version)

There is no explicit Mentions integration in Statuses.

Partially or Mostly Working, No Remaining Automatic Upgrade Tasks

Devel Generate (#1481764: Devel Integration with Stauses and fbss_comemnts)
Twitter / OAuth (#1469142: share status Twitter error)
Taxonomy (core - #1350292: Tags view doesn't adopt correct vocabulary)
Services

Working, Automatic Upgrade Tasks Remaining

Flag

The "content_type" column in the {flags}, {flag_content}, and {flag_counts} table needs to be updated for the facebook_status -> statuses transition.

Partially Working, Automatic Upgrade Tasks Remaining

Mollom
Userpoints

Mollom correctly judges whether a post is ham or spam, but it does not correctly display a CAPTCHA if it is unsure. Furthermore no entries appear in the {mollom} table for statuses.
In the {mollom} table, the "entity" and "form_id" columns need to be updated for the facebook_status -> statuses transition.
In the {mollom_form} table, the "form_id" column needs to be updated for the facebook_status -> statuses transition.

Even though hook_userpoints() appears to be deprecated (although the nodes and comments integration module is using it) and even though hook_userpoints_info() hasn't been implemented, it appears that Userpoints is more or less working. However even if no changes are required to the integration itself, we need to update the "operation" column of the {userpoints_txn} table during the upgrade process.

Not Working

Quant

The Quant module integrates with Statuses (instead of the other way around) and it hasn't been upgraded to take the name change into account.

Unknown

Context
Views Bulk Operations
Ctools
Heartbeat
Trigger (#1565402: Leftover D6 Trigger integration causes incompatibility with Commerce module)

It might be dangerous to use Context integration; the only place it's used is to change where contexts apply, and done incorrectly this could cause WSODs or other unexpected results. Most likely no one uses it right now, so I would not mind removing it.

Statuses has explicit integration with Views Bulk Operations from D6, but I think that is no longer necessary in D7 and should be removed. Most likely VBO already works with Statuses since it depends primarily on Rules and Views.

Statuses provides a Ctools content type as a convenience for Author Pane. I don't know if it is working, but I think Author Pane doesn't use it in D7 anyway, and it's redundant with the Statuses block. It's also a common source of questions, so we should remove it.

The only direct support that Statuses provides for Heartbeat is 3 lines of JavaScript. As I understand it, Heartbeat takes care of the rest. I have not tried mixing Heartbeat with Statuses, but from what I understand, it should work.

Trigger integration existed mainly to support Activity integration, and it is removed from D8, so we should go ahead and remove it.

IceCreamYou’s picture

Status: Needs review » Needs work

In summary, these are the tasks extracted from the previous comment that don't already have issues associated with them:

Services integration has problems
Mollom integration has problems
Userpoints integration probably needs some improvements
Integration with Context, VBO, Ctools, and Trigger should be removed
The one default Rule we provide should be removed
VBO integration needs to be tested

Additionally, we should post a patch for the D7 branch of Quant to fix its integration with Statuses.

Finally, in this issue, we need to add upgrades for the Flag, Userpoints, and Mollom modules to the patch in #1.

IceCreamYou’s picture

Status: Needs work » Needs review
FileSize
14 KB

This patch includes upgrades for Flag, Userpoints, and Mollom.

Remaining tasks in this issue include opening issues for the problems discussed in #3 and testing that the attached patch actually works.

mathankumarc’s picture

Its really awesome Isaac. Just now I looked in to the issue queue, its flooding with your comments.

I should take a part on this now. I will test this and will look into other issues too.

IceCreamYou++ (I'm wondering why we dont have this feature in d.o)

mathankumarc’s picture

Status: Needs work » Needs review
FileSize
14.43 KB

Here is the updated one.

fbss_userpoints variables needs to renamed, since its not using fbss_[module_name] pattern for variable name. Not yet tested the complete upgrade. Just now I started to setup a another drupal installation for testing this one.

mathankumarc’s picture

Here is the patch for Quant integration. Also created the new issue in Quant issue queue and posted the patch #1616286: Port Facebook-style statuses support.

IceCreamYou’s picture

Great. Obviously the hard part of testing this is setting up D6 with all the integrated modules and then once you start the port if something breaks it's hard to just roll back...

I'm really busy this week so if it takes me awhile to respond that's why.

mathankumarc’s picture

Status: Needs review » Needs work

Just now did fresh upgrade from 6.x to 7.x.

facebook_status table was not renamed to statuses. Both facebook_status and statuses tables are present. While upgrading we will remove the facebook_status folder and add the statuses folder, I think we are missing something here(or Am I missing anything.)

I think submodules are got updated.

P.S. first enable the statuses module then enable the submodules one by one, please do not enable all the modules in one shot.(May be the above problem caused by this because I enabled the modules in one shot :( )

I forgot to update my themes, However the beauty is D6 garland theme is working with D7. Its really awesome:)

I didn't tried mollom integration. Going to bed, will try to solve this on tomo :)

IceCreamYou’s picture

facebook_status table was not renamed to statuses. Both facebook_status and statuses tables are present. While upgrading we will remove the facebook_status folder and add the statuses folder, I think we are missing something here(or Am I missing anything.)

The usual upgrade process is:

  • Disable all contrib modules and switch to a default theme like Garland.
  • Upgrade core.
  • Enable the D7 version of contrib modules and run update.php.
  • Remove any unused D6 contrib modules.

I think that most likely Drupal doesn't think it needs to run the new upgrade function for Statuses since as far as it is concerned it is a new module. (Same for Statuses Tags, but the other submodules have the same names, so they should be fine.) We might be able to resolve this simply by renaming the upgrade function to facebook_status_update_7100(). If not, the upgrade process will need to happen during installation.

first enable the statuses module then enable the submodules one by one, please do not enable all the modules in one shot.

Other than possible memory limit issues I don't think this should be a problem.

mathankumarc’s picture

I think that most likely Drupal doesn't think it needs to run the new upgrade function for Statuses since as far as it is concerned it is a new module. (Same for Statuses Tags, but the other submodules have the same names, so they should be fine.) We might be able to resolve this simply by renaming the upgrade function to facebook_status_update_7100(). If not, the upgrade process will need to happen during installation.

Yeah thats right. However we will be hit by another problem, i.e. here we are installing the statuses module not re-enabling, so statuses installation will create the statuses table and facebook_status_update_7100() will try to rename the facebook_status table to statuses. The following method will allow us to solve this problem,

1. Install statuses
2. Re-enable or install(statuses_tags sub-module) the submodules (So that statuses schema will have complete information like private field)
3. Run the facebook_status_update_7100()
Here this function should migrate the data in the facebook_status table to statuses table and deletes the facebook_status table rather than renaming the facebook_status table

But the problem with this method is how can we make this process synchronous? i.e. running the update script after the complete installation of statuses and other submodules.

Other than possible memory limit issues I don't think this should be a problem.

Nope. we will have problem with installation of fbss_privacy submodule. Cause privacy module will try to alter the schema of statuses table, so first we need to install the statuses and then the sub modules one by one.

Upgrade notes also suggests us to enable the modules one by one.

I think the above analysis had covered all the scenarios. @Isaac please share your thoughts on this and if I missed anything add it.

Finally we need to do another process, deleting the entry for facebook_status and facebook_status_tags module in system table once the upgradation is done.

IceCreamYou’s picture

However we will be hit by another problem, i.e. here we are installing the statuses module not re-enabling, so statuses installation will create the statuses table and facebook_status_update_7100() will try to rename the facebook_status table to statuses.

Copying the data could take an unacceptably long time for sites that have millions of statuses. We should consider manually creating the statuses table if needed in the install function. The hook_schema() implementation would have to be renamed, and then the hook_install() implementation would look something like this (pseudocode):

function statuses_install() {
  if (db_table_exists('facebook_status')) {
    // Upgrade process
  }
  else {
    // Some variant of drupal_install_schema()
  }
}

Since the schema is created before the install hook runs, another alternative would be to simply delete the {statuses} table before running the upgrade process if the {facebook_status} table exists. That might be easier although kind of wasteful.

But the problem with this method is how can we make this process synchronous? i.e. running the update script after the complete installation of statuses and other submodules.

Most likely the upgrade process will need to be called from statuses_install() instead of automatically invoked.

Nope. we will have problem with installation of fbss_privacy submodule. Cause privacy module will try to alter the schema of statuses table, so first we need to install the statuses and then the sub modules one by one.

Yes, but it looks like Drupal enables dependencies before dependent modules, so Statuses should always be installed before Statuses Privacy.

Finally we need to do another process, deleting the entry for facebook_status and facebook_status_tags module in system table once the upgradation is done.

This is not strictly necessary, but might as well I suppose.

mathankumarc’s picture

Status: Needs work » Needs review
FileSize
15.06 KB

Here is the updated one based on the above points.

Didn't tested this one.

IceCreamYou’s picture

Status: Needs review » Needs work

Looks good to me, just a few minor things:

+++ b/statuses.install
@@ -10,7 +10,23 @@
+  // Upgrade the facebook_status to statuses if its available

it's :-)

+++ b/statuses.install
@@ -10,7 +10,23 @@
+  if (db_table_exists('facebook_status')) {
+    facebook_status_upgrade();
+  }

This is clever; I like it (though I would prefer the function be named _facebook_status_upgrade()). My one concern is whether Drupal will know to drop the schema when Statuses is uninstalled as it may still associate it with FBSS. Not sure what to do about it if so, just one more thing we need to test.

+++ b/statuses.install
@@ -10,7 +10,23 @@
+    $schema['statuses'] = _statuses_statuses_schema();
+    $schema['statuses_contexts'] = _statuses_contexts_schema();

This can probably be just one function, _statuses_schema()

mathankumarc’s picture

Will modify the patch.

My one concern is whether Drupal will know to drop the schema when Statuses is uninstalled as it may still associate it with FBSS. Not sure what to do about it if so, just one more thing we need to test.

Will investigate on this too.

mathankumarc’s picture

Back to actions after two weeks :(

My one concern is whether Drupal will know to drop the schema when Statuses is uninstalled as it may still associate it with FBSS. Not sure what to do about it if so, just one more thing we need to test.

Statuses schema itself will not be available, So it will create more problems for us.

Here is the alternate solution,

  • Install Statuses
  • In hook_install check if the facebook_status table is present
  • If its available delete the statuses table and rename the facebook_status table (We need to make sure that whether shcema will be preserved when deleting a table)
  • If its not available, then it means the fresh installation

Suggestions are welcome :)

IceCreamYou’s picture

I've been really busy too...

Maybe there is a way to tell Drupal that a schema is actually associated with the new module, by changing it directly?

Thinking about this again, I think it would be okay to just copy the data. It's a simple solution and it really shouldn't take more than 30 seconds even with millions of records on a low-resource machine. The database API doesn't have a way to do that with prepared statements but I believe all the databases Drupal supports have INSERT INTO {table} SELECT syntax so it shouldn't be a big deal. At least it will work for the vast majority of sites and save us the headache of doing special schema stuff. I believe this is the route other modules have taken although looking quickly I can't find a good example.

IceCreamYou’s picture

Reroll of #6 with suggestion from #17. Basically we move the content from the FBSS tables to Statuses tables and then drop the FBSS schema. Not yet tested although for obvious reasons I'd like to commit this as soon as we can.

7twelve’s picture

Had a look at the patch in #18 and having the migration does not fire off when placed into a hook_update. However, placing it into another function and calling via hook_install seems to do the trick. Only checked against statuses / statuses_context - but data and settings appear to have come through. Have attached a patch for statuses.install only (against dev)...which brings up another point I came across.

The submodules readme states that it isn't necessary to rename all of the submodules to the statuses naming convention - however when you have both facebook_status and statuses in your modules folder, only the fbss modules are recognized in the module list. This could potentially be quite confusing to end users, as the submodules (other than tag) won't show up until the facebook_status folder is removed. Thoughts?

IceCreamYou’s picture

Thanks for testing.

Had a look at the patch in #18 and having the migration does not fire off when placed into a hook_update. However, placing it into another function and calling via hook_install seems to do the trick.

Hmm. Not sure why that would be, but I guess doing it that way is okay. However the patch you provided doesn't include most of the necessary stuff from #18. I will make an effort to reroll this weekend.

The submodules readme states that it isn't necessary to rename all of the submodules to the statuses naming convention - however when you have both facebook_status and statuses in your modules folder, only the fbss modules are recognized in the module list. This could potentially be quite confusing to end users, as the submodules (other than tag) won't show up until the facebook_status folder is removed. Thoughts?

I actually have no problem with this as long as the release notes say that you have to delete the old FBSS folder after upgrading. Normally you would need to do that to upgrade a module anyway.

7twelve’s picture

Hmm. Not sure why that would be, but I guess doing it that way is okay. However the patch you provided doesn't include most of the necessary stuff from #18. I will make an effort to reroll this weekend.

Not quite sure either. Attached the full patch.

I actually have no problem with this as long as the release notes say that you have to delete the old FBSS folder after upgrading. Normally you would need to do that to upgrade a module anyway.

Fair enough, I guess my concern was that hiding them until the old module is removed might lead people to unintentionally uninstall the old version before they should (erring on the side of people not reading the docs properly).

IceCreamYou’s picture

Status: Needs work » Needs review
FileSize
1.07 KB
15.16 KB

The patch in #22 still leaves out a lot from #18. The attached patch is #18 with the fix (more or less) from #20. Also attached is an interdiff between this patch and #18 so we can see what changed.

I'm fairly confident in this one. If it looks like this works let's get it committed and push out a beta!

IceCreamYou’s picture

Whoops, here's a version with some extra comments about why we are using hook_install() and not just a normal hook_update_N().

mathankumarc’s picture

Great.......

Will review and test this.

I'm fairly confident in this one. If it looks like this works let's get it committed and push out a beta!

We will make a beta release this week :) I will put my efforts for a stable release.

mathankumarc’s picture

Status: Needs review » Needs work
+++ b/submodules/statuses_tags/statuses_tags.installundefined
@@ -113,3 +112,38 @@ function statuses_tags_uninstall() {
+function statuses_tags_update_7100(&$sandbox) {
+  if (db_table_exists('facebook_status_tags')) {
+    // Rename the database table.
+    db_rename_table('facebook_status_tags', 'statuses_tags');
+
+    // Update the vocabulary.
+    if (variable_get('facebook_status_tags_vid', -1) != -1) {
+      db_update('taxonomy_vocabulary')
+        ->fields(array(
+          'machine_name' => 'hashtags',
+          'description' => t('Contains #hashtags used in Statuses.'),
+          'module' => 'statuses_tags',
+        ))
+        ->condition('module', 'facebook_status_tags')
+        ->condition('vid', variable_get('facebook_status_tags_vid', -1))
+        ->execute();
+    }
+
+    // Convert old settings.
+    variable_set('statuses_tags_url', variable_get('facebook_status_tags_url', 'statuses/term'));
+    variable_set('statuses_tags_vid', variable_get('facebook_status_tags_vid', -1));
+    variable_set('statuses_tags_time', variable_get('facebook_status_tags_time', 'all'));
+    variable_set('statuses_tags_count', variable_get('facebook_status_tags_count', 5));
+    variable_del('facebook_status_tags_url');
+    variable_del('facebook_status_tags_vid');
+    variable_del('facebook_status_tags_time');
+    variable_del('facebook_status_tags_count');
+
+    return t('The Statuses Tags module for Drupal 7 was upgraded from Facebook-style Statuses Tags module for Drupal 6.');
+  }

We need to change upgrade of the statuses_tags like statuses

i.e. Installing statuses_tags and moving the data from the old table to new table then uninstalling the old table

IceCreamYou’s picture

Status: Needs work » Needs review
FileSize
2.79 KB
16.29 KB

Whoops.

Updated patch attached.

mathankumarc’s picture

Here is the updated one and it contains the fixes for,

  • Integrity violation error in statuses_tags installation
  • Old schema is not removed, manually deleted the tables

Need to delete the entry in the system table for the old modules.

Other than this, its working fine.

Wow! we are gonna have a stable release :)

IceCreamYou’s picture

+++ b/submodules/statuses_tags/statuses_tags.install
@@ -113,3 +122,47 @@ function statuses_tags_uninstall() {
+      db_update('taxonomy_vocabulary')
+        ->fields(array(
+          'description' => t('Contains #hashtags used in Statuses.'),
+          'module' => 'statuses_tags',
+        ))
+        ->condition('module', 'facebook_status_tags')
+        ->condition('vid', variable_get('facebook_status_tags_vid', -1))
+        ->execute();

I'm assuming the 'machine_name' field was removed from being updated here because that's what was causing the integrity constraint violation? That error would have been due to the unique key on the 'hashtag' column, indicating that there was already a vocabulary with that machine name (normally the one we just added in statuses_tags_install()). That actually exposed a bug: I called the upgrade path after creating the new vocabulary when the upgrade path should have run first. Fixed in the attached patch (along with interdiffs to #27 and #28).

mathankumarc’s picture

Status: Needs review » Reviewed & tested by the community

Fantastic :)

I'm assuming the 'machine_name' field was removed from being updated here because that's what was causing the integrity constraint violation?

Yeah.

RTBC from my side :)

Still we need to consider deleting the entries for old schema in system table.

IceCreamYou’s picture

Status: Reviewed & tested by the community » Fixed

Committed fix to dev!

I created #1708256: Write release notes for 7.x-1.0-beta1 and once that is finished up we can tag and publish the release. (@mathankumarc, would you like to do the honors?)

Still we need to consider deleting the entries for old schema in system table.

Doesn't affect anything; might as well leave it. If we messed something up in the upgrade path I just committed, those system table records would let us know if FBSS had ever been installed previously, which we may need to know in order to fix things.

mathankumarc’s picture

@mathankumarc, would you like to do the honors?

Will do it happily :)

Doesn't affect anything; might as well leave it. If we messed something up in the upgrade path I just committed, those system table records would let us know if FBSS had ever been installed previously, which we may need to know in order to fix things.

Indeed. Didn't considered this one.

Status: Fixed » Closed (fixed)

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