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

amitaibu’s picture

Code in branch 1862702

amitaibu’s picture

Status: Active » Needs review
FileSize
4.87 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es). View

Uploading for testbot -- needs tests

amitaibu’s picture

FileSize
6.23 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es). View

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

amitaibu’s picture

FileSize
76.37 KB
2.68 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es). View

Added UI
21 PM.png

amitaibu’s picture

FileSize
7.02 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es). View

Correct patch...

RoySegall’s picture

FileSize
10.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.

amitaibu’s picture

+++ 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.');

RoySegall’s picture

FileSize
10.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.

RoySegall’s picture

Status: Needs work » Needs review

Change status.

Status: Needs review » Needs work

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

RoySegall’s picture

Status: Needs work » Needs review
FileSize
7.02 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es). View

I returned the dependencies for the getInfo().

amitaibu’s picture

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

amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

amitaibu’s picture

Status: Fixed » Needs work

Test is missing from tets, reverted commit.

RoySegall’s picture

Status: Needs work » Needs review
FileSize
12.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.

amitaibu’s picture

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.

RoySegall’s picture

Status: Needs work » Needs review
FileSize
13.04 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es). View
amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

el1_1el’s picture

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.