Solution should be scalable, so we need to do it via cron or advanced-queue module.

Files: 
CommentFileSizeAuthor
#18 1862702-og-queue-18.patch13.04 KBRoySegall
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]
#16 1862702-og-queue-16.patch12.88 KBRoySegall
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]
#12 1862702-og-queue-12.patch7.02 KBRoySegall
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]
#9 1862702-og-queue-9.patch10.25 KBRoySegall
FAILED: [[SimpleTest]]: [MySQL] 732 pass(es), 2 fail(s), and 0 exception(s).
[ View ]
#6 1862702-og-queue-6.patch10.16 KBRoySegall
FAILED: [[SimpleTest]]: [MySQL] 732 pass(es), 2 fail(s), and 0 exception(s).
[ View ]
#5 1862702-og-queue-5.patch7.02 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]
#4 1862702-og-queue-4.patch2.68 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]
#4 Screenshot 12:11:12 1:21 PM.png76.37 KBAmitaibu
#3 1862702-og-queue-3.patch6.23 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]
#2 1862702-og-queue-2.patch4.87 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

Comments

Code in branch 1862702

Status:Active» Needs review
StatusFileSize
new4.87 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

Uploading for testbot -- needs tests

StatusFileSize
new6.23 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

Patch allows also to move orphan group-content to another group.

StatusFileSize
new76.37 KB
new2.68 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

Added UI
21 PM.png

StatusFileSize
new7.02 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

Correct patch...

StatusFileSize
new10.16 KB
FAILED: [[SimpleTest]]: [MySQL] 732 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

Added test for the deleting orphan and fix a bug: content which relate to more then one groups is getting deleted.

Status:Needs review» Needs work

The last submitted patch, 1862702-og-queue-6.patch, failed testing.

+++ b/og.moduleundefined
@@ -1518,14 +1518,171 @@ function og_membership_delete_multiple($ids = array()) {
+    if (count($entity_groups) == 1) {

Add comment why we do this.

+++ b/og.testundefined
@@ -1512,3 +1512,91 @@ class OgBehaviorHandlerTestCase  extends DrupalWebTestCase {
+      'group' => 'Organic groups',

Add 'dependencies' => array('advancedqueue');

+++ b/og.testundefined
@@ -1512,3 +1512,91 @@ class OgBehaviorHandlerTestCase  extends DrupalWebTestCase {
+  function testDeleteGroup() {

Add PHPdocs.

+++ b/og.testundefined
@@ -1512,3 +1512,91 @@ class OgBehaviorHandlerTestCase  extends DrupalWebTestCase {
+    $first_group = (object) array(

Use $this->drupalCreateNode().

+++ b/og.testundefined
@@ -1512,3 +1512,91 @@ class OgBehaviorHandlerTestCase  extends DrupalWebTestCase {
+    $wrapper = entity_metadata_wrapper('node', $first_node);

Don't use the wrapper. Use og_group() instead.

+++ b/og.testundefined
@@ -1512,3 +1512,91 @@ class OgBehaviorHandlerTestCase  extends DrupalWebTestCase {
+    // Active the queue.

"Execute manually the queue worker."

+++ b/og.testundefined
@@ -1512,3 +1512,91 @@ class OgBehaviorHandlerTestCase  extends DrupalWebTestCase {
+    $this->assert(!empty($first_node), "The second node is realted to another group and deleted.");

$this->assert($first_node, 'Non-orphan group content not deleted.');

StatusFileSize
new10.25 KB
FAILED: [[SimpleTest]]: [MySQL] 732 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

I run the tests at my local drupal and it's work ok.

Applied fixes.

Status:Needs work» Needs review

Change status.

Status:Needs review» Needs work

The last submitted patch, 1862702-og-queue-9.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new7.02 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

I returned the dependencies for the getInfo().

Great. Next test is the "move" feature.
You will need to set the orphan property via hook_entity_delete() in og_test_module

Status:Needs review» Fixed

Committed, thanks.

Status:Fixed» Needs work

Test is missing from tets, reverted commit.

Status:Needs work» Needs review
StatusFileSize
new12.88 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

I added the missing test and worked on the test for moving the nodes to another group.

Status:Needs review» Needs work

+++ b/og.testundefined
@@ -1568,3 +1568,105 @@ class OgBehaviorHandlerTestCase  extends DrupalWebTestCase {
+    // Create a group and relate it to one group.

=> to first group

+++ b/tests/og_test.moduleundefined
@@ -8,9 +8,55 @@
+    ->propertyCondition('nid', $entity->nid, '<>')

Add docs.

Status:Needs work» Needs review
StatusFileSize
new13.04 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

Status:Needs review» Fixed

Committed, thanks.

Thanks all, this seems to work great!

One thing that I'm not personally quite sure how to fix without a SQL statement is that it seems that when I delete groups, the "og_membership" table doesn't seem to get updated and I get a blank entries in Views when using the "OG membership: Group Node from OG membership" relationship for users. It's not difficult to hide them, but I wanted to throw it out there.

Thanks again

Status:Fixed» Closed (fixed)

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