This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, Branch_5_3 has been updated
via f84a3bf303535a538a77cd5f3249a62e6ac001c0 (commit)
from 83343da5e0ba6ef7f16d4f8e57ff35303bfce133 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f84a3bf303535a538a77cd5f3249a62e6ac001c0
Author: Roland Mas <[email protected]>
Date: Mon Apr 27 14:48:33 2015 +0200
Fix [#681] project deletion fails if tools have been disabled (with
non-regression test)
diff --git a/src/CHANGES b/src/CHANGES
index 51304de..649ab4a 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -20,6 +20,7 @@ Fusionforge-5.3.3:
* Plugin MediaWiki: integrate e-mail from FusionForge account, to send
watchlist notifications (Inria)
* Plugin OSLC: Undefined index: is_public [#748] (TrivialDev)
* I18N: updated French translation (Stéphane Aulery and Inria)
+* Project deletaion: fix failure to delete project if tools have been deleted
[#681] (Roland Mas)
Fusionforge-5.3.2:
* Software map: fix "value too long for type character varying(255)" error in
cron db_trove_maint.php (Inria)
diff --git a/src/common/forum/ForumFactory.class.php
b/src/common/forum/ForumFactory.class.php
index dc25f40..d1540de 100644
--- a/src/common/forum/ForumFactory.class.php
+++ b/src/common/forum/ForumFactory.class.php
@@ -46,7 +46,7 @@ class ForumFactory extends Error {
*
* @param object $Group The Group object to which this forum is
associated.
*/
- function __construct(&$Group) {
+ function __construct(&$Group, $skip_check=false) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(_('No Valid Group Object'));
@@ -56,7 +56,7 @@ class ForumFactory extends Error {
$this->setError(_('Forum').'::
'.$Group->getErrorMessage());
return;
}
- if (!$Group->usesForum()) {
+ if (!$skip_check && !$Group->usesForum()) {
$this->setError(sprintf(_('%s does not use the Forum
tool.'),
$Group->getPublicName()));
return;
diff --git a/src/common/include/Group.class.php
b/src/common/include/Group.class.php
index 131dfd6..3d05e8a 100644
--- a/src/common/include/Group.class.php
+++ b/src/common/include/Group.class.php
@@ -1666,52 +1666,47 @@ class Group extends Error {
//
// Delete Trackers
//
- if ($this->usesTracker()) {
- $atf = new ArtifactTypeFactory($this);
- $at_arr = $atf->getArtifactTypes();
- foreach ($at_arr as $i) {
- if (!is_object($i)) {
- continue;
- }
- if (!$i->delete(1,1)) {
- $this->setError(_('Could not properly
delete the tracker:').' '.$i->getErrorMessage());
- return false;
- }
+ $atf = new ArtifactTypeFactory($this, true);
+ $at_arr = $atf->getArtifactTypes();
+ foreach ($at_arr as $i) {
+ if (!is_object($i)) {
+ continue;
+ }
+ if (!$i->delete(1,1)) {
+ $this->setError(_('Could not properly delete
the tracker:').' '.$i->getErrorMessage());
+ return false;
}
}
//
// Delete Forums
//
-
- if ($this->usesForum()) {
- $ff = new ForumFactory($this);
- $f_arr = $ff->getForums();
- foreach ($f_arr as $i) {
- if (!is_object($i)) {
- continue;
- }
- if(!$i->delete(1,1)) {
- $this->setError(_('Could not properly
delete the forum:').' '.$i->getErrorMessage());
- return false;
- }
+ $ff = new ForumFactory($this, true);
+ $f_arr = $ff->getForums();
+ foreach ($f_arr as $i) {
+ if (!is_object($i)) {
+ continue;
+ }
+ if(!$i->delete(1,1)) {
+ $this->setError(_('Could not properly delete
the forum:').' '.$i->getErrorMessage());
+ return false;
}
}
+
//
// Delete Subprojects
//
- if ($this->usesPM()) {
- $pgf = new ProjectGroupFactory($this);
- $pg_arr = $pgf->getProjectGroups();
- foreach ($pg_arr as $i) {
- if (!is_object($i)) {
- continue;
- }
- if (!$i->delete(1,1)) {
- $this->setError(_('Could not properly
delete the ProjectGroup:').' '.$i->getErrorMessage());
- return false;
- }
+ $pgf = new ProjectGroupFactory($this, true);
+ $pg_arr = $pgf->getProjectGroups();
+ foreach ($pg_arr as $i) {
+ if (!is_object($i)) {
+ continue;
+ }
+ if (!$i->delete(1,1)) {
+ $this->setError(_('Could not properly delete
the ProjectGroup:').' '.$i->getErrorMessage());
+ return false;
}
}
+
//
// Delete FRS Packages
//
@@ -1822,22 +1817,20 @@ class Group extends Error {
//
// Delete Surveys
//
- if ($this->usesSurvey()) {
- $sf = new SurveyFactory($this);
- $s_arr =& $sf->getSurveys();
- foreach ($s_arr as $i) {
- if (!is_object($i)) {
- continue;
- }
- if (!$i->delete()) {
- $this->setError(_('Could not properly
delete the survey'));
- db_rollback();
- return false;
- }
+ $sf = new SurveyFactory($this, true);
+ $s_arr =& $sf->getSurveys();
+ foreach ($s_arr as $i) {
+ if (!is_object($i)) {
+ continue;
}
- //
- // Delete SurveyQuestions
- //
+ if (!$i->delete()) {
+ $this->setError(_('Could not properly delete
the survey'));
+ db_rollback();
+ return false;
+ }
+ //
+ // Delete SurveyQuestions
+ //
$sqf = new SurveyQuestionFactory($this);
$sq_arr = $sqf->getSurveyQuestions();
if (is_array($sq_arr)) {
@@ -1856,18 +1849,16 @@ class Group extends Error {
//
// Delete Mailing List Factory
//
- if ($this->usesMail()) {
- $mlf = new MailingListFactory($this);
- $ml_arr = $mlf->getMailingLists();
- foreach ($ml_arr as $i) {
- if (!is_object($i)) {
- continue;
- }
- if (!$i->delete(1,1)) {
- $this->setError(_('Could not properly
delete the mailing list'));
- db_rollback();
- return false;
- }
+ $mlf = new MailingListFactory($this, true);
+ $ml_arr = $mlf->getMailingLists();
+ foreach ($ml_arr as $i) {
+ if (!is_object($i)) {
+ continue;
+ }
+ if (!$i->delete(1,1)) {
+ $this->setError(_('Could not properly delete
the mailing list'));
+ db_rollback();
+ return false;
}
}
//
diff --git a/src/common/mail/MailingListFactory.class.php
b/src/common/mail/MailingListFactory.class.php
index d7ad811..0113120 100644
--- a/src/common/mail/MailingListFactory.class.php
+++ b/src/common/mail/MailingListFactory.class.php
@@ -47,7 +47,7 @@ class MailingListFactory extends Error {
*
* @param Group $Group The Group object to which these mailing
lists are associated.
*/
- function __construct(& $Group) {
+ function __construct(&$Group, $skip_check=false) {
$this->Error();
if (!$Group || !is_object($Group)) {
@@ -58,7 +58,7 @@ class MailingListFactory extends Error {
$this->setError('MailingListFactory::
'.$Group->getErrorMessage());
return;
}
- if (!$Group->usesMail()) {
+ if (!$skip_check && !$Group->usesMail()) {
$this->setError(sprintf(_('%s does not use the
Mailing-list tool'),
$Group->getPublicName()));
return;
diff --git a/src/common/pm/ProjectGroupFactory.class.php
b/src/common/pm/ProjectGroupFactory.class.php
index 3b0112b..848fc10 100644
--- a/src/common/pm/ProjectGroupFactory.class.php
+++ b/src/common/pm/ProjectGroupFactory.class.php
@@ -48,7 +48,7 @@ class ProjectGroupFactory extends Error {
* @param Group $Group The Group object to which this
ProjectGroupFactory is associated.
* @return \ProjectGroupFactory
*/
- function __construct(&$Group) {
+ function __construct(&$Group, $skip_check=false) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(_('No Valid Group Object'));
@@ -58,7 +58,7 @@ class ProjectGroupFactory extends Error {
$this->setError('ProjectGroup::
'.$Group->getErrorMessage());
return;
}
- if (!$Group->usesPM()) {
+ if (!$skip_check && !$Group->usesPM()) {
$this->setError(sprintf(_('%s does not use the Project
Management tool'),
$Group->getPublicName()));
return;
diff --git a/src/common/survey/SurveyFactory.class.php
b/src/common/survey/SurveyFactory.class.php
index 1a8bf2a..8ca6143 100644
--- a/src/common/survey/SurveyFactory.class.php
+++ b/src/common/survey/SurveyFactory.class.php
@@ -48,7 +48,7 @@ class SurveyFactory extends Error {
*
* @param object $Group The Group object to which this survey
is associated.
*/
- function __construct(&$Group) {
+ function __construct(&$Group, $skip_check=false) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(_('No Valid Group Object'));
@@ -59,7 +59,7 @@ class SurveyFactory extends Error {
$this->setError(_('Survey').'::
'.$Group->getErrorMessage());
return;
}
- if (!$Group->usesSurvey()) {
+ if (!$skip_check && !$Group->usesSurvey()) {
$this->setError(sprintf(_('%s does not use the Survey
tool'),
$Group->getPublicName()));
return;
diff --git a/src/common/tracker/ArtifactTypeFactory.class.php
b/src/common/tracker/ArtifactTypeFactory.class.php
index 8a93bf2..0b6dfa9 100644
--- a/src/common/tracker/ArtifactTypeFactory.class.php
+++ b/src/common/tracker/ArtifactTypeFactory.class.php
@@ -53,7 +53,7 @@ class ArtifactTypeFactory extends Error {
*
* @param Group $Group The Group object to which this
ArtifactTypeFactory is associated
*/
- function __construct(&$Group) {
+ function __construct(&$Group, $skip_check=false) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(_('No Valid Group Object'));
@@ -63,7 +63,7 @@ class ArtifactTypeFactory extends Error {
$this->setError('ArtifactTypeFactory:
'.$Group->getErrorMessage());
return;
}
- if (!$Group->usesTracker()) {
+ if (!$skip_check && !$Group->usesTracker()) {
$this->setError(sprintf(_('%s does not use the Tracker
tool'),
$Group->getPublicName()));
return;
diff --git a/tests/func/Site/projectsTest.php b/tests/func/Site/projectsTest.php
index 36c8062..7399f98 100755
--- a/tests/func/Site/projectsTest.php
+++ b/tests/func/Site/projectsTest.php
@@ -205,7 +205,8 @@ class CreateProject extends FForge_SeleniumTestCase
// Test removal of project.
function testRemoveProject()
{
- $this->login(FORGE_ADMIN_USERNAME);
+ $this->populateStandardTemplate('trackers');
+ $this->init();
// Create project as a different user
// Non-regression test for Adacore ticket K720-005
@@ -239,6 +240,28 @@ class CreateProject extends FForge_SeleniumTestCase
$this->click("link=Home");
$this->waitForPageToLoad("30000");
$this->assertFalse($this->isTextPresent("testal1"));
+
+ // Non-regression test for bug #681
+ $this->gotoProject('ProjectA');
+ $this->clickAndWait("link=Admin");
+ $this->clickAndWait("link=Tools");
+ $this->uncheck("//input[@name='use_tracker']") ;
+ $this->uncheck("//input[@name='use_forum']") ;
+ $this->uncheck("//input[@name='use_pm']") ;
+ $this->uncheck("//input[@name='use_survey']") ;
+ $this->uncheck("//input[@name='use_mail']") ;
+ $this->clickAndWait("submit");
+
+ $this->clickAndWait("link=Site Admin");
+ $this->clickAndWait("link=Display Full Project List/Edit
Projects");
+ $this->clickAndWait("link=ProjectA");
+ $this->clickAndWait("link=Permanently Delete Project");
+ $this->click("sure");
+ $this->click("reallysure");
+ $this->click("reallyreallysure");
+ $this->clickAndWait("submit");
+ $this->clickAndWait("link=Home");
+ $this->assertFalse($this->isTextPresent("ProjectA"));
}
}
-----------------------------------------------------------------------
Summary of changes:
src/CHANGES | 1 +
src/common/forum/ForumFactory.class.php | 4 +-
src/common/include/Group.class.php | 113 ++++++++++------------
src/common/mail/MailingListFactory.class.php | 4 +-
src/common/pm/ProjectGroupFactory.class.php | 4 +-
src/common/survey/SurveyFactory.class.php | 4 +-
src/common/tracker/ArtifactTypeFactory.class.php | 4 +-
tests/func/Site/projectsTest.php | 25 ++++-
8 files changed, 87 insertions(+), 72 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits