Ejemplo n.º 1
0
/**
 * delete the config entry
 *
 * @param integer $p_project A project identifier.
 * @return void
 */
function config_delete_project($p_project = ALL_PROJECTS)
{
    $t_query = 'DELETE FROM {config} WHERE project_id=' . db_param();
    db_query($t_query, array($p_project));
    # flush cache here in case some of the deleted configs are in use.
    config_flush_cache();
}
Ejemplo n.º 2
0
        exit;
    }
}
$t_failed_ids = array();
if (0 != $f_custom_field_id) {
    $t_custom_field_def = custom_field_get_definition($f_custom_field_id);
}
foreach ($f_bug_arr as $t_bug_id) {
    bug_ensure_exists($t_bug_id);
    $t_bug = bug_get($t_bug_id, true);
    if ($t_bug->project_id != helper_get_current_project()) {
        # in case the current project is not the same project of the bug we are viewing...
        # ... override the current project. This to avoid problems with categories and handlers lists etc.
        $g_project_override = $t_bug->project_id;
        # @todo (thraxisp) the next line goes away if the cache was smarter and used project
        config_flush_cache();
        # flush the config cache so that configs are refetched
    }
    $t_status = $t_bug->status;
    switch ($f_action) {
        case 'CLOSE':
            $t_closed = config_get('bug_closed_status_threshold');
            if (access_can_close_bug($t_bug)) {
                if ($t_status < $t_closed && bug_check_workflow($t_status, $t_closed)) {
                    # @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) );
                    bug_close($t_bug_id, $f_bug_notetext, $f_bug_noteprivate);
                    helper_call_custom_function('issue_update_notify', array($t_bug_id));
                } else {
                    $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_status');
                }
            } else {
Ejemplo n.º 3
0
function config_delete_project( $p_project = ALL_PROJECTS ) {
	global $g_cache_config, $g_cache_config_access;
	$t_config_table = db_get_table( 'config' );
	$c_project = db_prepare_int( $p_project );
	$query = "DELETE FROM $t_config_table
				WHERE project_id=" . db_param();

	$result = @db_query_bound( $query, Array( $c_project ) );

	# flush cache here in case some of the deleted configs are in use.
	config_flush_cache();
}
/**
 * Schema update to migrate config data from php serialization to json.
 * This ensures it is not possible to execute code during un-serialization
 */
function install_check_config_serialization()
{
    $query = 'SELECT * FROM {config} WHERE type=3';
    $t_result = db_query($query);
    while ($t_row = db_fetch_array($t_result)) {
        $config_id = $t_row['config_id'];
        $project_id = (int) $t_row['project_id'];
        $user_id = (int) $t_row['user_id'];
        $value = $t_row['value'];
        $t_config = unserialize($value);
        if ($t_config === false) {
            return 1;
            # Fatal: invalid data found in config table
        }
        $t_json_config = json_encode($t_config);
        $t_query = 'UPDATE {config} SET value=' . db_param() . ' WHERE config_id=' . db_param() . ' AND project_id=' . db_param() . ' AND user_id=' . db_param();
        db_query($t_query, array($t_json_config, $config_id, $project_id, $user_id));
    }
    # flush config here as we've changed the format of the configuration table
    config_flush_cache();
    # Return 2 because that's what ADOdb/DataDict does when things happen properly
    return 2;
}
Ejemplo n.º 5
0
function config_delete_project($p_project = ALL_PROJECTS)
{
    global $g_cache_config, $g_cache_config_access;
    $t_config_table = config_get_global('mantis_config_table');
    $c_project = db_prepare_int($p_project);
    $query = "DELETE FROM {$t_config_table}\r\n\t\t\t\tWHERE project_id={$c_project}";
    $result = @db_query($query);
    # flush cache here in case some of the deleted configs are in use.
    config_flush_cache();
}
Ejemplo n.º 6
0
$t_failed_ids = array();

if ( 0 != $f_custom_field_id ) {
	$t_custom_field_def = custom_field_get_definition( $f_custom_field_id );
}

foreach( $f_bug_arr as $t_bug_id ) {
	bug_ensure_exists( $t_bug_id );
	$t_bug = bug_get( $t_bug_id, true );

	if( $t_bug->project_id != helper_get_current_project() ) {
		# in case the current project is not the same project of the bug we are viewing...
		# ... override the current project. This to avoid problems with categories and handlers lists etc.
		$g_project_override = $t_bug->project_id;
		/** @todo (thraxisp) the next line goes away if the cache was smarter and used project */
		config_flush_cache(); # flush the config cache so that configs are refetched
	}

	$t_status = $t_bug->status;

	switch ( $f_action ) {

	case 'CLOSE':
		$t_closed = config_get( 'bug_closed_status_threshold' );
		if ( access_can_close_bug( $t_bug_id ) &&
				( $t_status < $t_closed ) &&
				bug_check_workflow( $t_status, $t_closed ) ) {

			/** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) ); */
			bug_close( $t_bug_id, $f_bug_notetext, $f_bug_noteprivate );
			helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
Ejemplo n.º 7
0
/**
 * delete the config entry
 *
 * @param int $p_project project id
 */
function config_delete_project($p_project = ALL_PROJECTS)
{
    $t_config_table = db_get_table('config');
    $query = "DELETE FROM {$t_config_table}\n\t\t\t\tWHERE project_id=" . db_param();
    $result = db_query_bound($query, array($p_project));
    # flush cache here in case some of the deleted configs are in use.
    config_flush_cache();
}