Changeset 526 for trunk/lib/App.inc.php
- Timestamp:
- Jun 17, 2015 11:47:23 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r524 r526 75 75 'site_url' => '', // URL automatically determined by _SERVER['HTTP_HOST'] if not set here. 76 76 'images_path' => '', // Location for codebase-generated interface widgets (ex: "/admin/i"). 77 'site_version' => '', // Version of this application (set automatically during start() if site_version_file is used). 77 78 'site_version_file' => 'docs/version.txt', // File containing version number of this app, relative to the include path. 78 79 … … 470 471 // Set the application version if defined. 471 472 if (false !== $site_version_file = stream_resolve_include_path($this->getParam('site_version_file'))) { 472 $site_version = trim(file_get_contents($site_version_file)); 473 if (mb_strpos($site_version_file, '.json') !== false) { 474 $version_json = json_decode(trim(file_get_contents($site_version_file)), true); 475 $site_version = $version_json['version']; 476 } else { 477 $site_version = trim(file_get_contents($site_version_file)); 478 } 473 479 $this->setParam(array('site_version' => $site_version)); 474 if (!defined('_CLI')) {475 if (!headers_sent($h_file, $h_line)) {476 header('X-Site-Version: ' . $site_version);477 } else {478 $this->logMsg(sprintf('Unable to set X-Site-Version; headers already sent (output started in %s : %s)', $h_file, $h_line), LOG_DEBUG, __FILE__, __LINE__);479 }480 } 481 if (!defined('_CLI') && $this->getParam('site_version')) { 482 if (!headers_sent($h_file, $h_line)) { 483 header('X-Site-Version: ' . $site_version); 484 } else { 485 $this->logMsg(sprintf('Unable to set X-Site-Version; headers already sent (output started in %s : %s)', $h_file, $h_line), LOG_DEBUG, __FILE__, __LINE__); 480 486 } 481 487 }
Note: See TracChangeset
for help on using the changeset viewer.