We have moved to Github. Please open tickets there.

Opened 2 years ago

Closed 11 months ago

Last modified 11 months ago

#3242 closed Enhancement (fixed)

elgg metadata unit tests has unnecessary code to remove metastrings

Reported by: cash Owned by:
Priority: normal Milestone: Elgg 1.8.6
Component: Core Version: 1.7
Severity: minor Keywords:
Cc: brett@… Difficulty: trivial

Description

Current unit tests leave behind > 150 metastrings in the metastrings table. Why have this code to try to clean up 2 of them?

Better to implement metastrings garbage collection

	protected function create_metastring($string) {
		global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
		$METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();

		mysql_query("INSERT INTO {$CONFIG->dbprefix}metastrings (string) VALUES ('$string')");
		$this->metastrings[$string] = mysql_insert_id();
	}

	protected function delete_metastrings() {
		global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
		$METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();

		$strings = implode(', ', $this->metastrings);
		mysql_query("DELETE FROM {$CONFIG->dbprefix}metastrings WHERE id IN ($strings)");
	}

Change History (4)

comment:1 Changed 2 years ago by cash

  • Difficulty set to trivial
  • Milestone changed from Needs Review to Elgg 1.8.x

comment:2 Changed 16 months ago by cash

  • Milestone changed from Elgg 1.8.x to Elgg 1.8.5

comment:3 Changed 11 months ago by Cash Costello

  • Resolution set to fixed
  • Status changed from new to closed

Fixes #3242 removed metastring clean up in one of the unit tests

Changeset: c58102ebcf60334f6902ba1df1aaee7104f6ba0d

comment:4 Changed 11 months ago by Cash Costello

Fixes #3242 removed metastring clean up in one of the unit tests

Changeset: c58102ebcf60334f6902ba1df1aaee7104f6ba0d

Note: See TracTickets for help on using tickets.