Preparing for Release 6.2.11

In order to make sure you are ready for release 6.2.11 when it comes out, there are two files you need to edit. You can edit them now, and it will not brick your install.

First file that must be edited is the config.php file. Make sure not to overwrite your database login credentials. If you do, make sure to add them back. Your config file muse look exactly like the one below because the database details are stationed where they need to be. After the Initial Installation Info, your config.php file should now look similar to this:

/**
 * If set to PROD, errors will be generated in the logs
 * directory (app/tmp/logs/*.txt). If set to DEV, then
 * errors will be displayed on the screen. For security
 * reasons, when made live to the world, this should be
 * set to PROD.
 */
defined('APP_ENV') or define('APP_ENV', 'PROD');

/**
 * Application path.
 */
defined('APP_PATH') or define('APP_PATH', BASE_PATH . 'app' . DS);

/**
 * Dropins Path.
 */
defined('ETSIS_DROPIN_DIR') or define('ETSIS_DROPIN_DIR', APP_PATH . 'dropins' . DS);

/**
 * Plugins path.
 */
defined('ETSIS_PLUGIN_DIR') or define('ETSIS_PLUGIN_DIR', APP_PATH . 'plugins' . DS);

/**
 * Old Dropins path for backwards compatibility.
 */
defined('DROPINS_DIR') or define('DROPINS_DIR', ETSIS_DROPIN_DIR);

/**
 * Old Plugins path for backwards compatibility.
 */
defined('PLUGINS_DIR') or define('PLUGINS_DIR', ETSIS_PLUGIN_DIR);

/**
 * Cache path.
 */
defined('CACHE_PATH') or define('CACHE_PATH', APP_PATH . 'tmp' . DS . 'cache' . DS);

/**
 * Image path for .pdf's.
 */
defined('K_PATH_IMAGES') or define('K_PATH_IMAGES', BASE_PATH . 'static' . DS . 'images' . DS);

/**
 * Set for low ram cache.
 */
defined('ETSIS_FILE_CACHE_LOW_RAM') or define('ETSIS_FILE_CACHE_LOW_RAM', '');

/**
 * Instantiate a Liten application
 *
 * You can update
 */
$subdomain = '';
$domain_parts = explode('.', $_SERVER['SERVER_NAME']);
if (count($domain_parts) == 3) {
    $subdomain = $domain_parts[0];
} else {
    $subdomain = 'www';
}
$app = new \Liten\Liten(
    [
    'cookies.lifetime' => '86400',
    'cookies.savepath' => ini_get('session.save_path') . DS . $subdomain . DS,
    'file.savepath' => ini_get('session.save_path') . DS . $subdomain . DS . 'files' . DS
    ]
);

/**
 * Database details
 */
defined('DB_HOST') or define('DB_HOST', '');
defined('DB_NAME') or define('DB_NAME', '');
defined('DB_USER') or define('DB_USER', '');
defined('DB_PASS') or define('DB_PASS', '');

/**
 * NodeQ noSQL details.
 */
defined('NODEQ_PATH') or define('NODEQ_PATH', $app->config('cookies.savepath') . 'nodes' . DS);
defined('ETSIS_NODEQ_PATH') or define('ETSIS_NODEQ_PATH', NODEQ_PATH . 'etsis' . DS);

/**
 * Do not edit anything from this point on.
 */

$app->inst->singleton('db', function () {
    $pdo = new \PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME, DB_USER, DB_PASS, [\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"]);
    $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
    $pdo->query('SET CHARACTER SET utf8');
    return new \Liten\Orm($pdo);
});

/**
 * Require a functions file
 *
 * A functions file may include any dependency injections
 * or preliminary functions for your application.
 */
require( APP_PATH . 'functions.php' );
require( APP_PATH . 'functions' . DS . 'dependency.php' );
require( APP_PATH . 'functions' . DS . 'hook-function.php' );
require( APP_PATH . 'application.php' );

/**
 * Include the routers needed
 *
 * Lazy load the routers. A router is loaded
 * only when it is needed.
 */
include(APP_PATH . 'routers.php');

/**
 * Initialize benchmark.
 */
benchmark_init();

/**
 * Set the timezone for the application.
 */
date_default_timezone_set((get_option('system_timezone') !== NULL) ? get_option('system_timezone') : 'America/New_York');

/**
 * Autoload Dropins
 *
 * Dropins can be plugins and / or routers that
 * should be autoloaded. This is useful when you want to
 * add your own customized screens without needing to touch
 * the core.
 */
$dropins = glob(APP_PATH . 'dropins' . DS . '*.php');
if (is_array($dropins)) {
 foreach ($dropins as $dropin) {
 if (file_exists($dropin))
 include($dropin);
 }
}

/**
 * Run the Liten application
 *
 * This method should be called last. This executes the Liten application
 * and returns the HTTP response to the HTTP client.
 */
$app->run();

Why the change to the config, well one is for Windows users who may need to manually set $_SERVER['SERVER_NAME']. And the other reason is for users who don’t have access to write to /tmp/. Therefore, they can manually set $app->config('cookies.savepath') and $app->config('file.savepath'). And if someone needs to updated one or two of these values, they don’t have to worry about their changes being overwritten by an update.

Now that the config file is updated, you need to update the index.php file which is in the root. It should now look like this:

/**
 * Step 1: Initial constants defined
 * 
 * Several constants defined in order to help
 * with the autoloader and the loading of other
 * needed functions and files.
 */
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
defined('BASE_PATH') or define('BASE_PATH', __DIR__ . DS);

/**
 * Step 2: Require the Bootstrap
 *
 * The bootstrap includes defines as well as autoloader
 * in order to have a working install of Liten.
 */
require( BASE_PATH . 'Liten' . DS . 'Bootstrap.php');

/**
 * Step 3: Include database config file
 * 
 * This is an example of loaded a database config
 * file when calling an application that needs
 * database connection.
 */
include( BASE_PATH . 'config.php' );