Skip to content

Commit fffeb84

Browse files
committed
Revert "[m1553] Don't use hardcoded default prefix/suffix for mantis table names"
This reverts commit 795ec7c. REGRESSION: the sqlWrapper replaces all '{' and '}' , but these characters exists in json strings and should not be converted. so only table names should be converted, not field values :-( Conflicts: classes/constants.class.php
1 parent 99f9d65 commit fffeb84

51 files changed

Lines changed: 339 additions & 418 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

admin/edit_team.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ protected function display() {
320320
private function getTeamMembers($teamid) {
321321
$query = "SELECT user.id as user_id, user.username, user.realname, ".
322322
"team_user.id, team_user.arrival_date, team_user.departure_date, team_user.team_id, team_user.access_level ".
323-
"FROM `{user}` as user ".
323+
"FROM `mantis_user_table` as user ".
324324
"JOIN `codev_team_user_table` as team_user ON user.id = team_user.user_id ".
325325
"WHERE team_user.team_id=$teamid ".
326326
"ORDER BY user.username;";
@@ -353,7 +353,7 @@ private function getTeamMembers($teamid) {
353353
private function getTeamProjects($teamid) {
354354
$query = "SELECT project.id AS project_id, project.name, project.enabled, project.description, ".
355355
"team_project.id, team_project.type ".
356-
"FROM `{project}` as project ".
356+
"FROM `mantis_project_table` as project ".
357357
"JOIN `codev_team_project_table` as team_project ON project.id = team_project.project_id ".
358358
"WHERE team_project.team_id=$teamid ".
359359
"ORDER BY project.name;";
@@ -415,7 +415,7 @@ private function getOnDutyCandidates(Team $team, array $projList) {
415415

416416
$formatedInactivityCatList = implode( ', ', array_keys($inactivityCatList));
417417

418-
$query = "SELECT * FROM `{bug}` ".
418+
$query = "SELECT * FROM `mantis_bug_table` ".
419419
"WHERE project_id IN ($formatedInactivityCatList) ";
420420

421421
$astreintesList = $team->getOnDutyTasks();

classes/Email.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private function email_queue_add( EmailData $emailData ) {
143143
$c_body = SqlWrapper::sql_real_escape_string($emailData->body);
144144
$c_metadata = serialize( $emailData->metadata );
145145

146-
$query = "INSERT INTO `{email}` (`email`, `subject`, `body`, `submitted`, `metadata`) ".
146+
$query = "INSERT INTO `mantis_email_table` (`email`, `subject`, `body`, `submitted`, `metadata`) ".
147147
"VALUES ('$c_email', '$c_subject', '$c_body', ".$emailData->submitted.", '$c_metadata');";
148148
#echo "queue email: $query<br>";
149149
$result = SqlWrapper::getInstance()->sql_query($query);

classes/command.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public static function getCommandId($name) {
274274
* parse all Commands for issues not found in mantis_bug_table. if any, remove them from the Commands.
275275
*/
276276
public static function checkCommands() {
277-
$query0 = "SELECT command_id, bug_id FROM codev_command_bug_table WHERE bug_id NOT IN (SELECT id FROM {bug})";
277+
$query0 = "SELECT command_id, bug_id FROM codev_command_bug_table WHERE bug_id NOT IN (SELECT id FROM mantis_bug_table)";
278278
$result0 = SqlWrapper::getInstance()->sql_query($query0);
279279
while ($row = SqlWrapper::getInstance()->sql_fetch_object($result0)) {
280280
self::$logger->warn("issue $row->bug_id does not exist in Mantis: now removed from Command $row->command_id");
@@ -633,13 +633,13 @@ public function deleteProvision($provid) {
633633
public function getIssueSelection() {
634634
if(NULL == $this->issueSelection) {
635635
$this->issueSelection = new IssueSelection($this->name);
636-
$query = "SELECT bug.* FROM `{bug}` AS bug ".
636+
$query = "SELECT bug.* FROM `mantis_bug_table` AS bug ".
637637
"JOIN `codev_command_bug_table` AS command_bug ON bug.id = command_bug.bug_id " .
638638
"WHERE command_bug.command_id = ".$this->id.";";
639639
#", `mantis_bug_table`".
640640
#"WHERE codev_command_bug_table.command_id=$this->id ".
641641
#"AND codev_command_bug_table.bug_id = mantis_bug_table.id ".
642-
#"ORDER BY {bug}.project_id ASC, {bug}.target_version DESC, {bug}.status ASC";
642+
#"ORDER BY mantis_bug_table.project_id ASC, mantis_bug_table.target_version DESC, mantis_bug_table.status ASC";
643643

644644
$result = SqlWrapper::getInstance()->sql_query($query);
645645
if (!$result) {

classes/consistency_check.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function checkDeliveryDate() {
137137

138138
// select all issues which current status is 'analyzed'
139139
$query = "SELECT * ".
140-
"FROM `{bug}` ".
140+
"FROM `mantis_bug_table` ".
141141
"WHERE status >= get_project_resolved_status_threshold(project_id) ";
142142

143143
if (0 != count($this->projectList)) {
@@ -180,7 +180,7 @@ public function checkResolved() {
180180

181181
// select all issues which current status is 'analyzed'
182182
$query = "SELECT * ".
183-
"FROM `{bug}` ".
183+
"FROM `mantis_bug_table` ".
184184
"WHERE status >= get_project_resolved_status_threshold(project_id) ";
185185

186186
if (0 != count($this->projectList)) {
@@ -225,7 +225,7 @@ public function checkBadBacklog() {
225225
$cerrList = array();
226226

227227
// select all issues which current status is 'analyzed'
228-
$query = "SELECT * FROM `{bug}` ".
228+
$query = "SELECT * FROM `mantis_bug_table` ".
229229
#"WHERE status NOT IN (".Constants::$status_new.", ".Constants::$status_acknowledged.") ".
230230
"WHERE status NOT IN (".Constants::$status_new.") ".
231231
"AND status < get_project_resolved_status_threshold(project_id) ";
@@ -272,7 +272,7 @@ public function checkMgrEffortEstim() {
272272

273273
// select all issues
274274
$query = "SELECT * ".
275-
"FROM `{bug}` ".
275+
"FROM `mantis_bug_table` ".
276276
"WHERE status < get_project_resolved_status_threshold(project_id) ";
277277

278278
if (0 != count($this->projectList)) {
@@ -335,7 +335,7 @@ function checkTimeTracksOnNewIssues() {
335335

336336
// select all issues which current status is 'new'
337337
$query = "SELECT * ".
338-
"FROM `{bug}` ".
338+
"FROM `mantis_bug_table` ".
339339
"WHERE status = ".Constants::$status_new." ";
340340

341341
if (0 != count($this->projectList)) {

classes/consistency_check2.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ public function checkTimetracksOnRemovedIssues() {
698698
"FROM `codev_timetracking_table` ".
699699
"WHERE date >= ".$team->getDate()." ".
700700
"AND userid IN ($formatedUsers) ";
701-
#"AND 0 = (SELECT COUNT(id) FROM `{bug}` WHERE id='codev_timetracking_table.bugid' ) ";
701+
#"AND 0 = (SELECT COUNT(id) FROM `mantis_bug_table` WHERE id='codev_timetracking_table.bugid' ) ";
702702

703703
$result = SqlWrapper::getInstance()->sql_query($query);
704704
if (!$result) {
@@ -771,7 +771,7 @@ public static function checkIncompleteDays(TimeTracking $timeTracking, $userid =
771771

772772
public static function checkMantisDefaultProjectWorkflow() {
773773
$cerrList = array();
774-
$query = "SELECT * FROM `{config}` ".
774+
$query = "SELECT * FROM `mantis_config_table` ".
775775
"WHERE project_id = 0 ".
776776
"AND config_id = 'status_enum_workflow' ";
777777

classes/consistency_check_fdj.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function checkAnalyzed() {
4949

5050
// select all issues which current status is 'analyzed'
5151
$query = "SELECT * ".
52-
"FROM `{bug}` ".
52+
"FROM `mantis_bug_table` ".
5353
"WHERE status in ($status_analyzed, $status_accepted, ".Constants::$status_open.", $status_deferred) ";
5454

5555
if (0 != count($this->projectList)) {

classes/constants.class.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class Constants {
4949
public static $severity_names;
5050
public static $bug_resolved_status_threshold;
5151
public static $status_enum_workflow;
52-
public static $mantis_db_table_prefix = 'mantis_';
53-
public static $mantis_db_table_suffix = '_table';
5452

5553
// --- RESOLUTION ---
5654
public static $resolution_fixed;
@@ -200,21 +198,6 @@ public static function parseConfigFile() {
200198
self::$bug_resolved_status_threshold = $mantis['bug_resolved_status_threshold'];
201199
self::$status_enum_workflow = json_decode($mantis['status_enum_workflow'], true); // jsonStr to array
202200

203-
if ( !empty($mantis['db_table_prefix'])) {
204-
// variable not set: config.ini file is prior to v1.2.1
205-
self::$mantis_db_table_prefix = $mantis['db_table_prefix'];
206-
}
207-
if ( !empty($mantis['db_table_suffix'])) {
208-
// variable not set: config.ini file is prior to v1.2.1
209-
self::$mantis_db_table_suffix = $mantis['db_table_suffix'];
210-
}
211-
if ( !empty( self::$mantis_db_table_prefix ) && ('_' != substr( self::$mantis_db_table_prefix, -1 )) ) {
212-
self::$mantis_db_table_prefix .= '_';
213-
}
214-
if ( !empty( self::$mantis_db_table_suffix ) && ('_' != substr( self::$mantis_db_table_suffix, 0, 1 )) ) {
215-
self::$mantis_db_table_suffix = '_' . self::$mantis_db_table_suffix;
216-
}
217-
218201
$status = $ini_array['status'];
219202
self::$status_new = $status['status_new'];
220203
self::$status_feedback = $status['status_feedback'];
@@ -325,8 +308,6 @@ public static function writeConfigFile() {
325308
$mantis['severity_enum_string'] = self::$severity_names ? Tools::doubleImplode(':', ',', self::$severity_names) : ' ';
326309
$mantis['bug_resolved_status_threshold'] = self::$bug_resolved_status_threshold;
327310
$mantis['status_enum_workflow'] = json_encode(self::$status_enum_workflow); // array to jsonStr
328-
$mantis['db_table_prefix'] = self::$mantis_db_table_prefix;
329-
$mantis['db_table_suffix'] = self::$mantis_db_table_suffix;
330311

331312
$status = array();
332313
$status[] = '; Note: CodevTT needs some status to be defined (new, feedback, open, closed)';

classes/crypto.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function auth_generate_unique_cookie_string() {
6363
* @access public
6464
*/
6565
private function auth_is_cookie_string_unique($p_cookie_string) {
66-
$query = "SELECT COUNT(*) FROM `{user}` WHERE cookie_string='$p_cookie_string'";
66+
$query = "SELECT COUNT(*) FROM mantis_user_table WHERE cookie_string='$p_cookie_string'";
6767
$result = SqlWrapper::getInstance()->sql_query($query);
6868

6969
if (!$result) {

0 commit comments

Comments
 (0)