Add project
This commit is contained in:
38
config/.env.example
Normal file
38
config/.env.example
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# Used as a default to seed config/.env which
|
||||
# enables you to use environment variables to configure
|
||||
# the aspects of your application that vary by
|
||||
# environment.
|
||||
#
|
||||
# Having this file in production is considered a **SECURITY RISK** and also decreases
|
||||
# the bootstrap performance of your application.
|
||||
#
|
||||
# To use this file, first copy it into `config/.env`. Also ensure the related
|
||||
# code block for loading this file is uncommented in `config/bootstrap.php`
|
||||
#
|
||||
# In development .env files are parsed by PHP
|
||||
# and set into the environment. This provides a simpler
|
||||
# development workflow over standard environment variables.
|
||||
export APP_NAME="__APP_NAME__"
|
||||
export DEBUG="true"
|
||||
export APP_ENCODING="UTF-8"
|
||||
export APP_DEFAULT_LOCALE="en_US"
|
||||
export APP_DEFAULT_TIMEZONE="UTC"
|
||||
export SECURITY_SALT="__SALT__"
|
||||
|
||||
# Uncomment these to define cache configuration via environment variables.
|
||||
#export CACHE_DURATION="+2 minutes"
|
||||
#export CACHE_DEFAULT_URL="file:///path/to/tmp/cache/?prefix=${APP_NAME}_default_&duration=${CACHE_DURATION}"
|
||||
#export CACHE_CAKECORE_URL="file:///path/to/tmp/cache/persistent?prefix=${APP_NAME}_cake_translations_&serialize=true&duration=${CACHE_DURATION}"
|
||||
#export CACHE_CAKEMODEL_URL="file:///path/to/tmp/cache/models?prefix=${APP_NAME}_cake_model_&serialize=true&duration=${CACHE_DURATION}"
|
||||
|
||||
# Uncomment these to define email transport configuration via environment variables.
|
||||
#export EMAIL_TRANSPORT_DEFAULT_URL=""
|
||||
|
||||
# Uncomment these to define database configuration via environment variables.
|
||||
#export DATABASE_URL="mysql://my_app:secret@localhost/${APP_NAME}?encoding=utf8&timezone=UTC&cacheMetadata=true"eIdentifiers=false&persistent=false"
|
||||
#export DATABASE_TEST_URL="mysql://my_app:secret@localhost/test_${APP_NAME}?encoding=utf8&timezone=UTC&cacheMetadata=true"eIdentifiers=false&persistent=false"
|
||||
|
||||
# Uncomment these to define logging configuration via environment variables.
|
||||
#export LOG_DEBUG_URL="file:///path/to/logs/?levels[]=notice&levels[]=info&levels[]=debug&file=debug"
|
||||
#export LOG_ERROR_URL="file:///path/to/logs/?levels[]=warning&levels[]=error&levels[]=critical&levels[]=alert&levels[]=emergency&file=error"
|
||||
22
config/Migrations/20251120194645_CreateTools.php
Normal file
22
config/Migrations/20251120194645_CreateTools.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Migrations\BaseMigration;
|
||||
class CreateTools extends BaseMigration
|
||||
{
|
||||
public function change(): void
|
||||
{
|
||||
$table = $this->table('tools')
|
||||
->addColumn('name', 'string', ['limit' => 150])
|
||||
->addColumn('description', 'text', ['null' => true])
|
||||
->addColumn('quantity', 'integer', ['default' => 1])
|
||||
->addColumn('active', 'boolean', ['default' => true])
|
||||
->addColumn('created', 'datetime')
|
||||
->addColumn('modified', 'datetime', ['null' => true])
|
||||
->create();
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
$this->table('tools')->drop()->save();
|
||||
}
|
||||
}
|
||||
15
config/Migrations/20251120204613_CreateUsers.php
Normal file
15
config/Migrations/20251120204613_CreateUsers.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
use Migrations\BaseMigration;
|
||||
class CreateUsers extends BaseMigration
|
||||
{
|
||||
public function change(): void {
|
||||
$table = $this->table('users')
|
||||
->addColumn('name', 'string', ['limit' => 150])
|
||||
->addColumn('email', 'string', ['limit' => 255])
|
||||
->addColumn('password', 'string', ['limit' => 255])
|
||||
->addColumn('created', 'datetime')
|
||||
->addColumn('modified', 'datetime', ['null' => true]);
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
BIN
config/Migrations/schema-dump-default.lock
Normal file
BIN
config/Migrations/schema-dump-default.lock
Normal file
Binary file not shown.
23
config/Seeds/UsersSeed.php
Normal file
23
config/Seeds/UsersSeed.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
use Migrations\BaseSeed;
|
||||
use Authentication\PasswordHasher\DefaultPasswordHasher;
|
||||
class UsersSeed extends BaseSeed
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$hasher = new DefaultPasswordHasher();
|
||||
$data = [
|
||||
[
|
||||
'name' => 'Administrator',
|
||||
'email' => 'admin@example.com',
|
||||
// UWAGA: haslo haszujemy tutaj:
|
||||
'password' => $hasher->hash('Admin123!'),
|
||||
'created' => date('Y-m-d H:i:s'),
|
||||
'modified' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
];
|
||||
$table = $this->table('users');
|
||||
$table->insert($data)->save();
|
||||
}
|
||||
}
|
||||
458
config/app.php
Normal file
458
config/app.php
Normal file
@@ -0,0 +1,458 @@
|
||||
<?php
|
||||
|
||||
use Cake\Cache\Engine\FileEngine;
|
||||
use Cake\Database\Connection;
|
||||
use Cake\Database\Driver\Mysql;
|
||||
use Cake\Log\Engine\FileLog;
|
||||
use Cake\Mailer\Transport\MailTransport;
|
||||
use function Cake\Core\env;
|
||||
|
||||
return [
|
||||
/*
|
||||
* Debug Level:
|
||||
*
|
||||
* Production Mode:
|
||||
* false: No error messages, errors, or warnings shown.
|
||||
*
|
||||
* Development Mode:
|
||||
* true: Errors and warnings shown.
|
||||
*/
|
||||
'debug' => filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),
|
||||
|
||||
/*
|
||||
* Configure basic information about the application.
|
||||
*
|
||||
* - namespace - The namespace to find app classes under.
|
||||
* - defaultLocale - The default locale for translation, formatting currencies and numbers, date and time.
|
||||
* - encoding - The encoding used for HTML + database connections.
|
||||
* - base - The base directory the app resides in. If false this
|
||||
* will be auto-detected.
|
||||
* - dir - Name of app directory.
|
||||
* - webroot - The webroot directory.
|
||||
* - wwwRoot - The file path to webroot.
|
||||
* - baseUrl - To configure CakePHP to *not* use mod_rewrite and to
|
||||
* use CakePHP pretty URLs, remove these .htaccess
|
||||
* files:
|
||||
* /.htaccess
|
||||
* /webroot/.htaccess
|
||||
* And uncomment the baseUrl key below.
|
||||
* - fullBaseUrl - A base URL to use for absolute links. When set to false (default)
|
||||
* CakePHP generates required value based on `HTTP_HOST` environment variable.
|
||||
* However, you can define it manually to optimize performance or if you
|
||||
* are concerned about people manipulating the `Host` header.
|
||||
* - imageBaseUrl - Web path to the public images/ directory under webroot.
|
||||
* - cssBaseUrl - Web path to the public css/ directory under webroot.
|
||||
* - jsBaseUrl - Web path to the public js/ directory under webroot.
|
||||
* - paths - Configure paths for non class-based resources. Supports the
|
||||
* `plugins`, `templates`, `locales` subkeys, which allow the definition of
|
||||
* paths for plugins, view templates and locale files respectively.
|
||||
*/
|
||||
'App' => [
|
||||
'namespace' => 'App',
|
||||
'encoding' => env('APP_ENCODING', 'UTF-8'),
|
||||
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'),
|
||||
'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'UTC'),
|
||||
'base' => false,
|
||||
'dir' => 'src',
|
||||
'webroot' => 'webroot',
|
||||
'wwwRoot' => WWW_ROOT,
|
||||
//'baseUrl' => env('SCRIPT_NAME'),
|
||||
'fullBaseUrl' => false,
|
||||
'imageBaseUrl' => 'img/',
|
||||
'cssBaseUrl' => 'css/',
|
||||
'jsBaseUrl' => 'js/',
|
||||
'paths' => [
|
||||
'plugins' => [ROOT . DS . 'plugins' . DS],
|
||||
'templates' => [ROOT . DS . 'templates' . DS],
|
||||
'locales' => [RESOURCES . 'locales' . DS],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Security and encryption configuration
|
||||
*
|
||||
* - salt - A random string used in security hashing methods.
|
||||
* The salt value is also used as the encryption key.
|
||||
* You should treat it as extremely sensitive data.
|
||||
*/
|
||||
'Security' => [
|
||||
'salt' => env('SECURITY_SALT'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Apply timestamps with the last modified time to static assets (js, css, images).
|
||||
* Will append a querystring parameter containing the time the file was modified.
|
||||
* This is useful for busting browser caches.
|
||||
*
|
||||
* Set to true to apply timestamps when debug is true. Set to 'force' to always
|
||||
* enable timestamping regardless of debug value.
|
||||
*/
|
||||
'Asset' => [
|
||||
//'timestamp' => true,
|
||||
// 'cacheTime' => '+1 year'
|
||||
],
|
||||
|
||||
/*
|
||||
* Configure the cache adapters.
|
||||
*/
|
||||
'Cache' => [
|
||||
'default' => [
|
||||
'className' => FileEngine::class,
|
||||
'path' => CACHE,
|
||||
'url' => env('CACHE_DEFAULT_URL', null),
|
||||
],
|
||||
|
||||
/*
|
||||
* Configure the cache used for general framework caching.
|
||||
* Translation cache files are stored with this configuration.
|
||||
* Duration will be set to '+2 minutes' in bootstrap.php when debug = true
|
||||
* If you set 'className' => 'Null' core cache will be disabled.
|
||||
*/
|
||||
'_cake_translations_' => [
|
||||
'className' => FileEngine::class,
|
||||
'prefix' => 'myapp_cake_translations_',
|
||||
'path' => CACHE . 'persistent' . DS,
|
||||
'serialize' => true,
|
||||
'duration' => '+1 years',
|
||||
'url' => env('CACHE_CAKECORE_URL', null),
|
||||
],
|
||||
|
||||
/*
|
||||
* Configure the cache for model and datasource caches. This cache
|
||||
* configuration is used to store schema descriptions, and table listings
|
||||
* in connections.
|
||||
* Duration will be set to '+2 minutes' in bootstrap.php when debug = true
|
||||
*/
|
||||
'_cake_model_' => [
|
||||
'className' => FileEngine::class,
|
||||
'prefix' => 'myapp_cake_model_',
|
||||
'path' => CACHE . 'models' . DS,
|
||||
'serialize' => true,
|
||||
'duration' => '+1 years',
|
||||
'url' => env('CACHE_CAKEMODEL_URL', null),
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Configure the Error and Exception handlers used by your application.
|
||||
*
|
||||
* By default errors are displayed using Debugger, when debug is true and logged
|
||||
* by Cake\Log\Log when debug is false.
|
||||
*
|
||||
* In CLI environments exceptions will be printed to stderr with a backtrace.
|
||||
* In web environments an HTML page will be displayed for the exception.
|
||||
* With debug true, framework errors like Missing Controller will be displayed.
|
||||
* When debug is false, framework errors will be coerced into generic HTTP errors.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `errorLevel` - int - The level of errors you are interested in capturing.
|
||||
* - `trace` - boolean - Whether backtraces should be included in
|
||||
* logged errors/exceptions.
|
||||
* - `log` - boolean - Whether you want exceptions logged.
|
||||
* - `exceptionRenderer` - string - The class responsible for rendering uncaught exceptions.
|
||||
* The chosen class will be used for both CLI and web environments. If you want different
|
||||
* classes used in CLI and web environments you'll need to write that conditional logic as well.
|
||||
* The conventional location for custom renderers is in `src/Error`. Your exception renderer needs to
|
||||
* implement the `render()` method and return either a string or Http\Response.
|
||||
* `errorRenderer` - string - The class responsible for rendering PHP errors. The selected
|
||||
* class will be used for both web and CLI contexts. If you want different classes for each environment
|
||||
* you'll need to write that conditional logic as well. Error renderers need to
|
||||
* to implement the `Cake\Error\ErrorRendererInterface`.
|
||||
* - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
|
||||
* extend one of the listed exceptions will also be skipped for logging.
|
||||
* E.g.:
|
||||
* `'skipLog' => ['Cake\Http\Exception\NotFoundException', 'Cake\Http\Exception\UnauthorizedException']`
|
||||
* - `extraFatalErrorMemory` - int - The number of megabytes to increase the memory limit by
|
||||
* when a fatal error is encountered. This allows
|
||||
* breathing room to complete logging or error handling.
|
||||
* - `ignoredDeprecationPaths` - array - A list of glob-compatible file paths that deprecations
|
||||
* should be ignored in. Use this to ignore deprecations for plugins or parts of
|
||||
* your application that still emit deprecations.
|
||||
*/
|
||||
'Error' => [
|
||||
'errorLevel' => E_ALL,
|
||||
'skipLog' => [],
|
||||
'log' => true,
|
||||
'trace' => true,
|
||||
'ignoredDeprecationPaths' => [],
|
||||
],
|
||||
|
||||
/*
|
||||
* Debugger configuration
|
||||
*
|
||||
* Define development error values for Cake\Error\Debugger
|
||||
*
|
||||
* - `editor` Set the editor URL format you want to use.
|
||||
* By default atom, emacs, macvim, phpstorm, sublime, textmate, and vscode are
|
||||
* available. You can add additional editor link formats using
|
||||
* `Debugger::addEditor()` during your application bootstrap.
|
||||
* - `outputMask` A mapping of `key` to `replacement` values that
|
||||
* `Debugger` should replace in dumped data and logs generated by `Debugger`.
|
||||
*/
|
||||
'Debugger' => [
|
||||
'editor' => 'phpstorm',
|
||||
],
|
||||
|
||||
/*
|
||||
* Email configuration.
|
||||
*
|
||||
* By defining transports separately from delivery profiles you can easily
|
||||
* re-use transport configuration across multiple profiles.
|
||||
*
|
||||
* You can specify multiple configurations for production, development and
|
||||
* testing.
|
||||
*
|
||||
* Each transport needs a `className`. Valid options are as follows:
|
||||
*
|
||||
* Mail - Send using PHP mail function
|
||||
* Smtp - Send using SMTP
|
||||
* Debug - Do not send the email, just return the result
|
||||
*
|
||||
* You can add custom transports (or override existing transports) by adding the
|
||||
* appropriate file to src/Mailer/Transport. Transports should be named
|
||||
* 'YourTransport.php', where 'Your' is the name of the transport.
|
||||
*/
|
||||
'EmailTransport' => [
|
||||
'default' => [
|
||||
'className' => MailTransport::class,
|
||||
/*
|
||||
* The keys host, port, timeout, username, password, client and tls
|
||||
* are used in SMTP transports
|
||||
*/
|
||||
'host' => 'localhost',
|
||||
'port' => 25,
|
||||
'timeout' => 30,
|
||||
/*
|
||||
* It is recommended to set these options through your environment or app_local.php
|
||||
*/
|
||||
//'username' => null,
|
||||
//'password' => null,
|
||||
'client' => null,
|
||||
'tls' => false,
|
||||
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Email delivery profiles
|
||||
*
|
||||
* Delivery profiles allow you to predefine various properties about email
|
||||
* messages from your application and give the settings a name. This saves
|
||||
* duplication across your application and makes maintenance and development
|
||||
* easier. Each profile accepts a number of keys. See `Cake\Mailer\Mailer`
|
||||
* for more information.
|
||||
*/
|
||||
'Email' => [
|
||||
'default' => [
|
||||
'transport' => 'default',
|
||||
'from' => 'you@localhost',
|
||||
/*
|
||||
* Will by default be set to config value of App.encoding, if that exists otherwise to UTF-8.
|
||||
*/
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Connection information used by the ORM to connect
|
||||
* to your application's datastores.
|
||||
*
|
||||
* ### Notes
|
||||
* - Drivers include Mysql Postgres Sqlite Sqlserver
|
||||
* See vendor\cakephp\cakephp\src\Database\Driver for the complete list
|
||||
* - Do not use periods in database name - it may lead to errors.
|
||||
* See https://github.com/cakephp/cakephp/issues/6471 for details.
|
||||
* - 'encoding' is recommended to be set to full UTF-8 4-Byte support.
|
||||
* E.g set it to 'utf8mb4' in MariaDB and MySQL and 'utf8' for any
|
||||
* other RDBMS.
|
||||
*/
|
||||
'Datasources' => [
|
||||
/*
|
||||
* These configurations should contain permanent settings used
|
||||
* by all environments.
|
||||
*
|
||||
* The values in app_local.php will override any values set here
|
||||
* and should be used for local and per-environment configurations.
|
||||
*
|
||||
* Environment variable-based configurations can be loaded here or
|
||||
* in app_local.php depending on the application's needs.
|
||||
*/
|
||||
'default' => [
|
||||
'className' => Connection::class,
|
||||
'driver' => Mysql::class,
|
||||
'persistent' => false,
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
* For MariaDB/MySQL the internal default changed from utf8 to utf8mb4, aka full utf-8 support
|
||||
*/
|
||||
'encoding' => 'utf8mb4',
|
||||
|
||||
/*
|
||||
* If your MySQL server is configured with `skip-character-set-client-handshake`
|
||||
* then you MUST use the `flags` config to set your charset encoding.
|
||||
* For e.g. `'flags' => [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4']`
|
||||
*/
|
||||
'flags' => [],
|
||||
'cacheMetadata' => true,
|
||||
'log' => false,
|
||||
|
||||
/*
|
||||
* Set identifier quoting to true if you are using reserved words or
|
||||
* special characters in your table or column names. Enabling this
|
||||
* setting will result in queries built using the Query Builder having
|
||||
* identifiers quoted when creating SQL. It should be noted that this
|
||||
* decreases performance because each query needs to be traversed and
|
||||
* manipulated before being executed.
|
||||
*/
|
||||
'quoteIdentifiers' => false,
|
||||
|
||||
/*
|
||||
* During development, if using MySQL < 5.6, uncommenting the
|
||||
* following line could boost the speed at which schema metadata is
|
||||
* fetched from the database. It can also be set directly with the
|
||||
* mysql configuration directive 'innodb_stats_on_metadata = 0'
|
||||
* which is the recommended value in production environments
|
||||
*/
|
||||
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
|
||||
],
|
||||
|
||||
/*
|
||||
* The test connection is used during the test suite.
|
||||
*/
|
||||
'test' => [
|
||||
'className' => Connection::class,
|
||||
'driver' => Mysql::class,
|
||||
'persistent' => false,
|
||||
'timezone' => 'UTC',
|
||||
'encoding' => 'utf8mb4',
|
||||
'flags' => [],
|
||||
'cacheMetadata' => true,
|
||||
'quoteIdentifiers' => false,
|
||||
'log' => false,
|
||||
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Configures logging options
|
||||
*/
|
||||
'Log' => [
|
||||
'debug' => [
|
||||
'className' => FileLog::class,
|
||||
'path' => LOGS,
|
||||
'file' => 'debug',
|
||||
'url' => env('LOG_DEBUG_URL', null),
|
||||
'scopes' => null,
|
||||
'levels' => ['notice', 'info', 'debug'],
|
||||
],
|
||||
'error' => [
|
||||
'className' => FileLog::class,
|
||||
'path' => LOGS,
|
||||
'file' => 'error',
|
||||
'url' => env('LOG_ERROR_URL', null),
|
||||
'scopes' => null,
|
||||
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
|
||||
],
|
||||
// To enable this dedicated query log, you need to set your datasource's log flag to true
|
||||
'queries' => [
|
||||
'className' => FileLog::class,
|
||||
'path' => LOGS,
|
||||
'file' => 'queries',
|
||||
'url' => env('LOG_QUERIES_URL', null),
|
||||
'scopes' => ['cake.database.queries'],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Session configuration.
|
||||
*
|
||||
* Contains an array of settings to use for session configuration. The
|
||||
* `defaults` key is used to define a default preset to use for sessions, any
|
||||
* settings declared here will override the settings of the default config.
|
||||
*
|
||||
* ## Options
|
||||
*
|
||||
* - `cookie` - The name of the cookie to use. Defaults to value set for `session.name` php.ini config.
|
||||
* Avoid using `.` in cookie names, as PHP will drop sessions from cookies with `.` in the name.
|
||||
* - `cookiePath` - The url path for which session cookie is set. Maps to the
|
||||
* `session.cookie_path` php.ini config. Defaults to base path of app.
|
||||
* - `timeout` - The time in minutes a session can be 'idle'. If no request is received in
|
||||
* this duration, the session will be expired and rotated. Pass 0 to disable idle timeout checks.
|
||||
* - `defaults` - The default configuration set to use as a basis for your session.
|
||||
* There are four built-in options: php, cake, cache, database.
|
||||
* - `handler` - Can be used to enable a custom session handler. Expects an
|
||||
* array with at least the `engine` key, being the name of the Session engine
|
||||
* class to use for managing the session. CakePHP bundles the `CacheSession`
|
||||
* and `DatabaseSession` engines.
|
||||
* - `ini` - An associative array of additional 'session.*` ini values to set.
|
||||
*
|
||||
* Within the `ini` key, you will likely want to define:
|
||||
*
|
||||
* - `session.cookie_lifetime` - The number of seconds that cookies are valid for. This
|
||||
* should be longer than `Session.timeout`.
|
||||
* - `session.gc_maxlifetime` - The number of seconds after which a session is considered 'garbage'
|
||||
* that can be deleted by PHP's session cleanup behavior. This value should be greater than both
|
||||
* `Sesssion.timeout` and `session.cookie_lifetime`.
|
||||
*
|
||||
* The built-in `defaults` options are:
|
||||
*
|
||||
* - 'php' - Uses settings defined in your php.ini.
|
||||
* - 'cake' - Saves session files in CakePHP's /tmp directory.
|
||||
* - 'database' - Uses CakePHP's database sessions.
|
||||
* - 'cache' - Use the Cache class to save sessions.
|
||||
*
|
||||
* To define a custom session handler, save it at src/Http/Session/<name>.php.
|
||||
* Make sure the class implements PHP's `SessionHandlerInterface` and set
|
||||
* Session.handler to <name>
|
||||
*
|
||||
* To use database sessions, load the SQL file located at config/schema/sessions.sql
|
||||
*/
|
||||
'Session' => [
|
||||
'defaults' => 'php',
|
||||
],
|
||||
|
||||
/**
|
||||
* DebugKit configuration.
|
||||
*
|
||||
* Contains an array of configurations to apply to the DebugKit plugin, if loaded.
|
||||
* Documentation: https://book.cakephp.org/debugkit/5/en/index.html#configuration
|
||||
*
|
||||
* ## Options
|
||||
*
|
||||
* - `panels` - Enable or disable panels. The key is the panel name, and the value is true to enable,
|
||||
* or false to disable.
|
||||
* - `includeSchemaReflection` - Set to true to enable logging of schema reflection queries. Disabled by default.
|
||||
* - `safeTld` - Set an array of whitelisted TLDs for local development.
|
||||
* - `forceEnable` - Force DebugKit to display. Careful with this, it is usually safer to simply whitelist
|
||||
* your local TLDs.
|
||||
* - `ignorePathsPattern` - Regex pattern (including delimiter) to ignore paths.
|
||||
* DebugKit won’t save data for request URLs that match this regex.
|
||||
* - `ignoreAuthorization` - Set to true to ignore Cake Authorization plugin for DebugKit requests.
|
||||
* Disabled by default.
|
||||
* - `maxDepth` - Defines how many levels of nested data should be shown in general for debug output.
|
||||
* Default is 5. WARNING: Increasing the max depth level can lead to an out of memory error.
|
||||
* - `variablesPanelMaxDepth` - Defines how many levels of nested data should be shown in the variables tab.
|
||||
* Default is 5. WARNING: Increasing the max depth level can lead to an out of memory error.
|
||||
*/
|
||||
'DebugKit' => [
|
||||
'forceEnable' => filter_var(env('DEBUG_KIT_FORCE_ENABLE', false), FILTER_VALIDATE_BOOLEAN),
|
||||
'safeTld' => env('DEBUG_KIT_SAFE_TLD', null),
|
||||
'ignoreAuthorization' => env('DEBUG_KIT_IGNORE_AUTHORIZATION', false),
|
||||
],
|
||||
|
||||
/**
|
||||
* TestSuite configuration.
|
||||
*
|
||||
* ## Options
|
||||
*
|
||||
* - `errorLevel` - Defaults to `E_ALL`. Can be set to `false` to disable overwrite error level.
|
||||
* - `fixtureStrategy` - Defaults to TruncateStrategy. Can be set to any class implementing FixtureStrategyInterface.
|
||||
*/
|
||||
'TestSuite' => [
|
||||
'errorLevel' => null,
|
||||
'fixtureStrategy' => null,
|
||||
],
|
||||
];
|
||||
97
config/app_local.example.php
Normal file
97
config/app_local.example.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
use function Cake\Core\env;
|
||||
|
||||
/*
|
||||
* Local configuration file to provide any overrides to your app.php configuration.
|
||||
* Copy and save this file as app_local.php and make changes as required.
|
||||
* Note: It is not recommended to commit files with credentials such as app_local.php
|
||||
* into source code version control.
|
||||
*/
|
||||
return [
|
||||
/*
|
||||
* Debug Level:
|
||||
*
|
||||
* Production Mode:
|
||||
* false: No error messages, errors, or warnings shown.
|
||||
*
|
||||
* Development Mode:
|
||||
* true: Errors and warnings shown.
|
||||
*/
|
||||
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
|
||||
|
||||
/*
|
||||
* Security and encryption configuration
|
||||
*
|
||||
* - salt - A random string used in security hashing methods.
|
||||
* The salt value is also used as the encryption key.
|
||||
* You should treat it as extremely sensitive data.
|
||||
*/
|
||||
'Security' => [
|
||||
'salt' => env('SECURITY_SALT', '__SALT__'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Connection information used by the ORM to connect
|
||||
* to your application's datastores.
|
||||
*
|
||||
* See app.php for more configuration options.
|
||||
*/
|
||||
'Datasources' => [
|
||||
'default' => [
|
||||
'host' => 'localhost',
|
||||
/*
|
||||
* CakePHP will use the default DB port based on the driver selected
|
||||
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
|
||||
* the following line and set the port accordingly
|
||||
*/
|
||||
//'port' => 'non_standard_port_number',
|
||||
|
||||
'username' => 'my_app',
|
||||
'password' => 'secret',
|
||||
|
||||
'database' => 'my_app',
|
||||
/*
|
||||
* If not using the default 'public' schema with the PostgreSQL driver
|
||||
* set it here.
|
||||
*/
|
||||
//'schema' => 'myapp',
|
||||
|
||||
/*
|
||||
* You can use a DSN string to set the entire configuration
|
||||
*/
|
||||
'url' => env('DATABASE_URL', null),
|
||||
],
|
||||
|
||||
/*
|
||||
* The test connection is used during the test suite.
|
||||
*/
|
||||
'test' => [
|
||||
'host' => 'localhost',
|
||||
//'port' => 'non_standard_port_number',
|
||||
'username' => 'my_app',
|
||||
'password' => 'secret',
|
||||
'database' => 'test_myapp',
|
||||
//'schema' => 'myapp',
|
||||
'url' => env('DATABASE_TEST_URL', 'sqlite://127.0.0.1/tmp/tests.sqlite'),
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Email configuration.
|
||||
*
|
||||
* Host and credential configuration in case you are using SmtpTransport
|
||||
*
|
||||
* See app.php for more configuration options.
|
||||
*/
|
||||
'EmailTransport' => [
|
||||
'default' => [
|
||||
'host' => 'localhost',
|
||||
'port' => 25,
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
'client' => null,
|
||||
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
|
||||
],
|
||||
],
|
||||
];
|
||||
234
config/bootstrap.php
Normal file
234
config/bootstrap.php
Normal file
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 0.10.8
|
||||
* @license https://opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is loaded by your src/Application.php bootstrap method.
|
||||
* Feel free to extend/extract parts of the bootstrap process into your own files
|
||||
* to suit your needs/preferences.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Configure paths required to find CakePHP + general filepath constants
|
||||
*/
|
||||
require __DIR__ . DIRECTORY_SEPARATOR . 'paths.php';
|
||||
|
||||
/*
|
||||
* Bootstrap CakePHP
|
||||
* Currently all this does is initialize the router (without loading your routes)
|
||||
*/
|
||||
require CORE_PATH . 'config' . DS . 'bootstrap.php';
|
||||
|
||||
use Cake\Cache\Cache;
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Core\Configure\Engine\PhpConfig;
|
||||
use Cake\Datasource\ConnectionManager;
|
||||
use Cake\Error\ErrorTrap;
|
||||
use Cake\Error\ExceptionTrap;
|
||||
use Cake\Http\ServerRequest;
|
||||
use Cake\Log\Log;
|
||||
use Cake\Mailer\Mailer;
|
||||
use Cake\Mailer\TransportFactory;
|
||||
use Cake\Routing\Router;
|
||||
use Cake\Utility\Security;
|
||||
use function Cake\Core\env;
|
||||
|
||||
/*
|
||||
* Load global functions for collections, translations, debugging etc.
|
||||
*/
|
||||
require CAKE . 'functions.php';
|
||||
|
||||
/*
|
||||
* See https://github.com/josegonzalez/php-dotenv for API details.
|
||||
*
|
||||
* Uncomment block of code below if you want to use `.env` file during development.
|
||||
* You should copy `config/.env.example` to `config/.env` and set/modify the
|
||||
* variables as required.
|
||||
*
|
||||
* The purpose of the .env file is to emulate the presence of the environment
|
||||
* variables like they would be present in production.
|
||||
*
|
||||
* If you use .env files, be careful to not commit them to source control to avoid
|
||||
* security risks. See https://github.com/josegonzalez/php-dotenv#general-security-information
|
||||
* for more information for recommended practices.
|
||||
*/
|
||||
// if (!env('APP_NAME') && file_exists(CONFIG . '.env')) {
|
||||
// $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']);
|
||||
// $dotenv->parse()
|
||||
// ->putenv()
|
||||
// ->toEnv()
|
||||
// ->toServer();
|
||||
// }
|
||||
|
||||
/*
|
||||
* Initializes default Config store and loads the main configuration file (app.php)
|
||||
*
|
||||
* CakePHP contains 2 configuration files after project creation:
|
||||
* - `config/app.php` for the default application configuration.
|
||||
* - `config/app_local.php` for environment specific configuration.
|
||||
*/
|
||||
try {
|
||||
Configure::config('default', new PhpConfig());
|
||||
Configure::load('app', 'default', false);
|
||||
} catch (\Exception $e) {
|
||||
exit($e->getMessage() . "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Load an environment local configuration file to provide overrides to your configuration.
|
||||
* Notice: For security reasons app_local.php **should not** be included in your git repo.
|
||||
*/
|
||||
if (file_exists(CONFIG . 'app_local.php')) {
|
||||
Configure::load('app_local', 'default');
|
||||
}
|
||||
|
||||
/*
|
||||
* When debug = true the metadata cache should only last for a short time.
|
||||
*/
|
||||
if (Configure::read('debug')) {
|
||||
Configure::write('Cache._cake_model_.duration', '+2 minutes');
|
||||
Configure::write('Cache._cake_translations_.duration', '+2 minutes');
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the default server timezone. Using UTC makes time calculations / conversions easier.
|
||||
* Check https://php.net/manual/en/timezones.php for list of valid timezone strings.
|
||||
*/
|
||||
date_default_timezone_set(Configure::read('App.defaultTimezone'));
|
||||
|
||||
/*
|
||||
* Configure the mbstring extension to use the correct encoding.
|
||||
*/
|
||||
mb_internal_encoding(Configure::read('App.encoding'));
|
||||
|
||||
/*
|
||||
* Set the default locale. This controls how dates, number and currency is
|
||||
* formatted and sets the default language to use for translations.
|
||||
*/
|
||||
ini_set('intl.default_locale', Configure::read('App.defaultLocale'));
|
||||
|
||||
/*
|
||||
* Register application error and exception handlers.
|
||||
*/
|
||||
(new ErrorTrap(Configure::read('Error')))->register();
|
||||
(new ExceptionTrap(Configure::read('Error')))->register();
|
||||
|
||||
/*
|
||||
* CLI/Command specific configuration.
|
||||
*/
|
||||
if (PHP_SAPI === 'cli') {
|
||||
// Set the fullBaseUrl to allow URLs to be generated in commands.
|
||||
// This is useful when sending email from commands.
|
||||
// Configure::write('App.fullBaseUrl', php_uname('n'));
|
||||
|
||||
// Set logs to different files so they don't have permission conflicts.
|
||||
if (Configure::check('Log.debug')) {
|
||||
Configure::write('Log.debug.file', 'cli-debug');
|
||||
}
|
||||
if (Configure::check('Log.error')) {
|
||||
Configure::write('Log.error.file', 'cli-error');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the full base URL.
|
||||
* This URL is used as the base of all absolute links.
|
||||
* Can be very useful for CLI/Commandline applications.
|
||||
*/
|
||||
$fullBaseUrl = Configure::read('App.fullBaseUrl');
|
||||
if (!$fullBaseUrl) {
|
||||
/*
|
||||
* When using proxies or load balancers, SSL/TLS connections might
|
||||
* get terminated before reaching the server. If you trust the proxy,
|
||||
* you can enable `$trustProxy` to rely on the `X-Forwarded-Proto`
|
||||
* header to determine whether to generate URLs using `https`.
|
||||
*
|
||||
* See also https://book.cakephp.org/5/en/controllers/request-response.html#trusting-proxy-headers
|
||||
*/
|
||||
$trustProxy = false;
|
||||
|
||||
$s = null;
|
||||
if (env('HTTPS') || ($trustProxy && env('HTTP_X_FORWARDED_PROTO') === 'https')) {
|
||||
$s = 's';
|
||||
}
|
||||
|
||||
$httpHost = env('HTTP_HOST');
|
||||
if ($httpHost) {
|
||||
$fullBaseUrl = 'http' . $s . '://' . $httpHost;
|
||||
}
|
||||
unset($httpHost, $s);
|
||||
}
|
||||
if ($fullBaseUrl) {
|
||||
Router::fullBaseUrl($fullBaseUrl);
|
||||
}
|
||||
unset($fullBaseUrl);
|
||||
|
||||
/*
|
||||
* Apply the loaded configuration settings to their respective systems.
|
||||
* This will also remove the loaded config data from memory.
|
||||
*/
|
||||
Cache::setConfig(Configure::consume('Cache'));
|
||||
ConnectionManager::setConfig(Configure::consume('Datasources'));
|
||||
TransportFactory::setConfig(Configure::consume('EmailTransport'));
|
||||
Mailer::setConfig(Configure::consume('Email'));
|
||||
Log::setConfig(Configure::consume('Log'));
|
||||
Security::setSalt(Configure::consume('Security.salt'));
|
||||
|
||||
/*
|
||||
* Setup detectors for mobile and tablet.
|
||||
* If you don't use these checks you can safely remove this code
|
||||
* and the mobiledetect package from composer.json.
|
||||
*/
|
||||
ServerRequest::addDetector('mobile', function ($request) {
|
||||
$detector = new \Detection\MobileDetect();
|
||||
|
||||
return $detector->isMobile();
|
||||
});
|
||||
ServerRequest::addDetector('tablet', function ($request) {
|
||||
$detector = new \Detection\MobileDetect();
|
||||
|
||||
return $detector->isTablet();
|
||||
});
|
||||
|
||||
/*
|
||||
* You can enable default locale format parsing by adding calls
|
||||
* to `useLocaleParser()`. This enables the automatic conversion of
|
||||
* locale specific date formats when processing request data. For details see
|
||||
* @link https://book.cakephp.org/5/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data
|
||||
*/
|
||||
// \Cake\Database\TypeFactory::build('time')->useLocaleParser();
|
||||
// \Cake\Database\TypeFactory::build('date')->useLocaleParser();
|
||||
// \Cake\Database\TypeFactory::build('datetime')->useLocaleParser();
|
||||
// \Cake\Database\TypeFactory::build('timestamp')->useLocaleParser();
|
||||
// \Cake\Database\TypeFactory::build('datetimefractional')->useLocaleParser();
|
||||
// \Cake\Database\TypeFactory::build('timestampfractional')->useLocaleParser();
|
||||
// \Cake\Database\TypeFactory::build('datetimetimezone')->useLocaleParser();
|
||||
// \Cake\Database\TypeFactory::build('timestamptimezone')->useLocaleParser();
|
||||
|
||||
/*
|
||||
* Custom Inflector rules, can be set to correctly pluralize or singularize
|
||||
* table, model, controller names or whatever other string is passed to the
|
||||
* inflection functions.
|
||||
*/
|
||||
// \Cake\Utility\Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
|
||||
// \Cake\Utility\Inflector::rules('irregular', ['red' => 'redlings']);
|
||||
// \Cake\Utility\Inflector::rules('uninflected', ['dontinflectme']);
|
||||
|
||||
// set a custom date and time format
|
||||
// see https://book.cakephp.org/5/en/core-libraries/time.html#setting-the-default-locale-and-format-string
|
||||
// and https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax
|
||||
// \Cake\I18n\Date::setToStringFormat('dd.MM.yyyy');
|
||||
// \Cake\I18n\Time::setToStringFormat('dd.MM.yyyy HH:mm');
|
||||
94
config/paths.php
Normal file
94
config/paths.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 3.0.0
|
||||
* @license MIT License (https://opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Use the DS to separate the directories in other defines
|
||||
*/
|
||||
if (!defined('DS')) {
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
/*
|
||||
* These definitions should only be edited if you have cake installed in
|
||||
* a directory layout other than the way it is distributed.
|
||||
* When using custom settings be sure to use the DS and do not add a trailing DS.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The full path to the directory which holds "src", WITHOUT a trailing DS.
|
||||
*/
|
||||
define('ROOT', dirname(__DIR__));
|
||||
|
||||
/*
|
||||
* The actual directory name for the application directory. Normally
|
||||
* named 'src'.
|
||||
*/
|
||||
define('APP_DIR', 'src');
|
||||
|
||||
/*
|
||||
* Path to the application's directory.
|
||||
*/
|
||||
define('APP', ROOT . DS . APP_DIR . DS);
|
||||
|
||||
/*
|
||||
* Path to the config directory.
|
||||
*/
|
||||
define('CONFIG', ROOT . DS . 'config' . DS);
|
||||
|
||||
/*
|
||||
* File path to the webroot directory.
|
||||
*
|
||||
* To derive your webroot from your webserver change this to:
|
||||
*
|
||||
* `define('WWW_ROOT', rtrim($_SERVER['DOCUMENT_ROOT'], DS) . DS);`
|
||||
*/
|
||||
define('WWW_ROOT', ROOT . DS . 'webroot' . DS);
|
||||
|
||||
/*
|
||||
* Path to the tests directory.
|
||||
*/
|
||||
define('TESTS', ROOT . DS . 'tests' . DS);
|
||||
|
||||
/*
|
||||
* Path to the temporary files directory.
|
||||
*/
|
||||
define('TMP', ROOT . DS . 'tmp' . DS);
|
||||
|
||||
/*
|
||||
* Path to the logs directory.
|
||||
*/
|
||||
define('LOGS', ROOT . DS . 'logs' . DS);
|
||||
|
||||
/*
|
||||
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
|
||||
*/
|
||||
define('CACHE', TMP . 'cache' . DS);
|
||||
|
||||
/*
|
||||
* Path to the resources directory.
|
||||
*/
|
||||
define('RESOURCES', ROOT . DS . 'resources' . DS);
|
||||
|
||||
/*
|
||||
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
|
||||
*
|
||||
* CakePHP should always be installed with composer, so look there.
|
||||
*/
|
||||
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'vendor' . DS . 'cakephp' . DS . 'cakephp');
|
||||
|
||||
/*
|
||||
* Path to the cake directory.
|
||||
*/
|
||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||
define('CAKE', CORE_PATH . 'src' . DS);
|
||||
36
config/plugins.php
Normal file
36
config/plugins.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin configuration.
|
||||
*
|
||||
* In this file, you configure which plugins are loaded in the different states your app can be.
|
||||
* It's loaded via the `parent::bootstrap();` call inside your `Application::bootstrap()` method.
|
||||
* For more information see https://book.cakephp.org/5/en/plugins.html#loading-plugins-via-configuration-array
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 5.0.0
|
||||
* @license https://opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/*
|
||||
* List of plugins to load in the form `PluginName` => `[configuration options]`.
|
||||
*
|
||||
* Available options:
|
||||
* - onlyDebug: Load the plugin only in debug mode. Default false.
|
||||
* - onlyCli: Load the plugin only in CLI mode. Default false.
|
||||
* - optional: Do not throw an exception if the plugin is not found. Default false.
|
||||
*/
|
||||
return [
|
||||
'DebugKit' => ['onlyDebug' => true],
|
||||
'Bake' => ['onlyCli' => true, 'optional' => true],
|
||||
'Migrations' => ['onlyCli' => true],
|
||||
|
||||
// Additional plugins here
|
||||
];
|
||||
96
config/routes.php
Normal file
96
config/routes.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Routes configuration.
|
||||
*
|
||||
* In this file, you set up routes to your controllers and their actions.
|
||||
* Routes are very important mechanism that allows you to freely connect
|
||||
* different URLs to chosen controllers and their actions (functions).
|
||||
*
|
||||
* It's loaded within the context of `Application::routes()` method which
|
||||
* receives a `RouteBuilder` instance `$routes` as method argument.
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @license https://opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use Cake\Routing\Route\DashedRoute;
|
||||
use Cake\Routing\RouteBuilder;
|
||||
|
||||
/*
|
||||
* This file is loaded in the context of the `Application` class.
|
||||
* So you can use `$this` to reference the application class instance
|
||||
* if required.
|
||||
*/
|
||||
return function (RouteBuilder $routes): void {
|
||||
/*
|
||||
* The default class to use for all routes
|
||||
*
|
||||
* The following route classes are supplied with CakePHP and are appropriate
|
||||
* to set as the default:
|
||||
*
|
||||
* - Route
|
||||
* - InflectedRoute
|
||||
* - DashedRoute
|
||||
*
|
||||
* If no call is made to `Router::defaultRouteClass()`, the class used is
|
||||
* `Route` (`Cake\Routing\Route\Route`)
|
||||
*
|
||||
* Note that `Route` does not do any inflections on URLs which will result in
|
||||
* inconsistently cased URLs when used with `{plugin}`, `{controller}` and
|
||||
* `{action}` markers.
|
||||
*/
|
||||
$routes->setRouteClass(DashedRoute::class);
|
||||
|
||||
$routes->scope('/', function (RouteBuilder $builder): void {
|
||||
/*
|
||||
* Here, we are connecting '/' (base path) to a controller called 'Pages',
|
||||
* its action called 'display', and we pass a param to select the view file
|
||||
* to use (in this case, templates/Pages/home.php)...
|
||||
*/
|
||||
$builder->connect('/', ['controller' => 'Tools','action' => 'index']);
|
||||
|
||||
/*
|
||||
* ...and connect the rest of 'Pages' controller's URLs.
|
||||
*/
|
||||
$builder->connect('/pages/*', 'Pages::display');
|
||||
|
||||
/*
|
||||
* Connect catchall routes for all controllers.
|
||||
*
|
||||
* The `fallbacks` method is a shortcut for
|
||||
*
|
||||
* ```
|
||||
* $builder->connect('/{controller}', ['action' => 'index']);
|
||||
* $builder->connect('/{controller}/{action}/*', []);
|
||||
* ```
|
||||
*
|
||||
* It is NOT recommended to use fallback routes after your initial prototyping phase!
|
||||
* See https://book.cakephp.org/5/en/development/routing.html#fallbacks-method for more information
|
||||
*/
|
||||
$builder->fallbacks();
|
||||
});
|
||||
|
||||
/*
|
||||
* If you need a different set of middleware or none at all,
|
||||
* open new scope and define routes there.
|
||||
*
|
||||
* ```
|
||||
* $routes->scope('/api', function (RouteBuilder $builder): void {
|
||||
* // No $builder->applyMiddleware() here.
|
||||
*
|
||||
* // Parse specified extensions from URLs
|
||||
* // $builder->setExtensions(['json', 'xml']);
|
||||
*
|
||||
* // Connect API actions here.
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
};
|
||||
18
config/schema/i18n.sql
Normal file
18
config/schema/i18n.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
# Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
#
|
||||
# Licensed under The MIT License
|
||||
# For full copyright and license information, please see the LICENSE.txt
|
||||
# Redistributions of files must retain the above copyright notice.
|
||||
# MIT License (https://opensource.org/licenses/mit-license.php)
|
||||
|
||||
CREATE TABLE i18n (
|
||||
id int NOT NULL auto_increment,
|
||||
locale varchar(6) NOT NULL,
|
||||
model varchar(255) NOT NULL,
|
||||
foreign_key int(10) NOT NULL,
|
||||
field varchar(255) NOT NULL,
|
||||
content text,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
|
||||
INDEX I18N_FIELD(model, foreign_key, field)
|
||||
);
|
||||
15
config/schema/sessions.sql
Normal file
15
config/schema/sessions.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
# Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
#
|
||||
# Licensed under The MIT License
|
||||
# For full copyright and license information, please see the LICENSE.txt
|
||||
# Redistributions of files must retain the above copyright notice.
|
||||
# MIT License (https://opensource.org/licenses/mit-license.php)
|
||||
|
||||
CREATE TABLE `sessions` (
|
||||
`id` char(40) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
|
||||
`created` datetime DEFAULT CURRENT_TIMESTAMP, -- optional, requires MySQL 5.6.5+
|
||||
`modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- optional, requires MySQL 5.6.5+
|
||||
`data` blob DEFAULT NULL, -- for PostgreSQL use bytea instead of blob
|
||||
`expires` int(10) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
Reference in New Issue
Block a user