We have moved to Github. Please open tickets there.

Opened 20 months ago

Closed 20 months ago

Last modified 18 months ago

#3834 closed Enhancement (fixed)

version.php loaded many times from disk

Reported by: srokap Owned by:
Priority: normal Milestone: Elgg 1.8.1b
Component: Core Version: 1.8 Beta
Severity: trivial Keywords:
Cc: brett@… Difficulty: trivial

Description

Elgg core loads version.php on every call of function get_version it's about 200-300 times on my installation while loading core.

Maybe it's better to include file once and store desired variables in static var to reduce calls to disk. (calls actually occur - checked with APC stats)

Proposition of fix (lib/upgrade.php line 169):

function get_version($humanreadable = false) {
	global $CONFIG;

	static $version, $release;
	
	if (isset($CONFIG->path)) {
		if (!isset($version) || !isset($release)) {
			if(!include($CONFIG->path . "version.php")){
				return FALSE;
			}
		}
		return (!$humanreadable) ? $version : $release;
	}
	
	return FALSE;
}

Change History (5)

comment:1 Changed 20 months ago by srokap

  • Summary changed from version.php loaded to version.php loaded many times from disk

comment:2 Changed 20 months ago by cash

  • Difficulty set to trivial
  • Milestone changed from Needs Review to Elgg 1.8.1b

comment:3 Changed 20 months ago by Cash Costello

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

Fixes #3834 not loading version.php hundreds of times - thanks to srokap

Changeset: a6805f3f58caecdeb6e149a9da292937e21ea2e5

comment:4 Changed 19 months ago by Cash Costello

Fixes #3834 not loading version.php hundreds of times - thanks to srokap

Changeset: a6805f3f58caecdeb6e149a9da292937e21ea2e5

comment:5 Changed 18 months ago by cash

Refs #3834 moved more efficient get_version() to 1.7 branch

Changeset: 21aab3d75ee5ac97c3a9b738de17be3deb83bfd2

Note: See TracTickets for help on using tickets.