View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0011009 | mantisbt | sub-projects | public | 2009-10-06 16:06 | 2009-11-02 13:49 |
| Reporter | watergad | Assigned To | |||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | new | Resolution | open | ||
| Product Version | 1.2.0rc1 | ||||
| Summary | 0011009: Different subproject isolation | ||||
| Description | Continuing talks about hierarchy support ( http://www.mantisbt.org/bugs/view.php?id=11002 ). If we have different projects with subprojects, why must they have different names?
Two isolated Development subprojects, why not? It's not the solution - to invent some kind of prefixes-postfixes for similar subprojects. And the whole idea of making UNIQUE index of just a Display name looks not good at all. Of course we'll have name duplicates when we break links between subprojects and the parent project (if we have zero-level project with the same name). But why not to warn at this stage? I believe its definitely necessary feature when running multiple independence similar projects in one Mantis instance. | ||||
| Tags | No tags attached. | ||||
| Attached Files | mantis_multiproject_project_api.txt (2,673 bytes)
// Watergad: multiproject instance addition
# check to see if project exists by name
function project_is_name_unique_h( $p_name, $parent_id ) {
$t_project_table = db_get_table( 'mantis_project_table' );
$t_mantis_project_hierarchy_table = db_get_table( 'mantis_project_hierarchy_table' );
$query = "SELECT COUNT(*)
FROM $t_project_table p
LEFT JOIN $t_mantis_project_hierarchy_table h
ON p.id=h.child_id
WHERE name=" . db_param() . "
AND (h.parent_id = " . db_param() . " OR
(h.parent_id IS NULL AND null IS NULL))";
// $result = db_query_bound( $query, Array( $p_name ) );
$result = db_query_bound( $query, Array( $p_name, $parent_id ) );
if( 0 == db_result( $result ) ) {
return true;
} else {
return false;
}
}
// Watergad: multiproject instance addition
# check to see if project exists by id
# if it doesn't exist then error
# otherwise let execution continue undisturbed
function project_ensure_name_unique_h( $p_name, $parent_id ) {
if( !project_is_name_unique_h( $p_name, $parent_id ) ) {
trigger_error( ERROR_PROJECT_NAME_NOT_UNIQUE, ERROR );
}
}
// Watergad: multiproject instance addition
# Create a new project
function project_create_h( $p_name, $parent_id, $p_description, $p_status, $p_view_state = VS_PUBLIC, $p_file_path = '', $p_enabled = true, $p_inherit_global = true ) {
// Watergad: parent_id set with nvl of '0' so returning it to the null value if necessary. Stupid hard-coded tweak.
if( $parent_id == 0 ) $parent_id = null;
$c_enabled = db_prepare_bool( $p_enabled );
$c_inherit_global = db_prepare_bool( $p_inherit_global );
if( is_blank( $p_name ) ) {
trigger_error( ERROR_PROJECT_NAME_INVALID, ERROR );
}
// project_ensure_name_unique( $p_name );
// Watergad: we use our multiproject analog here
project_ensure_name_unique_h( $p_name, $parent_id );
if( !is_blank( $p_file_path ) ) {
# Make sure file path has trailing slash
$p_file_path = terminate_directory_path( $p_file_path );
file_ensure_valid_upload_path( $p_file_path );
}
$t_project_table = db_get_table( 'mantis_project_table' );
$query = "INSERT INTO $t_project_table
( name, status, enabled, view_state, file_path, description, inherit_global )
VALUES
( " . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ')';
db_query_bound( $query, Array( $p_name, (int) $p_status, $c_enabled, (int) $p_view_state, $p_file_path, $p_description, $c_inherit_global ) );
# return the id of the new project
return db_insert_id( $t_project_table );
}
| ||||
|
I've added tweaked functions from project_api to create same name projects. Have to change mantis_project_table index for name from UNIQUE to INDEX. Please let us know if it's too bad idea and many problems will appear because of non-UNIQUE index. But the solution of some kind is urgent for scalability. I'm quite confused how to make a good multiproject Mantis now. Can I go the described way? |
|