[Not a bug] deleting a default design is possible

Forum rules
Only administrators can post or move items here.
Post Reply
bess
Language Partners
Language Partners
Posts: 282
Joined: Thu Dec 18, 2008 9:37 am
Location: Bretagne

[Not a bug] deleting a default design is possible

Post by bess »

there is no test in the code so it is possible to delete the default design

Code: Select all

$design = CmsLayoutCollection::load("the default design");
$design->delete();
After that you can't do anything more : modify page or setting a new "default" design will display this error :
Fatal error: Uncaught exception 'CmsInvalidDataException' with message 'There is no default design selected' in D:\www\forge2\lib\classes\class.CmsLayoutCollection.php on line 657
( ! ) CmsInvalidDataException: There is no default design selected in D:\www\forge2\lib\classes\class.CmsLayoutCollection.php on line 657
Call Stack
# Time Memory Function Location
1 0.0022 280368 {main}( ) ..\moduleinterface.php:0
2 0.2693 9017720 CMSModule->DoActionBase( ) ..\moduleinterface.php:76
3 0.2694 9020776 DesignManager->DoAction( ) ..\class.CMSModule.php:1446
4 0.2695 9020896 CMSModule->DoAction( ) ..\DesignManager.module.php:56
5 0.2709 9111424 include( 'D:\www\forge2\modules\DesignManager\action.defaultadmin.php' ) ..\class.CMSModule.php:1382
6 0.2773 9414744 CmsLayoutCollection::load_default( ) ..\action.defaultadmin.php:58
my solution : editing the database directly

deleting a default design (or tpl / ...) should be forbidden and throwing an exception ;)
Last edited by bess on Mon Apr 20, 2015 6:15 pm, edited 1 time in total.
bess
Language Partners
Language Partners
Posts: 282
Joined: Thu Dec 18, 2008 9:37 am
Location: Bretagne

Re: [major] deleting a default design is possible

Post by bess »

in the same way : we don't check if the design / tpl is used by a page (if type = core::page) but i'm not sure you want to do this. ;)
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: [major] deleting a default design is possible

Post by calguy1000 »

I don't think that all of these decisions and checks are needed in the API's. It's more of an application level issue if the user can delete the default design (the design manager doesn't let you do this).

As well, the application level should check to see if the design is in use on any pages before letting you delete it, etc. but that check doesn't need to be in the API's.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
bess
Language Partners
Language Partners
Posts: 282
Joined: Thu Dec 18, 2008 9:37 am
Location: Bretagne

Re: [major] deleting a default design is possible

Post by bess »

since it's not a feature forgotten, i'm okay with that :)
Post Reply

Return to “Closed Issues”