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

Issue fork og-1862702

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

Code in branch 1862702

amitaibu’s picture

Status: Active » Needs review
FileSize
4.87 KB

Uploading for testbot -- needs tests

amitaibu’s picture

FileSize
6.23 KB

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

amitaibu’s picture

amitaibu’s picture

FileSize
7.02 KB

Correct patch...

RoySegall’s picture

FileSize
10.16 KB

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

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

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

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

akolahi made their first commit to this issue’s fork.