42 // This needs to match the version number in the database. This number should |
42 // This needs to match the version number in the database. This number should |
43 // be the expected output of enano_version(), which will always be in the |
43 // be the expected output of enano_version(), which will always be in the |
44 // format of 1.0.2, 1.0.2a1, 1.0.2b1, 1.0.2RC1 |
44 // format of 1.0.2, 1.0.2a1, 1.0.2b1, 1.0.2RC1 |
45 // You'll want to change this for custom distributions. |
45 // You'll want to change this for custom distributions. |
46 $version = '1.1.8'; |
46 $version = '1.1.8'; |
|
47 |
|
48 // Database schema version |
|
49 // This is incremented each time a change to the database structure is made. |
|
50 // If it doesn't match the version in the DB, the user will be asked to upgrade. |
|
51 // This must match install/includes/common.php! |
|
52 $db_version = 1125; |
47 |
53 |
48 /** |
54 /** |
49 * Returns a floating-point number with the current UNIX timestamp in microseconds. Defined very early because we gotta call it |
55 * Returns a floating-point number with the current UNIX timestamp in microseconds. Defined very early because we gotta call it |
50 * from very early on in the script to measure the starting time of Enano. |
56 * from very early on in the script to measure the starting time of Enano. |
51 * @return float |
57 * @return float |
261 if ( defined('ENANO_EXIT_AFTER_CONFIG') ) |
267 if ( defined('ENANO_EXIT_AFTER_CONFIG') ) |
262 { |
268 { |
263 return true; |
269 return true; |
264 } |
270 } |
265 |
271 |
266 // Now that we have the config, check the Enano version. |
272 // Now that we have the config, check the database version. |
267 if ( enano_version(false, true) != $version && !defined('IN_ENANO_UPGRADE') ) |
273 // ...We do have a database version, right? This was only added in 1.1.8, so assign |
268 { |
274 // a database revision number if there isn't one in the config already. |
269 grinding_halt('Version mismatch', '<p>It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to <a href="'.scriptPath.'/install/index.php">upgrade</a>?</p>'); |
275 if ( getConfig('db_version') === false ) |
|
276 { |
|
277 generate_db_version(); |
|
278 } |
|
279 if ( ($current_db_revision = getConfig('db_version', 0)) < $db_version && !defined('IN_ENANO_UPGRADE') ) |
|
280 { |
|
281 grinding_halt('Database out of date', '<p>Your Enano database is out of date and needs to be upgraded. To do this, use the <a href="'.scriptPath.'/install/index.php">upgrade script</a>.</p>' |
|
282 . "<p>Your database version: $current_db_revision<br />Latest version: $db_version</p>"); |
|
283 } |
|
284 else if ( $current_db_revision > $db_version ) |
|
285 { |
|
286 grinding_halt('Database newer than Enano', '<p>Your Enano database is a newer revision than what this Enano release calls for. Please upgrade your Enano files.</p>' |
|
287 . "<p>Your database version: $current_db_revision<br />Latest version: $db_version</p>"); |
|
288 } |
|
289 |
|
290 // If we made it here, DB is up to date. |
|
291 if ( getConfig('enano_version') !== $version && !preg_match('/^upg-/', getConfig('enano_version')) ) |
|
292 { |
|
293 setConfig('enano_version', $version); |
|
294 setConfig('newly_upgraded', 1); |
270 } |
295 } |
271 |
296 |
272 // Set our CDN path |
297 // Set our CDN path |
273 if ( !defined('cdnPath') ) |
298 if ( !defined('cdnPath') ) |
274 { |
299 { |