Repository: wagtail/wagtail

Issue:
Page Copy, does not trigger page_published signal.
### Issue Summary

The `page_published` signal has been implemented, and when I go to copy a page and select "Publish Pages" I would expect this signal to get triggered during the copy. However it does not. 


### Steps to Reproduce

1. Assuming a basic project setup. 
2. implement a `page_published` signal following a similar guideline found here:
http://docs.wagtail.io/en/v2.1.1/reference/signals.html#page-published
3. Go to any page, and click "copy" then make sure "Publish Copied Page" is selected. 
4. The slack message will not be sent. 
5. I've implemented this a second way without the slack API as well, where Im simply trying to track the number of times a page was published. This is what that might look like:
```
from .models import HomePage
from .snippets import UsageStatistics

def track_published_pages(sender, **kwargs):

    page_instance = kwargs['instance']

    if page_instance.specific_class == HomePage:
        user = page_instance.owner

        stats, created = UsageStatistics.objects.get_or_create(page=page_instance,  user=user)

        if created:
            stats.published = 1
        else:
            stats.published += 1

        stats.save()


page_published.connect(track_published_pages)
```
6. This also doesn't trigger an update to the `UsageStatistics` model, like I would think it should. 

Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?

* I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: yes 

### Technical details

* Python version: 3.6.8
* Django version: 2.2.9
* Wagtail version: 2.7.1
* Browser version: Chrome 79



Discussion:

Resolving patch:
diff --git a/wagtail/core/models.py b/wagtail/core/models.py
--- a/wagtail/core/models.py
+++ b/wagtail/core/models.py
@@ -1866,6 +1866,12 @@ def copy(self, recursive=False, to=None, update_attrs=None, copy_revisions=True,
             page_copy.first_published_at = latest_revision_as_page_revision.created_at
             page_copy.save(clean=False)
 
+        if page_copy.live:
+            page_published.send(
+                sender=page_copy.specific_class, instance=page_copy,
+                revision=latest_revision_as_page_revision
+            )
+
         # Log
         if log_action:
             parent = specific_self.get_parent()


Test patch:
diff --git a/wagtail/core/tests/test_page_model.py b/wagtail/core/tests/test_page_model.py
--- a/wagtail/core/tests/test_page_model.py
+++ b/wagtail/core/tests/test_page_model.py
@@ -17,6 +17,7 @@
 
 from wagtail.core.models import (
     Locale, Page, PageManager, ParentNotTranslatedError, Site, get_page_models, get_translatable_models)
+from wagtail.core.signals import page_published
 from wagtail.tests.testapp.models import (
     AbstractPage, Advert, AlwaysShowInMenusPage, BlogCategory, BlogCategoryBlogPage, BusinessChild,
     BusinessIndex, BusinessNowherePage, BusinessSubIndex, CustomManager, CustomManagerPage,
@@ -1490,6 +1491,59 @@ def test_copy_unsaved_page(self):
         with self.assertRaises(RuntimeError):
             new_page.copy()
 
+    def test_copy_published_emits_signal(self):
+        """Test that copying of a published page emits a page_published signal."""
+        christmas_page = EventPage.objects.get(url_path='/home/events/christmas/')
+
+        signal_fired = False
+        signal_page = None
+
+        def page_published_handler(sender, instance, **kwargs):
+            nonlocal signal_fired
+            nonlocal signal_page
+            signal_fired = True
+            signal_page = instance
+
+        page_published.connect(page_published_handler)
+        copy_page = christmas_page.copy(
+            update_attrs={'title': "New christmas", 'slug': 'new-christmas'},
+        )
+
+        self.assertTrue(signal_fired)
+        self.assertEqual(signal_page, copy_page)
+
+    def test_copy_unpublished_not_emits_signal(self):
+        """Test that copying of an unpublished page not emits a page_published signal."""
+        homepage = Page.objects.get(url_path='/home/')
+        homepage.live = False
+        homepage.save()
+
+        signal_fired = False
+
+        def page_published_handler(sender, instance, **kwargs):
+            nonlocal signal_fired
+            signal_fired = True
+        page_published.connect(page_published_handler)
+
+        homepage.copy(update_attrs={'slug': 'new_slug'})
+        self.assertFalse(signal_fired)
+
+    def test_copy_keep_live_false_not_emits_signal(self):
+        """Test that copying of a live page with keep_live=False not emits a page_published signal."""
+        homepage = Page.objects.get(url_path='/home/')
+        signal_fired = False
+
+        def page_published_handler(sender, instance, **kwargs):
+            nonlocal signal_fired
+            signal_fired = True
+        page_published.connect(page_published_handler)
+
+        homepage.copy(
+            keep_live=False,
+            update_attrs={'slug': 'new_slug'}
+        )
+        self.assertFalse(signal_fired)
+
 
 class TestCopyForTranslation(TestCase):
     fixtures = ['test.json']