IPS Suite How to use the constants-php file and what it is for. Invision Community

Haim

Registered
constants.php is a special file that you can optionally create in the root of your forum. This file contains commands and configuration options that change the normal behavior of the Invision Community script. It is not required and for most people it will be redundant. You should be aware of what command you use and how it will affect the functioning of your forum.

The file should be located in the root directory next to files such as init.php or index.php and named constants.php

In the file we define commands according to this pattern;
Code:
<?php
define('NAZWA_ZMIENNEJ','WartośćZmiennej');
The number of variables that we can use is very large, I will describe only the most helpful and popular ones.

Constant name - CP_DIRECTORY
Usage: - Used to change the name of the administration directory from the default 'admin'.
Value example - 'newpathdoacp'

Constant name - IN_DEV
Usage: - Activates the developer mode, which is primarily used for creating plugins. (It is required to upload Developer Tools files)
Value example - TRUE

Constant name - RECOVERY_MODE
Usage: - If there is a problem with a plugin, application, template or other similar error that we are unable to access the forum, after updating this command, all plugins will be disabled and the template will be restored to the default version. Even if we don't have a default IPS template, it will be created automatically. I have to admit that this command saved my skin a few times.
Value example - TRUE

Constant name - DISABLE_MFA
Usage: - Disables two-factor authentication. If we use 2FA and do not remember the security questions that need to be answered when logging in, and we do not have access to the database to remember what those answers were, we can completely disable authentication.
Value example - TRUE

Full list of variables
Code:
            'DEV_USE_WHOOPS'                    => TRUE,
            'DEV_USE_FURL_CACHE'                => FALSE,
            'DEV_USE_MENU_CACHE'                => FALSE,
            'DEBUG_JS'                            => FALSE,
            'DEV_DEBUG_JS'                        => TRUE,
            'DEV_DEBUG_CSS'                        => FALSE,
            'DEBUG_TEMPLATES'                    => FALSE,
            'IPS_FOLDER_PERMISSION'                => 0777,
            'FOLDER_PERMISSION_NO_WRITE'        => 0755,
            'IPS_FILE_PERMISSION'                => 0666,
            'FILE_PERMISSION_NO_WRITE'            => 0644,
            'ROOT_PATH'                            => __DIR__,
            'NO_WRITES'                            => FALSE,
            'DEBUG_LOG'                            => FALSE,
            'LOG_FALLBACK_DIR'                    => '{root}/uploads/logs',
            'STORE_METHOD'                        => 'FileSystem',
            'STORE_CONFIG'                        => '{"path":"{root}/datastore"}',
            'CACHE_METHOD'                        => 'None',
            'CACHE_CONFIG'                        => '{}',
            'CACHE_PAGE_TIMEOUT'                => 30,
            'TEST_CACHING'                        => FALSE,
            'EMAIL_DEBUG_PATH'                    => NULL,
            'BULK_MAILS_PER_CYCLE'                => 500,
            'JAVA_PATH'                            => "",
            'ERROR_PAGE'                        => 'error.php',
            'UPGRADING_PAGE'                    => 'upgrading.html',
            'QUERY_LOG'                            => FALSE,
            'CACHING_LOG'                        => FALSE,
            'ENFORCE_ACCESS'                    => FALSE,
            'THUMBNAIL_SIZE'                    => '500x500',
            'PHOTO_THUMBNAIL_SIZE'                => 240, // The max we display is 120x120, so this allows for double size for high dpi screens
            'COOKIE_DOMAIN'                        => NULL,
            'COOKIE_PREFIX'                        => 'ips4_',
            'COOKIE_PATH'                        => NULL,
            'COOKIE_BYPASS_SSLONLY'                => FALSE,
            'CONNECT_NOSYNC_NAMES'                => FALSE,
            'BYPASS_CURL'                        => FALSE,
            'FORCE_CURL'                        => FALSE,
            'NEXUS_TEST_GATEWAYS'                => FALSE,
            'NEXUS_LKEY_API_DISABLE'            => TRUE,
            'NEXUS_LKEY_API_CHECK_IP'            => TRUE,
            'NEXUS_LKEY_API_ALLOW_IP_OVERRIDE'    => FALSE,
            'UPGRADE_MANUAL_THRESHOLD'            => 250000,
            'HTMLENTITIES'                        => ( version_compare( phpversion(), '5.4.0', '<' ) ) ? ENT_IGNORE : ENT_DISALLOWED,
            'SUITE_UNIQUE_KEY'                    => mb_substr( md5( '02bf3' . '$Rev: 3023$'), 10, 10 ),
            'CACHEBUST_KEY'                        => mb_substr( md5( '02bf3' . '$Rev: 3023$'), 10, 10 ), // This looks unnecessary but SUITE_UNIQUE_KEY can be set to a constant constant in constants.php whereas we need a version specific constant for cache busting.
            'SITE_SECRET_KEY'                    => NULL,
            'TEXT_ENCRYPTION_KEY'                => NULL,
            'CONNECT_MASTER_KEY'                => NULL,
            'USE_DEVELOPMENT_BUILDS'            => FALSE,
            'DEV_WHOOPS_EDITOR'                    => NULL,
            'DEFAULT_REQUEST_TIMEOUT'            => 10,        // In seconds - default for most external connections
            'LONG_REQUEST_TIMEOUT'                => 30,        // In seconds - used for specific API-based calls where we expect a slightly longer response time
            'TEMP_DIRECTORY'                    => sys_get_temp_dir(),
            'TEST_DELTA_ZIP'                    => '',
            'DELTA_FORCE_FTP'                    => FALSE,
            'BYPASS_ACP_IP_CHECK'                => FALSE,

define( 'IPS_FOLDER_PERMISSION', 0755);
define( 'FOLDER_PERMISSION_NO_WRITE', 0755);
define( 'IPS_FILE_PERMISSION', 0644);
define( 'FILE_PERMISSION_NO_WRITE', 0644);
More information about the constants.php file on the official website: Using constants.php - Configuration Options - Invision Community
 
Back
Top Bottom