issue 2705 when delete last instance of layout, layout uninstall also

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12275 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-11-21 08:49:51 +00:00
parent 02c0909e26
commit 41fc5be074
4 changed files with 56 additions and 11 deletions

View file

@ -276,7 +276,21 @@ class layoutAdminController extends layout
$layoutList = $oLayoutModel->getLayoutInstanceList($layoutInfo->site_srl, $layoutInfo->layout_type, $layoutInfo->layout, array('layout_srl'));
if(count($layoutList) <= 1)
{
return new Object(-1, 'msg_at_least_one_layout');
// uninstall package
$path = $layoutInfo->path;
$oAutoinstallModel = &getModel('autoinstall');
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($path);
$oAutoinstallAdminController = &getAdminController('autoinstall');
if($packageSrl)
{
$oAutoinstallAdminController->uninstallPackageByPackageSrl($packageSrl);
}
else
{
$oAutoinstallAdminController->uninstallPackageByPath($path);
}
}
}
}