-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blank page created when duplicating a page in 3.1 beta 3 #689
Comments
… in 2.4 See ticket #7602 Conflicts: javascript/CMSMain.Tree.js templates/Includes/CMSMain_TreeView.ss
Duplicating the page creates a blank duplicate also exists in the latest release SS 3.1.0 Beta3. Also the duplicate this and sub pages do not duplicate the sub pages.... |
I can confirm the problem in SilverStripe-3.1.x-dev Steps to reproduce the problem:
What did you expect? Besides the duplicate, no additional (blank) page should've been created. |
I think the patch underneath fixes the problem of the additional blank page: framework$ git diff
diff --git a/model/DataObject.php b/model/DataObject.php
index fc5fb6b..9b54d95 100644
--- a/model/DataObject.php
+++ b/model/DataObject.php
@@ -491,7 +491,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
}
}
} else { //one-to-one relation
- $destinationObject->$name = $relations;
+ // Is this the Page.Parent relation to the SiteTree-root?
+ // NOTE: This conditional prevents creation of blank page when
+ // duplicating page under root (GitHub issue #689)
+ if (! ($name == 'Parent' && $sourceObject instanceOf Page && $relations instanceOf SiteTree)) {
+ // No, this is not the Page.Parent-relation to the SiteTree-root;
+ // Duplicate relation
+ $destinationObject->$name = $relations;
+ }
}
}
} |
Thanks a lot this is working perfect.. Thanks a looootttt... But have issue with Duplicate this page and subpage also.. For ex : Now when i choose to duplicate this page and its subpages ite generates the above error and the page goes blank.. When i refresh to admin/pages the page duplicated in the below given manner -->Home /// The main parent page which was chosen to create duplicate -->Home /// Duplicated Parent created Your help is really needed.. I am trying this since past few weeks but didnt get the issue... Thanks in advance... |
I can't reproduce the problem. I don't get an error. I get a messagebox saying "Duplicated 'Home' and children succesfully". I have tested using plain SilverStripe-3.1.x-dev branch using these steps:
The output is as I expected: I'm redirected to an edit page of the duplicated Home. Only bug is that I need to refresh or flush to see the duplicated subpage in the hierarchy. After duplicating and refresh/flush my tree looks like this: Home |- TestPage About Us Contact Us Page not found Server error Home DRAFT # Duplicated page |- TestPage DRAFT # Duplicated subpage The url you sent needs a login/password? The error you sent makes me think your database primary key sequence is out of sync with the real ID's stored in the database table. Can you give it a try with a clean database? |
Actually that is the URL which is generated when i click on the Duplicate this and its sub pages and all page goes blank.. Sserrors.txt have the above mentioned error. I tried emptying the database but i don't exactly know which tables to truncate.. So that rest of the things wont get affected.. If i empty the whole db and then dev/build.. And when i try to run the pages there is an error "Error While Connecting to Db".. Can u please tell me few particular tables which are related with the above errors.. |
I think these tables are used concerning the SiteTree:
Maybe you can try doing a manual sql INSERT on the tables to see if the primary keys work. |
Thanks for your such a great support.. I tried truncating the tables which u mentioned above.. This time i got a different error in the sserrors.. I got something like this : |
Can you try if you get the same error with a clean checkout of SilverStripe-3.1, the latest beta? Then we know if the error is in your project code or in SilverStripe. If the error is in your code we should continue this thread elsewhere I think, maybe in the forum. |
No i am not getting this on a new installation of SilverStripe-3.1.. I tried this before opening this thread.. Still i am unable to figure this one out.. I know that helping this way would become quite difficult. Coz u wont get exactly what the issue is.. Is there any other way to figure out this.. One more better option is that i upgrade my system, but if i upgrade i will loose all my changes and will have to do them back.. Thanks... |
I've singled out the issue with subpages not appearing until a hard refresh into issue #763. The original "ghost page" issue has been fixed a while ago. On the primary key error, this seems to be an issue with your specific database which is impossible for us to track down, so I'm closing this. If you can single out how the inconsistent state in your database was created in the first place (and SS is the culprit), feel free to open another more specific issue. |
If the "ghost page" issue has been fixed a while ago, how come I experienced the problem in the latest SilverStripe-3.1.x-dev checkout? |
You're correct, I've confused this with a different fix (silverstripe/silverstripe-framework@67d1327). Submitted a pull request to fix the ghost page behaviour with silverstripe/silverstripe-framework#2054 |
This caused problems when duplicate() was used in the CMS UI to duplicate a SiteTree object. Since every object of this type has a ParentID relation, it copied this empty relation into new "ghost page". See silverstripe/silverstripe-cms#689
In beta 3 of 3.1 and were excited to see the duplicate feature back. One problem we see though is that when we duplicate a page is creates a ghost page that we see after we refresh.
Browser: Firefox 20 and Safari 6.03
The text was updated successfully, but these errors were encountered: