Browse Source

adding rapor wp

main^2
dfoso 10 months ago committed by =
parent
commit
2686432c6f
  1. 202
      app/Config--newest/App.php
  2. 94
      app/Config--newest/Autoload.php
  3. 34
      app/Config--newest/Boot/development.php
  4. 25
      app/Config--newest/Boot/production.php
  5. 38
      app/Config--newest/Boot/testing.php
  6. 20
      app/Config--newest/CURLRequest.php
  7. 171
      app/Config--newest/Cache.php
  8. 96
      app/Config--newest/Constants.php
  9. 176
      app/Config--newest/ContentSecurityPolicy.php
  10. 107
      app/Config--newest/Cookie.php
  11. 105
      app/Config--newest/Cors.php
  12. 194
      app/Config--newest/Database.php
  13. 46
      app/Config--newest/DocTypes.php
  14. 121
      app/Config--newest/Email.php
  15. 92
      app/Config--newest/Encryption.php
  16. 55
      app/Config--newest/Events.php
  17. 108
      app/Config--newest/Exceptions.php
  18. 29
      app/Config--newest/Feature.php
  19. 107
      app/Config--newest/Filters.php
  20. 12
      app/Config--newest/ForeignCharacters.php
  21. 77
      app/Config--newest/Format.php
  22. 44
      app/Config--newest/Generators.php
  23. 42
      app/Config--newest/Honeypot.php
  24. 31
      app/Config--newest/Images.php
  25. 65
      app/Config--newest/Kint.php
  26. 150
      app/Config--newest/Logger.php
  27. 50
      app/Config--newest/Migrations.php
  28. 536
      app/Config--newest/Mimes.php
  29. 84
      app/Config--newest/Modules.php
  30. 32
      app/Config--newest/Optimize.php
  31. 37
      app/Config--newest/Pager.php
  32. 80
      app/Config--newest/Paths.php
  33. 28
      app/Config--newest/Publisher.php
  34. 9
      app/Config--newest/Routes.php
  35. 140
      app/Config--newest/Routing.php
  36. 103
      app/Config--newest/Security.php
  37. 32
      app/Config--newest/Services.php
  38. 127
      app/Config--newest/Session.php
  39. 122
      app/Config--newest/Toolbar.php
  40. 252
      app/Config--newest/UserAgents.php
  41. 44
      app/Config--newest/Validation.php
  42. 62
      app/Config--newest/View.php
  43. 2
      app/Views/inc/js.php
  44. 4
      app/Views/inc/sidebar.php
  45. 3
      app/Views/ppm/dashboard.php
  46. 6
      system4.4.6/.htaccess
  47. 359
      system4.4.6/API/ResponseTrait.php
  48. 490
      system4.4.6/Autoloader/Autoloader.php
  49. 386
      system4.4.6/Autoloader/FileLocator.php
  50. 1916
      system4.4.6/BaseModel.php
  51. 227
      system4.4.6/CLI/BaseCommand.php
  52. 1153
      system4.4.6/CLI/CLI.php
  53. 186
      system4.4.6/CLI/Commands.php
  54. 88
      system4.4.6/CLI/Console.php
  55. 34
      system4.4.6/CLI/Exceptions/CLIException.php
  56. 388
      system4.4.6/CLI/GeneratorTrait.php
  57. 89
      system4.4.6/Cache/CacheFactory.php
  58. 108
      system4.4.6/Cache/CacheInterface.php
  59. 64
      system4.4.6/Cache/Exceptions/CacheException.php
  60. 24
      system4.4.6/Cache/Exceptions/ExceptionInterface.php
  61. 65
      system4.4.6/Cache/FactoriesCache.php
  62. 44
      system4.4.6/Cache/FactoriesCache/FileVarExportHandler.php
  63. 111
      system4.4.6/Cache/Handlers/BaseHandler.php
  64. 119
      system4.4.6/Cache/Handlers/DummyHandler.php
  65. 423
      system4.4.6/Cache/Handlers/FileHandler.php
  66. 276
      system4.4.6/Cache/Handlers/MemcachedHandler.php
  67. 235
      system4.4.6/Cache/Handlers/PredisHandler.php
  68. 267
      system4.4.6/Cache/Handlers/RedisHandler.php
  69. 150
      system4.4.6/Cache/Handlers/WincacheHandler.php
  70. 151
      system4.4.6/Cache/ResponseCache.php
  71. 1163
      system4.4.6/CodeIgniter.php
  72. 88
      system4.4.6/Commands/Cache/ClearCache.php
  73. 89
      system4.4.6/Commands/Cache/InfoCache.php
  74. 152
      system4.4.6/Commands/Database/CreateDatabase.php
  75. 102
      system4.4.6/Commands/Database/Migrate.php
  76. 87
      system4.4.6/Commands/Database/MigrateRefresh.php
  77. 104
      system4.4.6/Commands/Database/MigrateRollback.php
  78. 167
      system4.4.6/Commands/Database/MigrateStatus.php
  79. 82
      system4.4.6/Commands/Database/Seed.php
  80. 285
      system4.4.6/Commands/Database/ShowTableInfo.php
  81. 199
      system4.4.6/Commands/Encryption/GenerateKey.php
  82. 98
      system4.4.6/Commands/Generators/CellGenerator.php
  83. 119
      system4.4.6/Commands/Generators/CommandGenerator.php
  84. 98
      system4.4.6/Commands/Generators/ConfigGenerator.php
  85. 134
      system4.4.6/Commands/Generators/ControllerGenerator.php
  86. 84
      system4.4.6/Commands/Generators/EntityGenerator.php
  87. 84
      system4.4.6/Commands/Generators/FilterGenerator.php
  88. 90
      system4.4.6/Commands/Generators/MigrateCreate.php
  89. 129
      system4.4.6/Commands/Generators/MigrationGenerator.php
  90. 133
      system4.4.6/Commands/Generators/ModelGenerator.php
  91. 121
      system4.4.6/Commands/Generators/ScaffoldGenerator.php
  92. 84
      system4.4.6/Commands/Generators/SeederGenerator.php
  93. 113
      system4.4.6/Commands/Generators/SessionMigrationGenerator.php
  94. 84
      system4.4.6/Commands/Generators/ValidationGenerator.php
  95. 10
      system4.4.6/Commands/Generators/Views/cell.tpl.php
  96. 3
      system4.4.6/Commands/Generators/Views/cell_view.tpl.php
  97. 76
      system4.4.6/Commands/Generators/Views/command.tpl.php
  98. 10
      system4.4.6/Commands/Generators/Views/config.tpl.php
  99. 186
      system4.4.6/Commands/Generators/Views/controller.tpl.php
  100. 12
      system4.4.6/Commands/Generators/Views/entity.tpl.php
  101. Some files were not shown because too many files have changed in this diff Show More

202
app/Config--newest/App.php

@ -1,202 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class App extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Base Site URL
* --------------------------------------------------------------------------
*
* URL to your CodeIgniter root. Typically, this will be your base URL,
* WITH a trailing slash:
*
* E.g., http://example.com/
*/
public string $baseURL = BASEURL . '/engineN';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
* If you want to accept multiple Hostnames, set this.
*
* E.g.,
* When your site URL ($baseURL) is 'http://example.com/', and your site
* also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var list<string>
*/
public array $allowedHostnames = [];
/**
* --------------------------------------------------------------------------
* Index File
* --------------------------------------------------------------------------
*
* Typically, this will be your `index.php` file, unless you've renamed it to
* something else. If you have configured your web server to remove this file
* from your site URIs, set this variable to an empty string.
*/
public string $indexPage = '';
/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* --------------------------------------------------------------------------
*
* This item determines which server global should be used to retrieve the
* URI string. The default setting of 'REQUEST_URI' works for most servers.
* If your links do not seem to work, try one of the other delicious flavors:
*
* 'REQUEST_URI': Uses $_SERVER['REQUEST_URI']
* 'QUERY_STRING': Uses $_SERVER['QUERY_STRING']
* 'PATH_INFO': Uses $_SERVER['PATH_INFO']
*
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
public string $uriProtocol = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.
|
| By default, only these are allowed: `a-z 0-9~%.:_-`
|
| Set an empty string to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be used as: '/\A[<permittedURIChars>]+\z/iu'
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
public string $permittedURIChars = 'a-z 0-9~%.:_\-';
/**
* --------------------------------------------------------------------------
* Default Locale
* --------------------------------------------------------------------------
*
* The Locale roughly represents the language and location that your visitor
* is viewing the site from. It affects the language strings and other
* strings (like currency markers, numbers, etc), that your program
* should run under for this request.
*/
public string $defaultLocale = 'en';
/**
* --------------------------------------------------------------------------
* Negotiate Locale
* --------------------------------------------------------------------------
*
* If true, the current Request object will automatically determine the
* language to use based on the value of the Accept-Language header.
*
* If false, no automatic detection will be performed.
*/
public bool $negotiateLocale = false;
/**
* --------------------------------------------------------------------------
* Supported Locales
* --------------------------------------------------------------------------
*
* If $negotiateLocale is true, this array lists the locales supported
* by the application in descending order of priority. If no match is
* found, the first locale will be used.
*
* IncomingRequest::setLocale() also uses this list.
*
* @var list<string>
*/
public array $supportedLocales = ['en'];
/**
* --------------------------------------------------------------------------
* Application Timezone
* --------------------------------------------------------------------------
*
* The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone()
*
* @see https://www.php.net/manual/en/timezones.php for list of timezones
* supported by PHP.
*/
public string $appTimezone = 'Asia/Jakarta';
/**
* --------------------------------------------------------------------------
* Default Character Set
* --------------------------------------------------------------------------
*
* This determines which character set is used by default in various methods
* that require a character set to be provided.
*
* @see http://php.net/htmlspecialchars for a list of supported charsets.
*/
public string $charset = 'UTF-8';
/**
* --------------------------------------------------------------------------
* Force Global Secure Requests
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security (HSTS) header will be set.
*/
public bool $forceGlobalSecureRequests = false;
/**
* --------------------------------------------------------------------------
* Reverse Proxy IPs
* --------------------------------------------------------------------------
*
* If your server is behind a reverse proxy, you must whitelist the proxy
* IP addresses from which CodeIgniter should trust headers such as
* X-Forwarded-For or Client-IP in order to properly identify
* the visitor's IP address.
*
* You need to set a proxy IP address or IP address with subnets and
* the HTTP header for the client IP address.
*
* Here are some examples:
* [
* '10.0.1.200' => 'X-Forwarded-For',
* '192.168.5.0/24' => 'X-Real-IP',
* ]
*
* @var array<string, string>
*/
public array $proxyIPs = [];
/**
* --------------------------------------------------------------------------
* Content Security Policy
* --------------------------------------------------------------------------
*
* Enables the Response's Content Secure Policy to restrict the sources that
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
* the Response object will populate default values for the policy from the
* `ContentSecurityPolicy.php` file. Controllers can always add to those
* restrictions at run time.
*
* For a better understanding of CSP, see these documents:
*
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
* @see http://www.w3.org/TR/CSP/
*/
public bool $CSPEnabled = false;
}

94
app/Config--newest/Autoload.php

@ -1,94 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
/**
* -------------------------------------------------------------------
* AUTOLOADER CONFIGURATION
* -------------------------------------------------------------------
*
* This file defines the namespaces and class maps so the Autoloader
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
* already mapped for you.
*
* You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* @var array<string, list<string>|string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH,
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*
* @var array<string, string>
*/
public $classmap = [];
/**
* -------------------------------------------------------------------
* Files
* -------------------------------------------------------------------
* The files array provides a list of paths to __non-class__ files
* that will be autoloaded. This can be useful for bootstrap operations
* or for loading functions.
*
* Prototype:
* $files = [
* '/path/to/my/file.php',
* ];
*
* @var list<string>
*/
public $files = [];
/**
* -------------------------------------------------------------------
* Helpers
* -------------------------------------------------------------------
* Prototype:
* $helpers = [
* 'form',
* ];
*
* @var list<string>
*/
public $helpers = [];
}

34
app/Config--newest/Boot/development.php

@ -1,34 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

25
app/Config--newest/Boot/production.php

@ -1,25 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL & ~E_DEPRECATED);
// If you want to suppress more types of errors.
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
ini_set('display_errors', '0');
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', false);

38
app/Config--newest/Boot/testing.php

@ -1,38 +0,0 @@
<?php
/*
* The environment testing is reserved for PHPUnit testing. It has special
* conditions built into the framework at various places to assist with that.
* You can’t use it for your development.
*/
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

20
app/Config--newest/CURLRequest.php

@ -1,20 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class CURLRequest extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CURLRequest Share Options
* --------------------------------------------------------------------------
*
* Whether share options between requests or not.
*
* If true, all the options won't be reset between requests.
* It may cause an error request with unnecessary headers.
*/
public bool $shareOptions = false;
}

171
app/Config--newest/Cache.php

@ -1,171 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
use CodeIgniter\Cache\Handlers\PredisHandler;
use CodeIgniter\Cache\Handlers\RedisHandler;
use CodeIgniter\Cache\Handlers\WincacheHandler;
use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*/
public string $handler = 'file';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*/
public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Cache Directory Path
* --------------------------------------------------------------------------
*
* The path to where cache files should be stored, if using a file-based
* system.
*
* @deprecated Use the driver-specific variant under $file
*/
public string $storePath = WRITEPATH . 'cache/';
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*/
public int $ttl = 60;
/**
* --------------------------------------------------------------------------
* Reserved Characters
* --------------------------------------------------------------------------
*
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
*
* NOTE: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array<string, int|string|null>
*/
public array $file = [
'storePath' => WRITEPATH . 'cache/',
'mode' => 0640,
];
/**
* -------------------------------------------------------------------------
* Memcached settings
* -------------------------------------------------------------------------
* Your Memcached servers can be specified below, if you are using
* the Memcached drivers.
*
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
*
* @var array<string, bool|int|string>
*/
public array $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* -------------------------------------------------------------------------
* Redis settings
* -------------------------------------------------------------------------
* Your Redis server can be specified below, if you are using
* the Redis or Predis drivers.
*
* @var array<string, int|string|null>
*/
public array $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/**
* --------------------------------------------------------------------------
* Available Cache Handlers
* --------------------------------------------------------------------------
*
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
/**
* --------------------------------------------------------------------------
* Web Page Caching: Cache Include Query String
* --------------------------------------------------------------------------
*
* Whether to take the URL query string into consideration when generating
* output cache files. Valid options are:
*
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|list<string>
*/
public $cacheQueryString = false;
}

96
app/Config--newest/Constants.php

@ -1,96 +0,0 @@
<?php
/*
| --------------------------------------------------------------------
| App Namespace
| --------------------------------------------------------------------
|
| This defines the default Namespace that is used throughout
| CodeIgniter to refer to the Application directory. Change
| this constant to change the namespace that all application
| classes should use.
|
| NOTE: changing this will require manually modifying the
| existing namespaces of App\* namespaced-classes.
*/
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
/*
| --------------------------------------------------------------------------
| Composer Path
| --------------------------------------------------------------------------
|
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/*
|--------------------------------------------------------------------------
| Timing Constants
|--------------------------------------------------------------------------
|
| Provide simple ways to work with the myriad of PHP functions that
| require information to be in seconds.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);
/*
| --------------------------------------------------------------------------
| Exit Status Codes
| --------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https://' . $_SERVER['HTTP_HOST'] : 'http://' . $_SERVER['HTTP_HOST'];
defined('BASEURL') || define('BASEURL', $protocol);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
*/
define('EVENT_PRIORITY_LOW', 200);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
*/
define('EVENT_PRIORITY_NORMAL', 100);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
*/
define('EVENT_PRIORITY_HIGH', 10);

176
app/Config--newest/ContentSecurityPolicy.php

@ -1,176 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Stores the default settings for the ContentSecurityPolicy, if you
* choose to use it. The values here will be read in and set as defaults
* for the site. If needed, they can be overridden on a page-by-page basis.
*
* Suggested reference for explanations:
*
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
*/
class ContentSecurityPolicy extends BaseConfig
{
// -------------------------------------------------------------------------
// Broadbrush CSP management
// -------------------------------------------------------------------------
/**
* Default CSP report context
*/
public bool $reportOnly = false;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*/
public ?string $reportURI = null;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*/
public bool $upgradeInsecureRequests = false;
// -------------------------------------------------------------------------
// Sources allowed
// NOTE: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------
/**
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $defaultSrc;
/**
* Lists allowed scripts' URLs.
*
* @var list<string>|string
*/
public $scriptSrc = 'self';
/**
* Lists allowed stylesheets' URLs.
*
* @var list<string>|string
*/
public $styleSrc = 'self';
/**
* Defines the origins from which images can be loaded.
*
* @var list<string>|string
*/
public $imageSrc = 'self';
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $baseURI;
/**
* Lists the URLs for workers and embedded frame contents
*
* @var list<string>|string
*/
public $childSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var list<string>|string
*/
public $connectSrc = 'self';
/**
* Specifies the origins that can serve web fonts.
*
* @var list<string>|string
*/
public $fontSrc;
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var list<string>|string
*/
public $formAction = 'self';
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var list<string>|string|null
*/
public $frameAncestors;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var list<string>|string|null
*/
public $frameSrc;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var list<string>|string|null
*/
public $mediaSrc;
/**
* Allows control over Flash and other plugins.
*
* @var list<string>|string
*/
public $objectSrc = 'self';
/**
* @var list<string>|string|null
*/
public $manifestSrc;
/**
* Limits the kinds of plugins a page may invoke.
*
* @var list<string>|string|null
*/
public $pluginTypes;
/**
* List of actions allowed.
*
* @var list<string>|string|null
*/
public $sandbox;
/**
* Nonce tag for style
*/
public string $styleNonceTag = '{csp-style-nonce}';
/**
* Nonce tag for script
*/
public string $scriptNonceTag = '{csp-script-nonce}';
/**
* Replace nonce tag automatically
*/
public bool $autoNonce = true;
}

107
app/Config--newest/Cookie.php

@ -1,107 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use DateTimeInterface;
class Cookie extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|int|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*/
public string $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*/
public string $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*/
public bool $secure = false;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*/
public bool $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @phpstan-var 'None'|'Lax'|'Strict'|''
*/
public string $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public bool $raw = false;
}

105
app/Config--newest/Cors.php

@ -1,105 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Cross-Origin Resource Sharing (CORS) Configuration
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
*/
class Cors extends BaseConfig
{
/**
* The default CORS configuration.
*
* @var array{
* allowedOrigins: list<string>,
* allowedOriginsPatterns: list<string>,
* supportsCredentials: bool,
* allowedHeaders: list<string>,
* exposedHeaders: list<string>,
* allowedMethods: list<string>,
* maxAge: int,
* }
*/
public array $default = [
/**
* Origins for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* E.g.:
* - ['http://localhost:8080']
* - ['https://www.example.com']
*/
'allowedOrigins' => [],
/**
* Origin regex patterns for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* NOTE: A pattern specified here is part of a regular expression. It will
* be actually `#\A<pattern>\z#`.
*
* E.g.:
* - ['https://\w+\.example\.com']
*/
'allowedOriginsPatterns' => [],
/**
* Weather to send the `Access-Control-Allow-Credentials` header.
*
* The Access-Control-Allow-Credentials response header tells browsers whether
* the server allows cross-origin HTTP requests to include credentials.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
*/
'supportsCredentials' => false,
/**
* Set headers to allow.
*
* The Access-Control-Allow-Headers response header is used in response to
* a preflight request which includes the Access-Control-Request-Headers to
* indicate which HTTP headers can be used during the actual request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
*/
'allowedHeaders' => [],
/**
* Set headers to expose.
*
* The Access-Control-Expose-Headers response header allows a server to
* indicate which response headers should be made available to scripts running
* in the browser, in response to a cross-origin request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
*/
'exposedHeaders' => [],
/**
* Set methods to allow.
*
* The Access-Control-Allow-Methods response header specifies one or more
* methods allowed when accessing a resource in response to a preflight
* request.
*
* E.g.:
* - ['GET', 'POST', 'PUT', 'DELETE']
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
*/
'allowedMethods' => [],
/**
* Set how many seconds the results of a preflight request can be cached.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
*/
'maxAge' => 7200,
];
}

194
app/Config--newest/Database.php

@ -1,194 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Database\Config;
/**
* Database Configuration
*/
class Database extends Config
{
/**
* The directory that holds the Migrations and Seeds directories.
*/
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* Lets you choose which connection group to use if no other is specified.
*/
public string $defaultGroup = 'default';
/**
* The default database connection.
*
* @var array<string, mixed>
*/
public array $default = [
'hostname' => 'SIMN',
'username' => 'genapp',
'password' => 'GENAPPSIM',
'database' => '',
'DBDriver' => 'oci8',
'DBPrefix' => '',
'pconnect' => true,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'autoinit' => true,
'strictOn' => false,
'failover' => [],
'numberNative' => false,
];
// /**
// * Sample database connection for SQLite3.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'database' => 'database.db',
// 'DBDriver' => 'SQLite3',
// 'DBPrefix' => '',
// 'DBDebug' => true,
// 'swapPre' => '',
// 'failover' => [],
// 'foreignKeys' => true,
// 'busyTimeout' => 1000,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for Postgre.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'public',
// 'DBDriver' => 'Postgre',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'failover' => [],
// 'port' => 5432,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for SQLSRV.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'dbo',
// 'DBDriver' => 'SQLSRV',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'encrypt' => false,
// 'failover' => [],
// 'port' => 1433,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for OCI8.
// *
// * You may need the following environment variables:
// * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
// * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => 'localhost:1521/XEPDB1',
// 'username' => 'root',
// 'password' => 'root',
// 'DBDriver' => 'OCI8',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'AL32UTF8',
// 'swapPre' => '',
// 'failover' => [],
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
/**
* This database connection is used when running PHPUnit database tests.
*
* @var array<string, mixed>
*/
public array $tests = [
'DSN' => '',
'hostname' => '127.0.0.1',
'username' => '',
'password' => '',
'database' => ':memory:',
'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => '',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
if (ENVIRONMENT === 'testing') {
$this->defaultGroup = 'tests';
}
}
}

46
app/Config--newest/DocTypes.php

@ -1,46 +0,0 @@
<?php
namespace Config;
/**
* @immutable
*/
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}

121
app/Config--newest/Email.php

@ -1,121 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Email extends BaseConfig
{
public string $fromEmail = '';
public string $fromName = '';
public string $recipients = '';
/**
* The "user agent"
*/
public string $userAgent = 'CodeIgniter';
/**
* The mail sending protocol: mail, sendmail, smtp
*/
public string $protocol = 'mail';
/**
* The server path to Sendmail.
*/
public string $mailPath = '/usr/sbin/sendmail';
/**
* SMTP Server Hostname
*/
public string $SMTPHost = '';
/**
* SMTP Username
*/
public string $SMTPUser = '';
/**
* SMTP Password
*/
public string $SMTPPass = '';
/**
* SMTP Port
*/
public int $SMTPPort = 25;
/**
* SMTP Timeout (in seconds)
*/
public int $SMTPTimeout = 5;
/**
* Enable persistent SMTP connections
*/
public bool $SMTPKeepAlive = false;
/**
* SMTP Encryption.
*
* @var string '', 'tls' or 'ssl'. 'tls' will issue a STARTTLS command
* to the server. 'ssl' means implicit SSL. Connection on port
* 465 should set this to ''.
*/
public string $SMTPCrypto = 'tls';
/**
* Enable word-wrap
*/
public bool $wordWrap = true;
/**
* Character count to wrap at
*/
public int $wrapChars = 76;
/**
* Type of mail, either 'text' or 'html'
*/
public string $mailType = 'text';
/**
* Character set (utf-8, iso-8859-1, etc.)
*/
public string $charset = 'UTF-8';
/**
* Whether to validate the email address
*/
public bool $validate = false;
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*/
public int $priority = 3;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $CRLF = "\r\n";
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $newline = "\r\n";
/**
* Enable BCC Batch Mode.
*/
public bool $BCCBatchMode = false;
/**
* Number of emails in each BCC batch
*/
public int $BCCBatchSize = 200;
/**
* Enable notify message from server
*/
public bool $DSN = false;
}

92
app/Config--newest/Encryption.php

@ -1,92 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Encryption configuration.
*
* These are the settings used for encryption, if you don't pass a parameter
* array to the encrypter for creation/initialization.
*/
class Encryption extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
*/
public string $key = '';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*/
public string $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*/
public int $blockSize = 16;
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*/
public string $digest = 'SHA512';
/**
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
* This setting is only used by OpenSSLHandler.
*
* Set to false for CI3 Encryption compatibility.
*/
public bool $rawData = true;
/**
* Encryption key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'encryption' for CI3 Encryption compatibility.
*/
public string $encryptKeyInfo = '';
/**
* Authentication key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'authentication' for CI3 Encryption compatibility.
*/
public string $authKeyInfo = '';
/**
* Cipher to use.
* This setting is only used by OpenSSLHandler.
*
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
* by CI3 Encryption default configuration.
*/
public string $cipher = 'AES-256-CTR';
}

55
app/Config--newest/Events.php

@ -1,55 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\HotReloader\HotReloader;
/*
* --------------------------------------------------------------------
* Application Events
* --------------------------------------------------------------------
* Events allow you to tap into the execution of the program without
* modifying or extending core files. This file provides a central
* location to define your events, though they can always be added
* at run-time, also, if needed.
*
* You create code that can execute by subscribing to events with
* the 'on()' method. This accepts any form of callable, including
* Closures, that will be executed when the event is triggered.
*
* Example:
* Events::on('create', [$myInstance, 'myMethod']);
*/
Events::on('pre_system', static function () {
if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
while (ob_get_level() > 0) {
ob_end_flush();
}
ob_start(static fn ($buffer) => $buffer);
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
Services::toolbar()->respond();
// Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') {
Services::routes()->get('__hot-reload', static function () {
(new HotReloader())->run();
});
}
}
});

108
app/Config--newest/Exceptions.php

@ -1,108 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\ExceptionHandler;
use CodeIgniter\Debug\ExceptionHandlerInterface;
use Psr\Log\LogLevel;
use Throwable;
/**
* Setup how the exception handler works.
*/
class Exceptions extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*/
public bool $log = true;
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*
* @var list<int>
*/
public array $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*/
public string $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*
* @var list<string>
*/
public array $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* LOG DEPRECATIONS INSTEAD OF THROWING?
* --------------------------------------------------------------------------
* By default, CodeIgniter converts deprecations into exceptions. Also,
* starting in PHP 8.1 will cause a lot of deprecated usage warnings.
* Use this option to temporarily cease the warnings and instead log those.
* This option also works for user deprecations.
*/
public bool $logDeprecations = true;
/**
* --------------------------------------------------------------------------
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
* --------------------------------------------------------------------------
* If `$logDeprecations` is set to `true`, this sets the log level
* to which the deprecation will be logged. This should be one of the log
* levels recognized by PSR-3.
*
* The related `Config\Logger::$threshold` should be adjusted, if needed,
* to capture logging the deprecations.
*/
public string $deprecationLogLevel = LogLevel::WARNING;
/*
* DEFINE THE HANDLERS USED
* --------------------------------------------------------------------------
* Given the HTTP status code, returns exception handler that
* should be used to deal with this error. By default, it will run CodeIgniter's
* default handler and display the error information in the expected format
* for CLI, HTTP, or AJAX requests, as determined by is_cli() and the expected
* response format.
*
* Custom handlers can be returned if you want to handle one or more specific
* error codes yourself like:
*
* if (in_array($statusCode, [400, 404, 500])) {
* return new \App\Libraries\MyExceptionHandler();
* }
* if ($exception instanceOf PageNotFoundException) {
* return new \App\Libraries\MyExceptionHandler();
* }
*/
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
{
return new ExceptionHandler($this);
}
}

29
app/Config--newest/Feature.php

@ -1,29 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Enable/disable backward compatibility breaking features.
*/
class Feature extends BaseConfig
{
/**
* Use improved new auto routing instead of the default legacy version.
*/
public bool $autoRoutesImproved = false;
/**
* Use filter execution order in 4.4 or before.
*/
public bool $oldFilterOrder = false;
/**
* The behavior of `limit(0)` in Query Builder.
*
* If true, `limit(0)` returns all records. (the behavior of 4.4.x or before in version 4.x.)
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
*/
public bool $limitZeroAsAll = true;
}

107
app/Config--newest/Filters.php

@ -1,107 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\Filters as BaseFilters;
use CodeIgniter\Filters\Cors;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\ForceHTTPS;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\PageCache;
use CodeIgniter\Filters\PerformanceMetrics;
use CodeIgniter\Filters\SecureHeaders;
class Filters extends BaseFilters
{
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, class-string|list<class-string>>
*
* [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
'cors' => Cors::class,
'forcehttps' => ForceHTTPS::class,
'pagecache' => PageCache::class,
'performance' => PerformanceMetrics::class,
];
/**
* List of special required filters.
*
* The filters listed here are special. They are applied before and after
* other kinds of filters, and always applied even if a route does not exist.
*
* Filters set by default provide framework functionality. If removed,
* those functions will no longer work.
*
* @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
*
* @var array{before: list<string>, after: list<string>}
*/
public array $required = [
'before' => [
'forcehttps', // Force Global Secure Requests
'pagecache', // Web Page Caching
],
'after' => [
'pagecache', // Web Page Caching
'performance', // Performance Metrics
'toolbar', // Debug Toolbar
],
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array<string, array<string, array<string, string>>>|array<string, list<string>>
*/
public array $globals = [
'before' => [
// 'honeypot',
// 'csrf',
// 'invalidchars',
],
'after' => [
// 'honeypot',
// 'secureheaders',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'POST' => ['foo', 'bar']
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you don't expect could bypass the filter.
*
* @var array<string, list<string>>
*/
public array $methods = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*
* @var array<string, array<string, list<string>>>
*/
public array $filters = [];
}

12
app/Config--newest/ForeignCharacters.php

@ -1,12 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
/**
* @immutable
*/
class ForeignCharacters extends BaseForeignCharacters
{
}

77
app/Config--newest/Format.php

@ -1,77 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\FormatterInterface;
use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter;
class Format extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var list<string>
*/
public array $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public array $formatters = [
'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
/**
* A Factory method to return the appropriate formatter for the given mime type.
*
* @return FormatterInterface
*
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
*/
public function getFormatter(string $mime)
{
return Services::format()->getFormatter($mime);
}
}

44
app/Config--newest/Generators.php

@ -1,44 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Generators extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, array<string, string>|string>
*/
public array $views = [
'make:cell' => [
'class' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
'view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
],
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}

42
app/Config--newest/Honeypot.php

@ -1,42 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}

31
app/Config--newest/Images.php

@ -1,31 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Images\Handlers\GDHandler;
use CodeIgniter\Images\Handlers\ImageMagickHandler;
class Images extends BaseConfig
{
/**
* Default handler used if no other handler is specified.
*/
public string $defaultHandler = 'gd';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*/
public string $libraryPath = '/usr/local/bin/convert';
/**
* The available handler classes.
*
* @var array<string, string>
*/
public array $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
}

65
app/Config--newest/Kint.php

@ -1,65 +0,0 @@
<?php
namespace Config;
use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\AbstractRenderer;
use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface;
/**
* --------------------------------------------------------------------------
* Kint
* --------------------------------------------------------------------------
*
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
* that you can set to customize how Kint works for you.
*
* @see https://kint-php.github.io/kint/ for details on these settings.
*/
class Kint
{
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
/**
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
*/
public $plugins;
public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
public int $richSort = AbstractRenderer::SORT_FULL;
/**
* @var array<string, class-string<ValuePluginInterface>>|null
*/
public $richObjectPlugins;
/**
* @var array<string, class-string<TabPluginInterface>>|null
*/
public $richTabPlugins;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public bool $cliColors = true;
public bool $cliForceUTF8 = false;
public bool $cliDetectWidth = true;
public int $cliMinWidth = 40;
}

150
app/Config--newest/Logger.php

@ -1,150 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Log\Handlers\FileHandler;
class Logger extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var int|list<int>
*/
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
/**
* --------------------------------------------------------------------------
* Date Format for Logs
* --------------------------------------------------------------------------
*
* Each item that is logged has an associated date. You can use PHP date
* codes to set your own date formatting
*/
public string $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*
* @var array<class-string, array<string, int|list<string>|string>>
*/
public array $handlers = [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [
// The log levels that this handler will handle.
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
/*
* The default filename extension for log files.
* An extension of 'php' allows for protecting the log files via basic
* scripting, when they are to be stored under a publicly accessible directory.
*
* NOTE: Leaving it blank will default to 'log'.
*/
'fileExtension' => '',
/*
* The file system permissions to be applied on newly created log files.
*
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
* integer notation (i.e. 0700, 0644, etc.)
*/
'filePermissions' => 0644,
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/*
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/*
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
}

50
app/Config--newest/Migrations.php

@ -1,50 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Migrations extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*/
public bool $enabled = true;
/**
* --------------------------------------------------------------------------
* Migrations Table
* --------------------------------------------------------------------------
*
* This is the name of the table that will store the current migrations state.
* When migrations runs it will store in a database table which migration
* files have already been run.
*/
public string $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark make:migration
*
* NOTE: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*/
public string $timestampFormat = 'Y-m-d-His_';
}

536
app/Config--newest/Mimes.php

@ -1,536 +0,0 @@
<?php
namespace Config;
/**
* Mimes
*
* This file contains an array of mime types. It is used by the
* Upload class to help identify allowed file types.
*
* When more than one variation for an extension exist (like jpg, jpeg, etc)
* the most common one should be first in the array to aid the guess*
* methods. The same applies when more than one mime-type exists for a
* single extension.
*
* When working with mime types, please make sure you have the ´fileinfo´
* extension enabled to reliably detect the media types.
*
* @immutable
*/
class Mimes
{
/**
* Map of extensions to mime types.
*
* @var array<string, list<string>|string>
*/
public static array $mimes = [
'hqx' => [
'application/mac-binhex40',
'application/mac-binhex',
'application/x-binhex40',
'application/x-mac-binhex40',
],
'cpt' => 'application/mac-compactpro',
'csv' => [
'text/csv',
'text/x-comma-separated-values',
'text/comma-separated-values',
'application/vnd.ms-excel',
'application/x-csv',
'text/x-csv',
'application/csv',
'application/excel',
'application/vnd.msexcel',
'text/plain',
],
'bin' => [
'application/macbinary',
'application/mac-binary',
'application/octet-stream',
'application/x-binary',
'application/x-macbinary',
],
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => [
'application/octet-stream',
'application/vnd.microsoft.portable-executable',
'application/x-dosexec',
'application/x-msdownload',
],
'class' => 'application/octet-stream',
'psd' => [
'application/x-photoshop',
'image/vnd.adobe.photoshop',
],
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => [
'application/pdf',
'application/force-download',
'application/x-download',
],
'ai' => [
'application/pdf',
'application/postscript',
],
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => [
'application/vnd.ms-excel',
'application/msexcel',
'application/x-msexcel',
'application/x-ms-excel',
'application/x-excel',
'application/x-dos_ms_excel',
'application/xls',
'application/x-xls',
'application/excel',
'application/download',
'application/vnd.ms-office',
'application/msword',
],
'ppt' => [
'application/vnd.ms-powerpoint',
'application/powerpoint',
'application/vnd.ms-office',
'application/msword',
],
'pptx' => [
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
],
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => [
'application/x-php',
'application/x-httpd-php',
'application/php',
'text/php',
'text/x-php',
'application/x-httpd-php-source',
],
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => [
'application/x-javascript',
'text/plain',
],
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => [
'application/x-tar',
'application/x-gzip-compressed',
],
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => [
'application/x-zip',
'application/zip',
'application/x-zip-compressed',
'application/s-compressed',
'multipart/x-zip',
],
'rar' => [
'application/vnd.rar',
'application/x-rar',
'application/rar',
'application/x-rar-compressed',
],
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => [
'audio/mpeg',
'audio/mpg',
'audio/mpeg3',
'audio/mp3',
],
'aif' => [
'audio/x-aiff',
'audio/aiff',
],
'aiff' => [
'audio/x-aiff',
'audio/aiff',
],
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => [
'audio/x-wav',
'audio/wave',
'audio/wav',
],
'bmp' => [
'image/bmp',
'image/x-bmp',
'image/x-bitmap',
'image/x-xbitmap',
'image/x-win-bitmap',
'image/x-windows-bmp',
'image/ms-bmp',
'image/x-ms-bmp',
'application/bmp',
'application/x-bmp',
'application/x-win-bitmap',
],
'gif' => 'image/gif',
'jpg' => [
'image/jpeg',
'image/pjpeg',
],
'jpeg' => [
'image/jpeg',
'image/pjpeg',
],
'jpe' => [
'image/jpeg',
'image/pjpeg',
],
'jp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'j2k' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpf' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpg2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpx' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpm' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mj2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mjp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'png' => [
'image/png',
'image/x-png',
],
'webp' => 'image/webp',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'css' => [
'text/css',
'text/plain',
],
'html' => [
'text/html',
'text/plain',
],
'htm' => [
'text/html',
'text/plain',
],
'shtml' => [
'text/html',
'text/plain',
],
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => [
'text/plain',
'text/x-log',
],
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => [
'application/xml',
'text/xml',
'text/plain',
],
'xsl' => [
'application/xml',
'text/xsl',
'text/xml',
],
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => [
'video/x-msvideo',
'video/msvideo',
'video/avi',
'application/x-troff-msvideo',
],
'movie' => 'video/x-sgi-movie',
'doc' => [
'application/msword',
'application/vnd.ms-office',
],
'docx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
'application/x-zip',
],
'dot' => [
'application/msword',
'application/vnd.ms-office',
],
'dotx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
],
'xlsx' => [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/zip',
'application/vnd.ms-excel',
'application/msword',
'application/x-zip',
],
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'word' => [
'application/msword',
'application/octet-stream',
],
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => [
'application/json',
'text/json',
],
'pem' => [
'application/x-x509-user-cert',
'application/x-pem-file',
'application/octet-stream',
],
'p10' => [
'application/x-pkcs10',
'application/pkcs10',
],
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7m' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => [
'application/x-x509-ca-cert',
'application/x-x509-user-cert',
'application/pkix-cert',
],
'crl' => [
'application/pkix-crl',
'application/pkcs-crl',
],
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => [
'application/pkix-cert',
'application/x-x509-ca-cert',
],
'3g2' => 'video/3gpp2',
'3gp' => [
'video/3gp',
'video/3gpp',
],
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => [
'video/mp4',
'video/x-f4v',
],
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => [
'video/x-ms-wmv',
'video/x-ms-asf',
],
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => [
'audio/ogg',
'video/ogg',
'application/ogg',
],
'kmz' => [
'application/vnd.google-earth.kmz',
'application/zip',
'application/x-zip',
],
'kml' => [
'application/vnd.google-earth.kml+xml',
'application/xml',
'text/xml',
],
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => [
'application/x-compressed',
'application/x-zip-compressed',
'application/zip',
'multipart/x-zip',
],
'cdr' => [
'application/cdr',
'application/coreldraw',
'application/x-cdr',
'application/x-coreldraw',
'image/cdr',
'image/x-cdr',
'zz-application/zz-winassoc-cdr',
],
'wma' => [
'audio/x-ms-wma',
'video/x-ms-asf',
],
'jar' => [
'application/java-archive',
'application/x-java-application',
'application/x-jar',
'application/x-compressed',
],
'svg' => [
'image/svg+xml',
'image/svg',
'application/xml',
'text/xml',
],
'vcf' => 'text/x-vcard',
'srt' => [
'text/srt',
'text/plain',
],
'vtt' => [
'text/vtt',
'text/plain',
],
'ico' => [
'image/x-icon',
'image/x-ico',
'image/vnd.microsoft.icon',
],
'stl' => [
'application/sla',
'application/vnd.ms-pki.stl',
'application/x-navistyle',
],
];
/**
* Attempts to determine the best mime type for the given file extension.
*
* @return string|null The mime type found, or none if unable to determine.
*/
public static function guessTypeFromExtension(string $extension)
{
$extension = trim(strtolower($extension), '. ');
if (! array_key_exists($extension, static::$mimes)) {
return null;
}
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
}
/**
* Attempts to determine the best file extension for a given mime type.
*
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
*
* @return string|null The extension determined, or null if unable to match.
*/
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null)
{
$type = trim(strtolower($type), '. ');
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
if (
$proposedExtension !== ''
&& array_key_exists($proposedExtension, static::$mimes)
&& in_array($type, (array) static::$mimes[$proposedExtension], true)
) {
// The detected mime type matches with the proposed extension.
return $proposedExtension;
}
// Reverse check the mime type list if no extension was proposed.
// This search is order sensitive!
foreach (static::$mimes as $ext => $types) {
if (in_array($type, (array) $types, true)) {
return $ext;
}
}
return null;
}
}

84
app/Config--newest/Modules.php

@ -1,84 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Modules\Modules as BaseModules;
/**
* Modules Configuration.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Modules extends BaseModules
{
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var bool
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var bool
*/
public $discoverInComposer = true;
/**
* The Composer package list for Auto-Discovery
* This setting is optional.
*
* E.g.:
* [
* 'only' => [
* // List up all packages to auto-discover
* 'codeigniter4/shield',
* ],
* ]
* or
* [
* 'exclude' => [
* // List up packages to exclude.
* 'pestphp/pest',
* ],
* ]
*
* @var array{only?: list<string>, exclude?: list<string>}
*/
public $composerPackages = [];
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var list<string>
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
}

32
app/Config--newest/Optimize.php

@ -1,32 +0,0 @@
<?php
namespace Config;
/**
* Optimization Configuration.
*
* NOTE: This class does not extend BaseConfig for performance reasons.
* So you cannot replace the property values with Environment Variables.
*
* @immutable
*/
class Optimize
{
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/factories.html#config-caching
*/
public bool $configCacheEnabled = false;
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/autoloader.html#file-locator-caching
*/
public bool $locatorCacheEnabled = false;
}

37
app/Config--newest/Pager.php

@ -1,37 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Pager extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*/
public int $perPage = 20;
}

80
app/Config--newest/Paths.php

@ -1,80 +0,0 @@
<?php
namespace Config;
/**
* Paths
*
* Holds the paths that are used by the system to
* locate the main directories, app, system, etc.
*
* Modifying these allows you to restructure your application,
* share a system folder between multiple applications, and more.
*
* All paths are relative to the project's root folder.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Paths
{
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*/
public string $systemDirectory = __DIR__ . '/../../system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*/
public string $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*/
public string $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*/
public string $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*/
public string $viewDirectory = __DIR__ . '/../Views';
}

28
app/Config--newest/Publisher.php

@ -1,28 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}

9
app/Config--newest/Routes.php

@ -1,9 +0,0 @@
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
$routes->get('/', 'Auth::index');
$routes->post('auth/login', 'Auth::login');

140
app/Config--newest/Routing.php

@ -1,140 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Config;
use CodeIgniter\Config\Routing as BaseRouting;
/**
* Routing configuration
*/
class Routing extends BaseRouting
{
/**
* For Defined Routes.
* An array of files that contain route definitions.
* Route files are read in order, with the first match
* found taking precedence.
*
* Default: APPPATH . 'Config/Routes.php'
*
* @var list<string>
*/
public array $routeFiles = [
APPPATH . 'Config/Routes.php',
];
/**
* For Defined Routes and Auto Routing.
* The default namespace to use for Controllers when no other
* namespace has been specified.
*
* Default: 'App\Controllers'
*/
public string $defaultNamespace = 'App\Controllers';
/**
* For Auto Routing.
* The default controller to use when no other controller has been
* specified.
*
* Default: 'Home'
*/
public string $defaultController = 'Home';
/**
* For Defined Routes and Auto Routing.
* The default method to call on the controller when no other
* method has been set in the route.
*
* Default: 'index'
*/
public string $defaultMethod = 'index';
/**
* For Auto Routing.
* Whether to translate dashes in URIs for controller/method to underscores.
* Primarily useful when using the auto-routing.
*
* Default: false
*/
public bool $translateURIDashes = false;
/**
* Sets the class/method that should be called if routing doesn't
* find a match. It can be the controller/method name like: Users::index
*
* This setting is passed to the Router class and handled there.
*
* If you want to use a closure, you will have to set it in the
* routes file by calling:
*
* $routes->set404Override(function() {
* // Do something here
* });
*
* Example:
* public $override404 = 'App\Errors::show404';
*/
public ?string $override404 = null;
/**
* If TRUE, the system will attempt to match the URI against
* Controllers by matching each segment against folders/files
* in APPPATH/Controllers, when a match wasn't found against
* defined routes.
*
* If FALSE, will stop searching and do NO automatic routing.
*/
public bool $autoRoute = false;
/**
* For Defined Routes.
* If TRUE, will enable the use of the 'prioritize' option
* when defining routes.
*
* Default: false
*/
public bool $prioritize = false;
/**
* For Defined Routes.
* If TRUE, matched multiple URI segments will be passed as one parameter.
*
* Default: false
*/
public bool $multipleSegmentsOneParam = false;
/**
* For Auto Routing (Improved).
* Map of URI segments and namespaces.
*
* The key is the first URI segment. The value is the controller namespace.
* E.g.,
* [
* 'blog' => 'Acme\Blog\Controllers',
* ]
*
* @var array<string, string>
*/
public array $moduleRoutes = [];
/**
* For Auto Routing (Improved).
* Whether to translate dashes in URIs for controller/method to CamelCase.
* E.g., blog-controller -> BlogController
*
* If you enable this, $translateURIDashes is ignored.
*
* Default: false
*/
public bool $translateUriToCamelCase = false;
}

103
app/Config--newest/Security.php

@ -1,103 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Protection Method
* --------------------------------------------------------------------------
*
* Protection Method for Cross Site Request Forgery protection.
*
* @var string 'cookie' or 'session'
*/
public string $csrfProtection = 'cookie';
/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*/
public bool $tokenRandomize = false;
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection.
*/
public string $tokenName = 'csrf_test_name';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Header name for Cross Site Request Forgery protection.
*/
public string $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection.
*/
public string $cookieName = 'csrf_cookie_name';
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*/
public int $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every submission.
*/
public bool $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
*/
public bool $redirect = (ENVIRONMENT === 'production');
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token.
*
* Allowed values are: None - Lax - Strict - ''.
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*/
public string $samesite = 'Lax';
}

32
app/Config--newest/Services.php

@ -1,32 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseService;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
}

127
app/Config--newest/Session.php

@ -1,127 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\FileHandler;
class Session extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @var class-string<BaseHandler>
*/
public string $driver = FileHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ci_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
public int $expiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is driver dependent.
*
* For the 'files' driver, it's a path to a writable directory.
* WARNING: Only absolute paths are supported!
*
* For the 'database' driver, it's a table name.
* Please read up the manual for the format with other session drivers.
*
* IMPORTANT: You are REQUIRED to set a valid save path!
*/
public string $savePath = WRITEPATH . 'session';
/**
* --------------------------------------------------------------------------
* Session Match IP
* --------------------------------------------------------------------------
*
* Whether to match the user's IP address when reading the session data.
*
* WARNING: If you're using the database driver, don't forget to update
* your session table's PRIMARY KEY when changing this setting.
*/
public bool $matchIP = false;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*/
public int $timeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session Regenerate Destroy
* --------------------------------------------------------------------------
*
* Whether to destroy session data associated with the old session ID
* when auto-regenerating the session ID. When set to FALSE, the data
* will be later deleted by the garbage collector.
*/
public bool $regenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*/
public ?string $DBGroup = null;
/**
* --------------------------------------------------------------------------
* Lock Retry Interval (microseconds)
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Time (microseconds) to wait if lock cannot be acquired.
* The default is 100,000 microseconds (= 0.1 seconds).
*/
public int $lockRetryInterval = 100_000;
/**
* --------------------------------------------------------------------------
* Lock Max Retries
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Maximum number of lock acquisition attempts.
* The default is 300 times. That is lock timeout is about 30 (0.1 * 300)
* seconds.
*/
public int $lockMaxRetries = 300;
}

122
app/Config--newest/Toolbar.php

@ -1,122 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\Toolbar\Collectors\Database;
use CodeIgniter\Debug\Toolbar\Collectors\Events;
use CodeIgniter\Debug\Toolbar\Collectors\Files;
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
use CodeIgniter\Debug\Toolbar\Collectors\Views;
/**
* --------------------------------------------------------------------------
* Debug Toolbar
* --------------------------------------------------------------------------
*
* The Debug Toolbar provides a way to see information about the performance
* and state of your application during that page display. By default it will
* NOT be displayed under production environments, and will only display if
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
*/
class Toolbar extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var list<class-string>
*/
public array $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be collected. Useful to
* avoid high memory usage when there are lots of data passed to the view.
*/
public bool $collectVarData = true;
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*/
public int $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*/
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;
/**
* --------------------------------------------------------------------------
* Watched Directories
* --------------------------------------------------------------------------
*
* Contains an array of directories that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
* We restrict the values to keep performance as high as possible.
*
* NOTE: The ROOTPATH will be prepended to all values.
*
* @var list<string>
*/
public array $watchedDirectories = [
'app',
];
/**
* --------------------------------------------------------------------------
* Watched File Extensions
* --------------------------------------------------------------------------
*
* Contains an array of file extensions that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
*
* @var list<string>
*/
public array $watchedExtensions = [
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
];
}

252
app/Config--newest/UserAgents.php

@ -1,252 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* -------------------------------------------------------------------
* User Agents
* -------------------------------------------------------------------
*
* This file contains four arrays of user agent data. It is used by the
* User Agent Class to help identify browser, platform, robot, and
* mobile device data. The array keys are used to identify the device
* and the array values are used to set the actual name of the item.
*/
class UserAgents extends BaseConfig
{
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $platforms = [
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public array $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $mobiles = [
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public array $robots = [
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot',
];
}

44
app/Config--newest/Validation.php

@ -1,44 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
class Validation extends BaseConfig
{
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var list<string>
*/
public array $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public array $templates = [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}

62
app/Config--newest/View.php

@ -1,62 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\View as BaseView;
use CodeIgniter\View\ViewDecoratorInterface;
/**
* @phpstan-type parser_callable (callable(mixed): mixed)
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
*/
class View extends BaseView
{
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var bool
*/
public $saveData = true;
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array<string, string>
* @phpstan-var array<string, parser_callable_string>
*/
public $filters = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array<string, callable|list<string>|string>
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
*/
public $plugins = [];
/**
* View Decorators are class methods that will be run in sequence to
* have a chance to alter the generated output just prior to caching
* the results.
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var list<class-string<ViewDecoratorInterface>>
*/
public array $decorators = [];
}

2
app/Views/inc/js.php

@ -12,7 +12,9 @@
<script src="<?= base_url('public/theme/plugins/moment/moment.js') ?>"></script>
<script src="<?= base_url('public/theme/plugins/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js') ?>"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
<script src="<?= base_url('public/theme/js/tables.js') ?>"></script>
<script src="<?= base_url('public/theme/dist/js/theme.js') ?>"></script>
<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>

4
app/Views/inc/sidebar.php

@ -49,9 +49,9 @@
</div>
</div> -->
<div class="nav-item has-sub">
<a href="#"><i class="ik ik-crosshair"></i><span>Titik Kontrol</span> <span class="badge badge-danger">New</span></a>
<a href="#"><i class="ik ik-crosshair"></i><span>Raport</span> <span class="badge badge-danger">New</span></a>
<div class="submenu-content">
<a href="<?= base_url() ?>auth/underconst" class="menu-item">Aktivitas</a>
<a href="<?= base_url() ?>rapor/wpbayar" class="menu-item">WP Bayar</a>
</div>
</div>

3
app/Views/ppm/dashboard.php

@ -64,7 +64,8 @@
$jml_penerimaan = 0;
$jml_penlalu = 0;
$jml_penerimaantot =0;
$pentotlalu =0;
foreach ($pie_penerimaan as $_junk => $data) {
$jml_penerimaan = $jml_penerimaan + $data->PENERIMAAN;
$jml_penerimaantot = $data->PENERIMAAN_TOT;

6
system4.4.6/.htaccess

@ -1,6 +0,0 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

359
system4.4.6/API/ResponseTrait.php

@ -1,359 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\API;
use CodeIgniter\Format\FormatterInterface;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Services;
/**
* Provides common, more readable, methods to provide
* consistent HTTP responses under a variety of common
* situations when working as an API.
*/
trait ResponseTrait
{
/**
* Allows child classes to override the
* status code that is used in their API.
*
* @var array<string, int>
*/
protected $codes = [
'created' => 201,
'deleted' => 200,
'updated' => 200,
'no_content' => 204,
'invalid_request' => 400,
'unsupported_response_type' => 400,
'invalid_scope' => 400,
'temporarily_unavailable' => 400,
'invalid_grant' => 400,
'invalid_credentials' => 400,
'invalid_refresh' => 400,
'no_data' => 400,
'invalid_data' => 400,
'access_denied' => 401,
'unauthorized' => 401,
'invalid_client' => 401,
'forbidden' => 403,
'resource_not_found' => 404,
'not_acceptable' => 406,
'resource_exists' => 409,
'conflict' => 409,
'resource_gone' => 410,
'payload_too_large' => 413,
'unsupported_media_type' => 415,
'too_many_requests' => 429,
'server_error' => 500,
'unsupported_grant_type' => 501,
'not_implemented' => 501,
];
/**
* How to format the response data.
* Either 'json' or 'xml'. If blank will be
* determined through content negotiation.
*
* @var string
*/
protected $format = 'json';
/**
* Current Formatter instance. This is usually set by ResponseTrait::format
*
* @var FormatterInterface|null
*/
protected $formatter;
/**
* Provides a single, simple method to return an API response, formatted
* to match the requested format, with proper content-type and status code.
*
* @param array|string|null $data
*
* @return ResponseInterface
*/
protected function respond($data = null, ?int $status = null, string $message = '')
{
if ($data === null && $status === null) {
$status = 404;
$output = null;
$this->format($data);
} elseif ($data === null && is_numeric($status)) {
$output = null;
$this->format($data);
} else {
$status ??= 200;
$output = $this->format($data);
}
if ($output !== null) {
if ($this->format === 'json') {
return $this->response->setJSON($output)->setStatusCode($status, $message);
}
if ($this->format === 'xml') {
return $this->response->setXML($output)->setStatusCode($status, $message);
}
}
return $this->response->setBody($output)->setStatusCode($status, $message);
}
/**
* Used for generic failures that no custom methods exist for.
*
* @param array|string $messages
* @param int $status HTTP status code
* @param string|null $code Custom, API-specific, error code
*
* @return ResponseInterface
*/
protected function fail($messages, int $status = 400, ?string $code = null, string $customMessage = '')
{
if (! is_array($messages)) {
$messages = ['error' => $messages];
}
$response = [
'status' => $status,
'error' => $code ?? $status,
'messages' => $messages,
];
return $this->respond($response, $status, $customMessage);
}
// --------------------------------------------------------------------
// Response Helpers
// --------------------------------------------------------------------
/**
* Used after successfully creating a new resource.
*
* @param array|string|null $data
*
* @return ResponseInterface
*/
protected function respondCreated($data = null, string $message = '')
{
return $this->respond($data, $this->codes['created'], $message);
}
/**
* Used after a resource has been successfully deleted.
*
* @param array|string|null $data
*
* @return ResponseInterface
*/
protected function respondDeleted($data = null, string $message = '')
{
return $this->respond($data, $this->codes['deleted'], $message);
}
/**
* Used after a resource has been successfully updated.
*
* @param array|string|null $data
*
* @return ResponseInterface
*/
protected function respondUpdated($data = null, string $message = '')
{
return $this->respond($data, $this->codes['updated'], $message);
}
/**
* Used after a command has been successfully executed but there is no
* meaningful reply to send back to the client.
*
* @return ResponseInterface
*/
protected function respondNoContent(string $message = 'No Content')
{
return $this->respond(null, $this->codes['no_content'], $message);
}
/**
* Used when the client is either didn't send authorization information,
* or had bad authorization credentials. User is encouraged to try again
* with the proper information.
*
* @return ResponseInterface
*/
protected function failUnauthorized(string $description = 'Unauthorized', ?string $code = null, string $message = '')
{
return $this->fail($description, $this->codes['unauthorized'], $code, $message);
}
/**
* Used when access is always denied to this resource and no amount
* of trying again will help.
*
* @return ResponseInterface
*/
protected function failForbidden(string $description = 'Forbidden', ?string $code = null, string $message = '')
{
return $this->fail($description, $this->codes['forbidden'], $code, $message);
}
/**
* Used when a specified resource cannot be found.
*
* @return ResponseInterface
*/
protected function failNotFound(string $description = 'Not Found', ?string $code = null, string $message = '')
{
return $this->fail($description, $this->codes['resource_not_found'], $code, $message);
}
/**
* Used when the data provided by the client cannot be validated.
*
* @return ResponseInterface
*
* @deprecated Use failValidationErrors instead
*/
protected function failValidationError(string $description = 'Bad Request', ?string $code = null, string $message = '')
{
return $this->fail($description, $this->codes['invalid_data'], $code, $message);
}
/**
* Used when the data provided by the client cannot be validated on one or more fields.
*
* @param string|string[] $errors
*
* @return ResponseInterface
*/
protected function failValidationErrors($errors, ?string $code = null, string $message = '')
{
return $this->fail($errors, $this->codes['invalid_data'], $code, $message);
}
/**
* Use when trying to create a new resource and it already exists.
*
* @return ResponseInterface
*/
protected function failResourceExists(string $description = 'Conflict', ?string $code = null, string $message = '')
{
return $this->fail($description, $this->codes['resource_exists'], $code, $message);
}
/**
* Use when a resource was previously deleted. This is different than
* Not Found, because here we know the data previously existed, but is now gone,
* where Not Found means we simply cannot find any information about it.
*
* @return ResponseInterface
*/
protected function failResourceGone(string $description = 'Gone', ?string $code = null, string $message = '')
{
return $this->fail($description, $this->codes['resource_gone'], $code, $message);
}
/**
* Used when the user has made too many requests for the resource recently.
*
* @return ResponseInterface
*/
protected function failTooManyRequests(string $description = 'Too Many Requests', ?string $code = null, string $message = '')
{
return $this->fail($description, $this->codes['too_many_requests'], $code, $message);
}
/**
* Used when there is a server error.
*
* @param string $description The error message to show the user.
* @param string|null $code A custom, API-specific, error code.
* @param string $message A custom "reason" message to return.
*/
protected function failServerError(string $description = 'Internal Server Error', ?string $code = null, string $message = ''): ResponseInterface
{
return $this->fail($description, $this->codes['server_error'], $code, $message);
}
// --------------------------------------------------------------------
// Utility Methods
// --------------------------------------------------------------------
/**
* Handles formatting a response. Currently makes some heavy assumptions
* and needs updating! :)
*
* @param array|string|null $data
*
* @return string|null
*/
protected function format($data = null)
{
// If the data is a string, there's not much we can do to it...
if (is_string($data)) {
// The content type should be text/... and not application/...
$contentType = $this->response->getHeaderLine('Content-Type');
$contentType = str_replace('application/json', 'text/html', $contentType);
$contentType = str_replace('application/', 'text/', $contentType);
$this->response->setContentType($contentType);
$this->format = 'html';
return $data;
}
$format = Services::format();
$mime = "application/{$this->format}";
// Determine correct response type through content negotiation if not explicitly declared
if (
! in_array($this->format, ['json', 'xml'], true)
&& $this->request instanceof IncomingRequest
) {
$mime = $this->request->negotiate(
'media',
$format->getConfig()->supportedResponseFormats,
false
);
}
$this->response->setContentType($mime);
// if we don't have a formatter, make one
if (! isset($this->formatter)) {
// if no formatter, use the default
$this->formatter = $format->getFormatter($mime);
}
if ($mime !== 'application/json') {
// Recursively convert objects into associative arrays
// Conversion not required for JSONFormatter
$data = json_decode(json_encode($data), true);
}
return $this->formatter->format($data);
}
/**
* Sets the format the response should be in.
*
* @return $this
*/
protected function setResponseFormat(?string $format = null)
{
$this->format = strtolower($format);
return $this;
}
}

490
system4.4.6/Autoloader/Autoloader.php

@ -1,490 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Autoloader;
use CodeIgniter\Exceptions\ConfigException;
use Composer\Autoload\ClassLoader;
use Composer\InstalledVersions;
use Config\Autoload;
use Config\Modules;
use InvalidArgumentException;
use RuntimeException;
/**
* An autoloader that uses both PSR4 autoloading, and traditional classmaps.
*
* Given a foo-bar package of classes in the file system at the following paths:
* ```
* /path/to/packages/foo-bar/
* /src
* Baz.php # Foo\Bar\Baz
* Qux/
* Quux.php # Foo\Bar\Qux\Quux
* ```
* you can add the path to the configuration array that is passed in the constructor.
* The Config array consists of 2 primary keys, both of which are associative arrays:
* 'psr4', and 'classmap'.
* ```
* $Config = [
* 'psr4' => [
* 'Foo\Bar' => '/path/to/packages/foo-bar'
* ],
* 'classmap' => [
* 'MyClass' => '/path/to/class/file.php'
* ]
* ];
* ```
* Example:
* ```
* <?php
* // our configuration array
* $Config = [ ... ];
* $loader = new \CodeIgniter\Autoloader\Autoloader($Config);
*
* // register the autoloader
* $loader->register();
* ```
*
* @see \CodeIgniter\Autoloader\AutoloaderTest
*/
class Autoloader
{
/**
* Stores namespaces as key, and path as values.
*
* @var array<string, array<string>>
*/
protected $prefixes = [];
/**
* Stores class name as key, and path as values.
*
* @var array<string, string>
*/
protected $classmap = [];
/**
* Stores files as a list.
*
* @var list<string>
*/
protected $files = [];
/**
* Stores helper list.
* Always load the URL helper, it should be used in most apps.
*
* @var list<string>
*/
protected $helpers = ['url'];
/**
* Reads in the configuration array (described above) and stores
* the valid parts that we'll need.
*
* @return $this
*/
public function initialize(Autoload $config, Modules $modules)
{
$this->prefixes = [];
$this->classmap = [];
$this->files = [];
// We have to have one or the other, though we don't enforce the need
// to have both present in order to work.
if ($config->psr4 === [] && $config->classmap === []) {
throw new InvalidArgumentException('Config array must contain either the \'psr4\' key or the \'classmap\' key.');
}
if ($config->psr4 !== []) {
$this->addNamespace($config->psr4);
}
if ($config->classmap !== []) {
$this->classmap = $config->classmap;
}
if ($config->files !== []) {
$this->files = $config->files;
}
if (isset($config->helpers)) {
$this->helpers = [...$this->helpers, ...$config->helpers];
}
if (is_file(COMPOSER_PATH)) {
$this->loadComposerAutoloader($modules);
}
return $this;
}
private function loadComposerAutoloader(Modules $modules): void
{
// The path to the vendor directory.
// We do not want to enforce this, so set the constant if Composer was used.
if (! defined('VENDORPATH')) {
define('VENDORPATH', dirname(COMPOSER_PATH) . DIRECTORY_SEPARATOR);
}
/** @var ClassLoader $composer */
$composer = include COMPOSER_PATH;
$this->loadComposerClassmap($composer);
// Should we load through Composer's namespaces, also?
if ($modules->discoverInComposer) {
// @phpstan-ignore-next-line
$this->loadComposerNamespaces($composer, $modules->composerPackages ?? []);
}
unset($composer);
}
/**
* Register the loader with the SPL autoloader stack.
*
* @return void
*/
public function register()
{
// Prepend the PSR4 autoloader for maximum performance.
spl_autoload_register([$this, 'loadClass'], true, true);
// Now prepend another loader for the files in our class map.
spl_autoload_register([$this, 'loadClassmap'], true, true);
// Load our non-class files
foreach ($this->files as $file) {
$this->includeFile($file);
}
}
/**
* Unregister autoloader.
*
* This method is for testing.
*/
public function unregister(): void
{
spl_autoload_unregister([$this, 'loadClass']);
spl_autoload_unregister([$this, 'loadClassmap']);
}
/**
* Registers namespaces with the autoloader.
*
* @param array<string, list<string>|string>|string $namespace
*
* @return $this
*/
public function addNamespace($namespace, ?string $path = null)
{
if (is_array($namespace)) {
foreach ($namespace as $prefix => $namespacedPath) {
$prefix = trim($prefix, '\\');
if (is_array($namespacedPath)) {
foreach ($namespacedPath as $dir) {
$this->prefixes[$prefix][] = rtrim($dir, '\\/') . DIRECTORY_SEPARATOR;
}
continue;
}
$this->prefixes[$prefix][] = rtrim($namespacedPath, '\\/') . DIRECTORY_SEPARATOR;
}
} else {
$this->prefixes[trim($namespace, '\\')][] = rtrim($path, '\\/') . DIRECTORY_SEPARATOR;
}
return $this;
}
/**
* Get namespaces with prefixes as keys and paths as values.
*
* If a prefix param is set, returns only paths to the given prefix.
*
* @return array
*/
public function getNamespace(?string $prefix = null)
{
if ($prefix === null) {
return $this->prefixes;
}
return $this->prefixes[trim($prefix, '\\')] ?? [];
}
/**
* Removes a single namespace from the psr4 settings.
*
* @return $this
*/
public function removeNamespace(string $namespace)
{
if (isset($this->prefixes[trim($namespace, '\\')])) {
unset($this->prefixes[trim($namespace, '\\')]);
}
return $this;
}
/**
* Load a class using available class mapping.
*
* @internal For `spl_autoload_register` use.
*/
public function loadClassmap(string $class): void
{
$file = $this->classmap[$class] ?? '';
if (is_string($file) && $file !== '') {
$this->includeFile($file);
}
}
/**
* Loads the class file for a given class name.
*
* @internal For `spl_autoload_register` use.
*
* @param string $class The fully qualified class name.
*/
public function loadClass(string $class): void
{
$this->loadInNamespace($class);
}
/**
* Loads the class file for a given class name.
*
* @param string $class The fully-qualified class name
*
* @return false|string The mapped file name on success, or boolean false on fail
*/
protected function loadInNamespace(string $class)
{
if (strpos($class, '\\') === false) {
return false;
}
foreach ($this->prefixes as $namespace => $directories) {
if (strpos($class, $namespace) === 0) {
$relativeClassPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, strlen($namespace)));
foreach ($directories as $directory) {
$directory = rtrim($directory, '\\/');
$filePath = $directory . $relativeClassPath . '.php';
$filename = $this->includeFile($filePath);
if ($filename) {
return $filename;
}
}
}
}
// never found a mapped file
return false;
}
/**
* A central way to include a file. Split out primarily for testing purposes.
*
* @return false|string The filename on success, false if the file is not loaded
*/
protected function includeFile(string $file)
{
if (is_file($file)) {
include_once $file;
return $file;
}
return false;
}
/**
* Check file path.
*
* Checks special characters that are illegal in filenames on certain
* operating systems and special characters requiring special escaping
* to manipulate at the command line. Replaces spaces and consecutive
* dashes with a single dash. Trim period, dash and underscore from beginning
* and end of filename.
*
* @return string The sanitized filename
*
* @deprecated No longer used. See https://github.com/codeigniter4/CodeIgniter4/issues/7055
*/
public function sanitizeFilename(string $filename): string
{
// Only allow characters deemed safe for POSIX portable filenames.
// Plus the forward slash for directory separators since this might be a path.
// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_278
// Modified to allow backslash and colons for on Windows machines.
$result = preg_match_all('/[^0-9\p{L}\s\/\-_.:\\\\]/u', $filename, $matches);
if ($result > 0) {
$chars = implode('', $matches[0]);
throw new InvalidArgumentException(
'The file path contains special characters "' . $chars
. '" that are not allowed: "' . $filename . '"'
);
}
if ($result === false) {
if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
$message = preg_last_error_msg();
} else {
$message = 'Regex error. error code: ' . preg_last_error();
}
throw new RuntimeException($message . '. filename: "' . $filename . '"');
}
// Clean up our filename edges.
$cleanFilename = trim($filename, '.-_');
if ($filename !== $cleanFilename) {
throw new InvalidArgumentException('The characters ".-_" are not allowed in filename edges: "' . $filename . '"');
}
return $cleanFilename;
}
private function loadComposerNamespaces(ClassLoader $composer, array $composerPackages): void
{
$namespacePaths = $composer->getPrefixesPsr4();
// Get rid of CodeIgniter so we don't have duplicates
if (isset($namespacePaths['CodeIgniter\\'])) {
unset($namespacePaths['CodeIgniter\\']);
}
if (! method_exists(InstalledVersions::class, 'getAllRawData')) {
throw new RuntimeException(
'Your Composer version is too old.'
. ' Please update Composer (run `composer self-update`) to v2.0.14 or later'
. ' and remove your vendor/ directory, and run `composer update`.'
);
}
// This method requires Composer 2.0.14 or later.
$allData = InstalledVersions::getAllRawData();
$packageList = [];
foreach ($allData as $list) {
$packageList = array_merge($packageList, $list['versions']);
}
// Check config for $composerPackages.
$only = $composerPackages['only'] ?? [];
$exclude = $composerPackages['exclude'] ?? [];
if ($only !== [] && $exclude !== []) {
throw new ConfigException('Cannot use "only" and "exclude" at the same time in "Config\Modules::$composerPackages".');
}
// Get install paths of packages to add namespace for auto-discovery.
$installPaths = [];
if ($only !== []) {
foreach ($packageList as $packageName => $data) {
if (in_array($packageName, $only, true) && isset($data['install_path'])) {
$installPaths[] = $data['install_path'];
}
}
} else {
foreach ($packageList as $packageName => $data) {
if (! in_array($packageName, $exclude, true) && isset($data['install_path'])) {
$installPaths[] = $data['install_path'];
}
}
}
$newPaths = [];
foreach ($namespacePaths as $namespace => $srcPaths) {
$add = false;
foreach ($srcPaths as $path) {
foreach ($installPaths as $installPath) {
if ($installPath === substr($path, 0, strlen($installPath))) {
$add = true;
break 2;
}
}
}
if ($add) {
// Composer stores namespaces with trailing slash. We don't.
$newPaths[rtrim($namespace, '\\ ')] = $srcPaths;
}
}
$this->addNamespace($newPaths);
}
private function loadComposerClassmap(ClassLoader $composer): void
{
$classes = $composer->getClassMap();
$this->classmap = array_merge($this->classmap, $classes);
}
/**
* Locates autoload information from Composer, if available.
*
* @deprecated No longer used.
*
* @return void
*/
protected function discoverComposerNamespaces()
{
if (! is_file(COMPOSER_PATH)) {
return;
}
/**
* @var ClassLoader $composer
*/
$composer = include COMPOSER_PATH;
$paths = $composer->getPrefixesPsr4();
$classes = $composer->getClassMap();
unset($composer);
// Get rid of CodeIgniter so we don't have duplicates
if (isset($paths['CodeIgniter\\'])) {
unset($paths['CodeIgniter\\']);
}
$newPaths = [];
foreach ($paths as $key => $value) {
// Composer stores namespaces with trailing slash. We don't.
$newPaths[rtrim($key, '\\ ')] = $value;
}
$this->prefixes = array_merge($this->prefixes, $newPaths);
$this->classmap = array_merge($this->classmap, $classes);
}
/**
* Loads helpers
*/
public function loadHelpers(): void
{
helper($this->helpers);
}
}

386
system4.4.6/Autoloader/FileLocator.php

@ -1,386 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Autoloader;
/**
* Allows loading non-class files in a namespaced manner.
* Works with Helpers, Views, etc.
*
* @see \CodeIgniter\Autoloader\FileLocatorTest
*/
class FileLocator
{
/**
* The Autoloader to use.
*
* @var Autoloader
*/
protected $autoloader;
public function __construct(Autoloader $autoloader)
{
$this->autoloader = $autoloader;
}
/**
* Attempts to locate a file by examining the name for a namespace
* and looking through the PSR-4 namespaced files that we know about.
*
* @param string $file The relative file path or namespaced file to
* locate. If not namespaced, search in the app
* folder.
* @param non-empty-string|null $folder The folder within the namespace that we should
* look for the file. If $file does not contain
* this value, it will be appended to the namespace
* folder.
* @param string $ext The file extension the file should have.
*
* @return false|string The path to the file, or false if not found.
*/
public function locateFile(string $file, ?string $folder = null, string $ext = 'php')
{
$file = $this->ensureExt($file, $ext);
// Clears the folder name if it is at the beginning of the filename
if ($folder !== null && strpos($file, $folder) === 0) {
$file = substr($file, strlen($folder . '/'));
}
// Is not namespaced? Try the application folder.
if (strpos($file, '\\') === false) {
return $this->legacyLocate($file, $folder);
}
// Standardize slashes to handle nested directories.
$file = strtr($file, '/', '\\');
$file = ltrim($file, '\\');
$segments = explode('\\', $file);
// The first segment will be empty if a slash started the filename.
if ($segments[0] === '') {
unset($segments[0]);
}
$paths = [];
$filename = '';
// Namespaces always comes with arrays of paths
$namespaces = $this->autoloader->getNamespace();
foreach (array_keys($namespaces) as $namespace) {
if (substr($file, 0, strlen($namespace) + 1) === $namespace . '\\') {
$fileWithoutNamespace = substr($file, strlen($namespace));
// There may be sub-namespaces of the same vendor,
// so overwrite them with namespaces found later.
$paths = $namespaces[$namespace];
$filename = ltrim(str_replace('\\', '/', $fileWithoutNamespace), '/');
}
}
// if no namespaces matched then quit
if ($paths === []) {
return false;
}
// Check each path in the namespace
foreach ($paths as $path) {
// Ensure trailing slash
$path = rtrim($path, '/') . '/';
// If we have a folder name, then the calling function
// expects this file to be within that folder, like 'Views',
// or 'libraries'.
if ($folder !== null && strpos($path . $filename, '/' . $folder . '/') === false) {
$path .= trim($folder, '/') . '/';
}
$path .= $filename;
if (is_file($path)) {
return $path;
}
}
return false;
}
/**
* Examines a file and returns the fully qualified class name.
*/
public function getClassname(string $file): string
{
if (is_dir($file)) {
return '';
}
$php = file_get_contents($file);
$tokens = token_get_all($php);
$dlm = false;
$namespace = '';
$className = '';
foreach ($tokens as $i => $token) {
if ($i < 2) {
continue;
}
if ((isset($tokens[$i - 2][1]) && ($tokens[$i - 2][1] === 'phpnamespace' || $tokens[$i - 2][1] === 'namespace')) || ($dlm && $tokens[$i - 1][0] === T_NS_SEPARATOR && $token[0] === T_STRING)) {
if (! $dlm) {
$namespace = 0;
}
if (isset($token[1])) {
$namespace = $namespace ? $namespace . '\\' . $token[1] : $token[1];
$dlm = true;
}
} elseif ($dlm && ($token[0] !== T_NS_SEPARATOR) && ($token[0] !== T_STRING)) {
$dlm = false;
}
if (($tokens[$i - 2][0] === T_CLASS || (isset($tokens[$i - 2][1]) && $tokens[$i - 2][1] === 'phpclass'))
&& $tokens[$i - 1][0] === T_WHITESPACE
&& $token[0] === T_STRING) {
$className = $token[1];
break;
}
}
if ($className === '') {
return '';
}
return $namespace . '\\' . $className;
}
/**
* Searches through all of the defined namespaces looking for a file.
* Returns an array of all found locations for the defined file.
*
* Example:
*
* $locator->search('Config/Routes.php');
* // Assuming PSR4 namespaces include foo and bar, might return:
* [
* 'app/Modules/foo/Config/Routes.php',
* 'app/Modules/bar/Config/Routes.php',
* ]
*/
public function search(string $path, string $ext = 'php', bool $prioritizeApp = true): array
{
$path = $this->ensureExt($path, $ext);
$foundPaths = [];
$appPaths = [];
foreach ($this->getNamespaces() as $namespace) {
if (isset($namespace['path']) && is_file($namespace['path'] . $path)) {
$fullPath = $namespace['path'] . $path;
$fullPath = realpath($fullPath) ?: $fullPath;
if ($prioritizeApp) {
$foundPaths[] = $fullPath;
} elseif (strpos($fullPath, APPPATH) === 0) {
$appPaths[] = $fullPath;
} else {
$foundPaths[] = $fullPath;
}
}
}
if (! $prioritizeApp && $appPaths !== []) {
$foundPaths = [...$foundPaths, ...$appPaths];
}
// Remove any duplicates
return array_unique($foundPaths);
}
/**
* Ensures a extension is at the end of a filename
*/
protected function ensureExt(string $path, string $ext): string
{
if ($ext !== '') {
$ext = '.' . $ext;
if (substr($path, -strlen($ext)) !== $ext) {
$path .= $ext;
}
}
return $path;
}
/**
* Return the namespace mappings we know about.
*
* @return array<int, array<string, string>>
*/
protected function getNamespaces()
{
$namespaces = [];
// Save system for last
$system = [];
foreach ($this->autoloader->getNamespace() as $prefix => $paths) {
foreach ($paths as $path) {
if ($prefix === 'CodeIgniter') {
$system = [
'prefix' => $prefix,
'path' => rtrim($path, '\\/') . DIRECTORY_SEPARATOR,
];
continue;
}
$namespaces[] = [
'prefix' => $prefix,
'path' => rtrim($path, '\\/') . DIRECTORY_SEPARATOR,
];
}
}
$namespaces[] = $system;
return $namespaces;
}
/**
* Find the qualified name of a file according to
* the namespace of the first matched namespace path.
*
* @return false|string The qualified name or false if the path is not found
*/
public function findQualifiedNameFromPath(string $path)
{
$path = realpath($path) ?: $path;
if (! is_file($path)) {
return false;
}
foreach ($this->getNamespaces() as $namespace) {
$namespace['path'] = realpath($namespace['path']) ?: $namespace['path'];
if ($namespace['path'] === '') {
continue;
}
if (mb_strpos($path, $namespace['path']) === 0) {
$className = '\\' . $namespace['prefix'] . '\\' .
ltrim(str_replace(
'/',
'\\',
mb_substr($path, mb_strlen($namespace['path']))
), '\\');
// Remove the file extension (.php)
$className = mb_substr($className, 0, -4);
// Check if this exists
if (class_exists($className)) {
return $className;
}
}
}
return false;
}
/**
* Scans the defined namespaces, returning a list of all files
* that are contained within the subpath specified by $path.
*
* @return string[] List of file paths
*/
public function listFiles(string $path): array
{
if ($path === '') {
return [];
}
$files = [];
helper('filesystem');
foreach ($this->getNamespaces() as $namespace) {
$fullPath = $namespace['path'] . $path;
$fullPath = realpath($fullPath) ?: $fullPath;
if (! is_dir($fullPath)) {
continue;
}
$tempFiles = get_filenames($fullPath, true, false, false);
if ($tempFiles !== []) {
$files = array_merge($files, $tempFiles);
}
}
return $files;
}
/**
* Scans the provided namespace, returning a list of all files
* that are contained within the sub path specified by $path.
*
* @return string[] List of file paths
*/
public function listNamespaceFiles(string $prefix, string $path): array
{
if ($path === '' || ($prefix === '')) {
return [];
}
$files = [];
helper('filesystem');
// autoloader->getNamespace($prefix) returns an array of paths for that namespace
foreach ($this->autoloader->getNamespace($prefix) as $namespacePath) {
$fullPath = rtrim($namespacePath, '/') . '/' . $path;
$fullPath = realpath($fullPath) ?: $fullPath;
if (! is_dir($fullPath)) {
continue;
}
$tempFiles = get_filenames($fullPath, true, false, false);
if ($tempFiles !== []) {
$files = array_merge($files, $tempFiles);
}
}
return $files;
}
/**
* Checks the app folder to see if the file can be found.
* Only for use with filenames that DO NOT include namespacing.
*
* @param non-empty-string|null $folder
*
* @return false|string The path to the file, or false if not found.
*/
protected function legacyLocate(string $file, ?string $folder = null)
{
$path = APPPATH . ($folder === null ? $file : $folder . '/' . $file);
$path = realpath($path) ?: $path;
if (is_file($path)) {
return $path;
}
return false;
}
}

1916
system4.4.6/BaseModel.php

File diff suppressed because it is too large Load Diff

227
system4.4.6/CLI/BaseCommand.php

@ -1,227 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\CLI;
use Config\Exceptions;
use Psr\Log\LoggerInterface;
use ReflectionException;
use Throwable;
/**
* BaseCommand is the base class used in creating CLI commands.
*
* @property array<string, string> $arguments
* @property Commands $commands
* @property string $description
* @property string $group
* @property LoggerInterface $logger
* @property string $name
* @property array<string, string> $options
* @property string $usage
*/
abstract class BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group;
/**
* The Command's name
*
* @var string
*/
protected $name;
/**
* the Command's usage description
*
* @var string
*/
protected $usage;
/**
* the Command's short description
*
* @var string
*/
protected $description;
/**
* the Command's options description
*
* @var array<string, string>
*/
protected $options = [];
/**
* the Command's Arguments description
*
* @var array<string, string>
*/
protected $arguments = [];
/**
* The Logger to use for a command
*
* @var LoggerInterface
*/
protected $logger;
/**
* Instance of Commands so
* commands can call other commands.
*
* @var Commands
*/
protected $commands;
public function __construct(LoggerInterface $logger, Commands $commands)
{
$this->logger = $logger;
$this->commands = $commands;
}
/**
* Actually execute a command.
*
* @param array<int|string, string|null> $params
*
* @return int|void
*/
abstract public function run(array $params);
/**
* Can be used by a command to run other commands.
*
* @return int|void
*
* @throws ReflectionException
*/
protected function call(string $command, array $params = [])
{
return $this->commands->run($command, $params);
}
/**
* A simple method to display an error with line/file, in child commands.
*
* @return void
*/
protected function showError(Throwable $e)
{
$exception = $e;
$message = $e->getMessage();
$config = config(Exceptions::class);
require $config->errorViewPath . '/cli/error_exception.php';
}
/**
* Show Help includes (Usage, Arguments, Description, Options).
*
* @return void
*/
public function showHelp()
{
CLI::write(lang('CLI.helpUsage'), 'yellow');
if (! empty($this->usage)) {
$usage = $this->usage;
} else {
$usage = $this->name;
if ($this->arguments !== []) {
$usage .= ' [arguments]';
}
}
CLI::write($this->setPad($usage, 0, 0, 2));
if (! empty($this->description)) {
CLI::newLine();
CLI::write(lang('CLI.helpDescription'), 'yellow');
CLI::write($this->setPad($this->description, 0, 0, 2));
}
if ($this->arguments !== []) {
CLI::newLine();
CLI::write(lang('CLI.helpArguments'), 'yellow');
$length = max(array_map('strlen', array_keys($this->arguments)));
foreach ($this->arguments as $argument => $description) {
CLI::write(CLI::color($this->setPad($argument, $length, 2, 2), 'green') . $description);
}
}
if ($this->options !== []) {
CLI::newLine();
CLI::write(lang('CLI.helpOptions'), 'yellow');
$length = max(array_map('strlen', array_keys($this->options)));
foreach ($this->options as $option => $description) {
CLI::write(CLI::color($this->setPad($option, $length, 2, 2), 'green') . $description);
}
}
}
/**
* Pads our string out so that all titles are the same length to nicely line up descriptions.
*
* @param int $extra How many extra spaces to add at the end
*/
public function setPad(string $item, int $max, int $extra = 2, int $indent = 0): string
{
$max += $extra + $indent;
return str_pad(str_repeat(' ', $indent) . $item, $max);
}
/**
* Get pad for $key => $value array output
*
* @deprecated Use setPad() instead.
*
* @codeCoverageIgnore
*/
public function getPad(array $array, int $pad): int
{
$max = 0;
foreach (array_keys($array) as $key) {
$max = max($max, strlen($key));
}
return $max + $pad;
}
/**
* Makes it simple to access our protected properties.
*
* @return array|Commands|LoggerInterface|string|null
*/
public function __get(string $key)
{
return $this->{$key} ?? null;
}
/**
* Makes it simple to check our protected properties.
*/
public function __isset(string $key): bool
{
return isset($this->{$key});
}
}

1153
system4.4.6/CLI/CLI.php

File diff suppressed because it is too large Load Diff

186
system4.4.6/CLI/Commands.php

@ -1,186 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\CLI;
use CodeIgniter\Autoloader\FileLocator;
use CodeIgniter\Log\Logger;
use ReflectionClass;
use ReflectionException;
/**
* Core functionality for running, listing, etc commands.
*/
class Commands
{
/**
* The found commands.
*
* @var array
*/
protected $commands = [];
/**
* Logger instance.
*
* @var Logger
*/
protected $logger;
/**
* Constructor
*
* @param Logger|null $logger
*/
public function __construct($logger = null)
{
$this->logger = $logger ?? service('logger');
$this->discoverCommands();
}
/**
* Runs a command given
*
* @return int|void
*/
public function run(string $command, array $params)
{
if (! $this->verifyCommand($command, $this->commands)) {
return;
}
// The file would have already been loaded during the
// createCommandList function...
$className = $this->commands[$command]['class'];
$class = new $className($this->logger, $this);
return $class->run($params);
}
/**
* Provide access to the list of commands.
*
* @return array
*/
public function getCommands()
{
return $this->commands;
}
/**
* Discovers all commands in the framework and within user code,
* and collects instances of them to work with.
*
* @return void
*/
public function discoverCommands()
{
if ($this->commands !== []) {
return;
}
/** @var FileLocator $locator */
$locator = service('locator');
$files = $locator->listFiles('Commands/');
// If no matching command files were found, bail
// This should never happen in unit testing.
if ($files === []) {
return; // @codeCoverageIgnore
}
// Loop over each file checking to see if a command with that
// alias exists in the class.
foreach ($files as $file) {
$className = $locator->getClassname($file);
if ($className === '' || ! class_exists($className)) {
continue;
}
try {
$class = new ReflectionClass($className);
if (! $class->isInstantiable() || ! $class->isSubclassOf(BaseCommand::class)) {
continue;
}
/** @var BaseCommand $class */
$class = new $className($this->logger, $this);
if (isset($class->group)) {
$this->commands[$class->name] = [
'class' => $className,
'file' => $file,
'group' => $class->group,
'description' => $class->description,
];
}
unset($class);
} catch (ReflectionException $e) {
$this->logger->error($e->getMessage());
}
}
asort($this->commands);
}
/**
* Verifies if the command being sought is found
* in the commands list.
*/
public function verifyCommand(string $command, array $commands): bool
{
if (isset($commands[$command])) {
return true;
}
$message = lang('CLI.commandNotFound', [$command]);
$alternatives = $this->getCommandAlternatives($command, $commands);
if ($alternatives !== []) {
if (count($alternatives) === 1) {
$message .= "\n\n" . lang('CLI.altCommandSingular') . "\n ";
} else {
$message .= "\n\n" . lang('CLI.altCommandPlural') . "\n ";
}
$message .= implode("\n ", $alternatives);
}
CLI::error($message);
CLI::newLine();
return false;
}
/**
* Finds alternative of `$name` among collection
* of commands.
*/
protected function getCommandAlternatives(string $name, array $collection): array
{
$alternatives = [];
foreach (array_keys($collection) as $commandName) {
$lev = levenshtein($name, $commandName);
if ($lev <= strlen($commandName) / 3 || strpos($commandName, $name) !== false) {
$alternatives[$commandName] = $lev;
}
}
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
return array_keys($alternatives);
}
}

88
system4.4.6/CLI/Console.php

@ -1,88 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\CLI;
use CodeIgniter\CodeIgniter;
use Config\App;
use Config\Services;
use Exception;
/**
* Console
*
* @see \CodeIgniter\CLI\ConsoleTest
*/
class Console
{
/**
* Runs the current command discovered on the CLI.
*
* @return int|void
*
* @throws Exception
*/
public function run()
{
// Create CLIRequest
$appConfig = config(App::class);
Services::createRequest($appConfig, true);
// Load Routes
Services::routes()->loadRoutes();
$runner = Services::commands();
$params = array_merge(CLI::getSegments(), CLI::getOptions());
$params = $this->parseParamsForHelpOption($params);
$command = array_shift($params) ?? 'list';
return $runner->run($command, $params);
}
/**
* Displays basic information about the Console.
*
* @return void
*/
public function showHeader(bool $suppress = false)
{
if ($suppress) {
return;
}
CLI::write(sprintf(
'CodeIgniter v%s Command Line Tool - Server Time: %s UTC%s',
CodeIgniter::CI_VERSION,
date('Y-m-d H:i:s'),
date('P')
), 'green');
CLI::newLine();
}
/**
* Introspects the `$params` passed for presence of the
* `--help` option.
*
* If present, it will be found as `['help' => null]`.
* We'll remove that as an option from `$params` and
* unshift it as argument instead.
*/
private function parseParamsForHelpOption(array $params): array
{
if (array_key_exists('help', $params)) {
unset($params['help']);
$params = $params === [] ? ['list'] : $params;
array_unshift($params, 'help');
}
return $params;
}
}

34
system4.4.6/CLI/Exceptions/CLIException.php

@ -1,34 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\CLI\Exceptions;
use CodeIgniter\Exceptions\DebugTraceableTrait;
use RuntimeException;
/**
* CLIException
*/
class CLIException extends RuntimeException
{
use DebugTraceableTrait;
/**
* Thrown when `$color` specified for `$type` is not within the
* allowed list of colors.
*
* @return CLIException
*/
public static function forInvalidColor(string $type, string $color)
{
return new static(lang('CLI.invalidColor', [$type, $color]));
}
}

388
system4.4.6/CLI/GeneratorTrait.php

@ -1,388 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\CLI;
use Config\Generators;
use Config\Services;
use Throwable;
/**
* GeneratorTrait contains a collection of methods
* to build the commands that generates a file.
*/
trait GeneratorTrait
{
/**
* Component Name
*
* @var string
*/
protected $component;
/**
* File directory
*
* @var string
*/
protected $directory;
/**
* View template name
*
* @var string
*/
protected $template;
/**
* Language string key for required class names.
*
* @var string
*/
protected $classNameLang = '';
/**
* Whether to require class name.
*
* @internal
*
* @var bool
*/
private $hasClassName = true;
/**
* Whether to sort class imports.
*
* @internal
*
* @var bool
*/
private $sortImports = true;
/**
* Whether the `--suffix` option has any effect.
*
* @internal
*
* @var bool
*/
private $enabledSuffixing = true;
/**
* The params array for easy access by other methods.
*
* @internal
*
* @var array
*/
private $params = [];
/**
* Execute the command.
*
* @deprecated use generateClass() instead
*/
protected function execute(array $params): void
{
$this->generateClass($params);
}
/**
* Generates a class file from an existing template.
*/
protected function generateClass(array $params)
{
$this->params = $params;
// Get the fully qualified class name from the input.
$class = $this->qualifyClassName();
// Get the file path from class name.
$target = $this->buildPath($class);
// Check if path is empty.
if (empty($target)) {
return;
}
$this->generateFile($target, $this->buildContent($class));
}
/**
* Generate a view file from an existing template.
*/
protected function generateView(string $view, array $params)
{
$this->params = $params;
$target = $this->buildPath($view);
// Check if path is empty.
if (empty($target)) {
return;
}
$this->generateFile($target, $this->buildContent($view));
}
/**
* Handles writing the file to disk, and all of the safety checks around that.
*/
private function generateFile(string $target, string $content): void
{
if ($this->getOption('namespace') === 'CodeIgniter') {
// @codeCoverageIgnoreStart
CLI::write(lang('CLI.generator.usingCINamespace'), 'yellow');
CLI::newLine();
if (CLI::prompt('Are you sure you want to continue?', ['y', 'n'], 'required') === 'n') {
CLI::newLine();
CLI::write(lang('CLI.generator.cancelOperation'), 'yellow');
CLI::newLine();
return;
}
CLI::newLine();
// @codeCoverageIgnoreEnd
}
$isFile = is_file($target);
// Overwriting files unknowingly is a serious annoyance, So we'll check if
// we are duplicating things, If 'force' option is not supplied, we bail.
if (! $this->getOption('force') && $isFile) {
CLI::error(lang('CLI.generator.fileExist', [clean_path($target)]), 'light_gray', 'red');
CLI::newLine();
return;
}
// Check if the directory to save the file is existing.
$dir = dirname($target);
if (! is_dir($dir)) {
mkdir($dir, 0755, true);
}
helper('filesystem');
// Build the class based on the details we have, We'll be getting our file
// contents from the template, and then we'll do the necessary replacements.
if (! write_file($target, $content)) {
// @codeCoverageIgnoreStart
CLI::error(lang('CLI.generator.fileError', [clean_path($target)]), 'light_gray', 'red');
CLI::newLine();
return;
// @codeCoverageIgnoreEnd
}
if ($this->getOption('force') && $isFile) {
CLI::write(lang('CLI.generator.fileOverwrite', [clean_path($target)]), 'yellow');
CLI::newLine();
return;
}
CLI::write(lang('CLI.generator.fileCreate', [clean_path($target)]), 'green');
CLI::newLine();
}
/**
* Prepare options and do the necessary replacements.
*/
protected function prepare(string $class): string
{
return $this->parseTemplate($class);
}
/**
* Change file basename before saving.
*
* Useful for components where the file name has a date.
*/
protected function basename(string $filename): string
{
return basename($filename);
}
/**
* Parses the class name and checks if it is already qualified.
*/
protected function qualifyClassName(): string
{
// Gets the class name from input.
$class = $this->params[0] ?? CLI::getSegment(2);
if ($class === null && $this->hasClassName) {
// @codeCoverageIgnoreStart
$nameLang = $this->classNameLang ?: 'CLI.generator.className.default';
$class = CLI::prompt(lang($nameLang), null, 'required');
CLI::newLine();
// @codeCoverageIgnoreEnd
}
helper('inflector');
$component = singular($this->component);
/**
* @see https://regex101.com/r/a5KNCR/2
*/
$pattern = sprintf('/([a-z][a-z0-9_\/\\\\]+)(%s)$/i', $component);
if (preg_match($pattern, $class, $matches) === 1) {
$class = $matches[1] . ucfirst($matches[2]);
}
if ($this->enabledSuffixing && $this->getOption('suffix') && preg_match($pattern, $class) !== 1) {
$class .= ucfirst($component);
}
// Trims input, normalize separators, and ensure that all paths are in Pascalcase.
$class = ltrim(implode('\\', array_map('pascalize', explode('\\', str_replace('/', '\\', trim($class))))), '\\/');
// Gets the namespace from input. Don't forget the ending backslash!
$namespace = trim(str_replace('/', '\\', $this->getOption('namespace') ?? APP_NAMESPACE), '\\') . '\\';
if (strncmp($class, $namespace, strlen($namespace)) === 0) {
return $class; // @codeCoverageIgnore
}
return $namespace . $this->directory . '\\' . str_replace('/', '\\', $class);
}
/**
* Gets the generator view as defined in the `Config\Generators::$views`,
* with fallback to `$template` when the defined view does not exist.
*/
protected function renderTemplate(array $data = []): string
{
try {
return view(config(Generators::class)->views[$this->name], $data, ['debug' => false]);
} catch (Throwable $e) {
log_message('error', (string) $e);
return view("CodeIgniter\\Commands\\Generators\\Views\\{$this->template}", $data, ['debug' => false]);
}
}
/**
* Performs pseudo-variables contained within view file.
*/
protected function parseTemplate(string $class, array $search = [], array $replace = [], array $data = []): string
{
// Retrieves the namespace part from the fully qualified class name.
$namespace = trim(implode('\\', array_slice(explode('\\', $class), 0, -1)), '\\');
$search[] = '<@php';
$search[] = '{namespace}';
$search[] = '{class}';
$replace[] = '<?php';
$replace[] = $namespace;
$replace[] = str_replace($namespace . '\\', '', $class);
return str_replace($search, $replace, $this->renderTemplate($data));
}
/**
* Builds the contents for class being generated, doing all
* the replacements necessary, and alphabetically sorts the
* imports for a given template.
*/
protected function buildContent(string $class): string
{
$template = $this->prepare($class);
if ($this->sortImports && preg_match('/(?P<imports>(?:^use [^;]+;$\n?)+)/m', $template, $match)) {
$imports = explode("\n", trim($match['imports']));
sort($imports);
return str_replace(trim($match['imports']), implode("\n", $imports), $template);
}
return $template;
}
/**
* Builds the file path from the class name.
*/
protected function buildPath(string $class): string
{
$namespace = trim(str_replace('/', '\\', $this->getOption('namespace') ?? APP_NAMESPACE), '\\');
// Check if the namespace is actually defined and we are not just typing gibberish.
$base = Services::autoloader()->getNamespace($namespace);
if (! $base = reset($base)) {
CLI::error(lang('CLI.namespaceNotDefined', [$namespace]), 'light_gray', 'red');
CLI::newLine();
return '';
}
$base = realpath($base) ?: $base;
$file = $base . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, trim(str_replace($namespace . '\\', '', $class), '\\')) . '.php';
return implode(DIRECTORY_SEPARATOR, array_slice(explode(DIRECTORY_SEPARATOR, $file), 0, -1)) . DIRECTORY_SEPARATOR . $this->basename($file);
}
/**
* Allows child generators to modify the internal `$hasClassName` flag.
*
* @return $this
*/
protected function setHasClassName(bool $hasClassName)
{
$this->hasClassName = $hasClassName;
return $this;
}
/**
* Allows child generators to modify the internal `$sortImports` flag.
*
* @return $this
*/
protected function setSortImports(bool $sortImports)
{
$this->sortImports = $sortImports;
return $this;
}
/**
* Allows child generators to modify the internal `$enabledSuffixing` flag.
*
* @return $this
*/
protected function setEnabledSuffixing(bool $enabledSuffixing)
{
$this->enabledSuffixing = $enabledSuffixing;
return $this;
}
/**
* Gets a single command-line option. Returns TRUE if the option exists,
* but doesn't have a value, and is simply acting as a flag.
*
* @return mixed
*/
protected function getOption(string $name)
{
if (! array_key_exists($name, $this->params)) {
return CLI::getOption($name);
}
return $this->params[$name] ?? true;
}
}

89
system4.4.6/Cache/CacheFactory.php

@ -1,89 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache;
use CodeIgniter\Cache\Exceptions\CacheException;
use CodeIgniter\Exceptions\CriticalError;
use CodeIgniter\Test\Mock\MockCache;
use Config\Cache;
/**
* A factory for loading the desired
*
* @see \CodeIgniter\Cache\CacheFactoryTest
*/
class CacheFactory
{
/**
* The class to use when mocking
*
* @var string
*/
public static $mockClass = MockCache::class;
/**
* The service to inject the mock as
*
* @var string
*/
public static $mockServiceName = 'cache';
/**
* Attempts to create the desired cache handler, based upon the
*
* @param non-empty-string|null $handler
* @param non-empty-string|null $backup
*
* @return CacheInterface
*/
public static function getHandler(Cache $config, ?string $handler = null, ?string $backup = null)
{
if (! isset($config->validHandlers) || $config->validHandlers === []) {
throw CacheException::forInvalidHandlers();
}
if (! isset($config->handler) || ! isset($config->backupHandler)) {
throw CacheException::forNoBackup();
}
$handler ??= $config->handler;
$backup ??= $config->backupHandler;
if (! array_key_exists($handler, $config->validHandlers) || ! array_key_exists($backup, $config->validHandlers)) {
throw CacheException::forHandlerNotFound();
}
$adapter = new $config->validHandlers[$handler]($config);
if (! $adapter->isSupported()) {
$adapter = new $config->validHandlers[$backup]($config);
if (! $adapter->isSupported()) {
// Fall back to the dummy adapter.
$adapter = new $config->validHandlers['dummy']();
}
}
// If $adapter->initialization throws a CriticalError exception, we will attempt to
// use the $backup handler, if that also fails, we resort to the dummy handler.
try {
$adapter->initialize();
} catch (CriticalError $e) {
log_message('critical', $e . ' Resorting to using ' . $backup . ' handler.');
// get the next best cache handler (or dummy if the $backup also fails)
$adapter = self::getHandler($config, $backup, 'dummy');
}
return $adapter;
}
}

108
system4.4.6/Cache/CacheInterface.php

@ -1,108 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache;
/**
* Cache interface
*/
interface CacheInterface
{
/**
* Takes care of any handler-specific setup that must be done.
*
* @return void
*/
public function initialize();
/**
* Attempts to fetch an item from the cache store.
*
* @param string $key Cache item name
*
* @return array|bool|float|int|object|string|null
*/
public function get(string $key);
/**
* Saves an item to the cache store.
*
* @param string $key Cache item name
* @param array|bool|float|int|object|string|null $value The data to save
* @param int $ttl Time To Live, in seconds (default 60)
*
* @return bool Success or failure
*/
public function save(string $key, $value, int $ttl = 60);
/**
* Deletes a specific item from the cache store.
*
* @param string $key Cache item name
*
* @return bool Success or failure
*/
public function delete(string $key);
/**
* Performs atomic incrementation of a raw stored value.
*
* @param string $key Cache ID
* @param int $offset Step/value to increase by
*
* @return bool|int
*/
public function increment(string $key, int $offset = 1);
/**
* Performs atomic decrementation of a raw stored value.
*
* @param string $key Cache ID
* @param int $offset Step/value to increase by
*
* @return bool|int
*/
public function decrement(string $key, int $offset = 1);
/**
* Will delete all items in the entire cache.
*
* @return bool Success or failure
*/
public function clean();
/**
* Returns information on the entire cache.
*
* The information returned and the structure of the data
* varies depending on the handler.
*
* @return array|false|object|null
*/
public function getCacheInfo();
/**
* Returns detailed information about the specific item in the cache.
*
* @param string $key Cache item name.
*
* @return array|false|null
* Returns null if the item does not exist, otherwise array<string, mixed>
* with at least the 'expire' key for absolute epoch expiry (or null).
* Some handlers may return false when an item does not exist, which is deprecated.
*/
public function getMetaData(string $key);
/**
* Determines if the driver is supported on this system.
*/
public function isSupported(): bool;
}

64
system4.4.6/Cache/Exceptions/CacheException.php

@ -1,64 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Exceptions;
use CodeIgniter\Exceptions\DebugTraceableTrait;
use CodeIgniter\Exceptions\ExceptionInterface;
use RuntimeException;
/**
* CacheException
*/
class CacheException extends RuntimeException implements ExceptionInterface
{
use DebugTraceableTrait;
/**
* Thrown when handler has no permission to write cache.
*
* @return CacheException
*/
public static function forUnableToWrite(string $path)
{
return new static(lang('Cache.unableToWrite', [$path]));
}
/**
* Thrown when an unrecognized handler is used.
*
* @return CacheException
*/
public static function forInvalidHandlers()
{
return new static(lang('Cache.invalidHandlers'));
}
/**
* Thrown when no backup handler is setup in config.
*
* @return CacheException
*/
public static function forNoBackup()
{
return new static(lang('Cache.noBackup'));
}
/**
* Thrown when specified handler was not found.
*
* @return CacheException
*/
public static function forHandlerNotFound()
{
return new static(lang('Cache.handlerNotFound'));
}
}

24
system4.4.6/Cache/Exceptions/ExceptionInterface.php

@ -1,24 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Exceptions;
/**
* Provides a domain-level interface for broad capture
* of all framework-related exceptions.
*
* catch (\CodeIgniter\Cache\Exceptions\ExceptionInterface) { ... }
*
* @deprecated 4.1.2
*/
interface ExceptionInterface
{
}

65
system4.4.6/Cache/FactoriesCache.php

@ -1,65 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache;
use CodeIgniter\Cache\FactoriesCache\FileVarExportHandler;
use CodeIgniter\Config\Factories;
final class FactoriesCache
{
/**
* @var CacheInterface|FileVarExportHandler
*/
private $cache;
/**
* @param CacheInterface|FileVarExportHandler|null $cache
*/
public function __construct($cache = null)
{
$this->cache = $cache ?? new FileVarExportHandler();
}
public function save(string $component): void
{
if (! Factories::isUpdated($component)) {
return;
}
$data = Factories::getComponentInstances($component);
$this->cache->save($this->getCacheKey($component), $data, 3600 * 24);
}
private function getCacheKey(string $component): string
{
return 'FactoriesCache_' . $component;
}
public function load(string $component): bool
{
$key = $this->getCacheKey($component);
if (! $data = $this->cache->get($key)) {
return false;
}
Factories::setComponentInstances($component, $data);
return true;
}
public function delete(string $component): void
{
$this->cache->delete($this->getCacheKey($component));
}
}

44
system4.4.6/Cache/FactoriesCache/FileVarExportHandler.php

@ -1,44 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\FactoriesCache;
final class FileVarExportHandler
{
private string $path = WRITEPATH . 'cache';
/**
* @param array|bool|float|int|object|string|null $val
*/
public function save(string $key, $val): void
{
$val = var_export($val, true);
// Write to temp file first to ensure atomicity
$tmp = $this->path . "/{$key}." . uniqid('', true) . '.tmp';
file_put_contents($tmp, '<?php return ' . $val . ';', LOCK_EX);
rename($tmp, $this->path . "/{$key}");
}
public function delete(string $key): void
{
@unlink($this->path . "/{$key}");
}
/**
* @return array|bool|float|int|object|string|null
*/
public function get(string $key)
{
return @include $this->path . "/{$key}";
}
}

111
system4.4.6/Cache/Handlers/BaseHandler.php

@ -1,111 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Handlers;
use Closure;
use CodeIgniter\Cache\CacheInterface;
use Config\Cache;
use Exception;
use InvalidArgumentException;
/**
* Base class for cache handling
*
* @see \CodeIgniter\Cache\Handlers\BaseHandlerTest
*/
abstract class BaseHandler implements CacheInterface
{
/**
* Reserved characters that cannot be used in a key or tag. May be overridden by the config.
* From https://github.com/symfony/cache-contracts/blob/c0446463729b89dd4fa62e9aeecc80287323615d/ItemInterface.php#L43
*
* @deprecated in favor of the Cache config
*/
public const RESERVED_CHARACTERS = '{}()/\@:';
/**
* Maximum key length.
*/
public const MAX_KEY_LENGTH = PHP_INT_MAX;
/**
* Prefix to apply to cache keys.
* May not be used by all handlers.
*
* @var string
*/
protected $prefix;
/**
* Validates a cache key according to PSR-6.
* Keys that exceed MAX_KEY_LENGTH are hashed.
* From https://github.com/symfony/cache/blob/7b024c6726af21fd4984ac8d1eae2b9f3d90de88/CacheItem.php#L158
*
* @param string $key The key to validate
* @param string $prefix Optional prefix to include in length calculations
*
* @throws InvalidArgumentException When $key is not valid
*/
public static function validateKey($key, $prefix = ''): string
{
if (! is_string($key)) {
throw new InvalidArgumentException('Cache key must be a string');
}
if ($key === '') {
throw new InvalidArgumentException('Cache key cannot be empty.');
}
$reserved = config(Cache::class)->reservedCharacters ?? self::RESERVED_CHARACTERS;
if ($reserved && strpbrk($key, $reserved) !== false) {
throw new InvalidArgumentException('Cache key contains reserved characters ' . $reserved);
}
// If the key with prefix exceeds the length then return the hashed version
return strlen($prefix . $key) > static::MAX_KEY_LENGTH ? $prefix . md5($key) : $prefix . $key;
}
/**
* Get an item from the cache, or execute the given Closure and store the result.
*
* @param string $key Cache item name
* @param int $ttl Time to live
* @param Closure(): mixed $callback Callback return value
*
* @return array|bool|float|int|object|string|null
*/
public function remember(string $key, int $ttl, Closure $callback)
{
$value = $this->get($key);
if ($value !== null) {
return $value;
}
$this->save($key, $value = $callback(), $ttl);
return $value;
}
/**
* Deletes items from the cache store matching a given pattern.
*
* @param string $pattern Cache items glob-style pattern
*
* @return int|never
*
* @throws Exception
*/
public function deleteMatching(string $pattern)
{
throw new Exception('The deleteMatching method is not implemented.');
}
}

119
system4.4.6/Cache/Handlers/DummyHandler.php

@ -1,119 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Handlers;
use Closure;
/**
* Dummy cache handler
*
* @see \CodeIgniter\Cache\Handlers\DummyHandlerTest
*/
class DummyHandler extends BaseHandler
{
/**
* {@inheritDoc}
*/
public function initialize()
{
}
/**
* {@inheritDoc}
*/
public function get(string $key)
{
return null;
}
/**
* {@inheritDoc}
*/
public function remember(string $key, int $ttl, Closure $callback)
{
return null;
}
/**
* {@inheritDoc}
*/
public function save(string $key, $value, int $ttl = 60)
{
return true;
}
/**
* {@inheritDoc}
*/
public function delete(string $key)
{
return true;
}
/**
* {@inheritDoc}
*
* @return int
*/
public function deleteMatching(string $pattern)
{
return 0;
}
/**
* {@inheritDoc}
*/
public function increment(string $key, int $offset = 1)
{
return true;
}
/**
* {@inheritDoc}
*/
public function decrement(string $key, int $offset = 1)
{
return true;
}
/**
* {@inheritDoc}
*/
public function clean()
{
return true;
}
/**
* {@inheritDoc}
*/
public function getCacheInfo()
{
return null;
}
/**
* {@inheritDoc}
*/
public function getMetaData(string $key)
{
return null;
}
/**
* {@inheritDoc}
*/
public function isSupported(): bool
{
return true;
}
}

423
system4.4.6/Cache/Handlers/FileHandler.php

@ -1,423 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Handlers;
use CodeIgniter\Cache\Exceptions\CacheException;
use CodeIgniter\I18n\Time;
use Config\Cache;
use Throwable;
/**
* File system cache handler
*
* @see \CodeIgniter\Cache\Handlers\FileHandlerTest
*/
class FileHandler extends BaseHandler
{
/**
* Maximum key length.
*/
public const MAX_KEY_LENGTH = 255;
/**
* Where to store cached files on the disk.
*
* @var string
*/
protected $path;
/**
* Mode for the stored files.
* Must be chmod-safe (octal).
*
* @var int
*
* @see https://www.php.net/manual/en/function.chmod.php
*/
protected $mode;
/**
* Note: Use `CacheFactory::getHandler()` to instantiate.
*
* @throws CacheException
*/
public function __construct(Cache $config)
{
if (! property_exists($config, 'file')) {
$config->file = [
'storePath' => $config->storePath ?? WRITEPATH . 'cache',
'mode' => 0640,
];
}
$this->path = ! empty($config->file['storePath']) ? $config->file['storePath'] : WRITEPATH . 'cache';
$this->path = rtrim($this->path, '/') . '/';
if (! is_really_writable($this->path)) {
throw CacheException::forUnableToWrite($this->path);
}
$this->mode = $config->file['mode'] ?? 0640;
$this->prefix = $config->prefix;
}
/**
* {@inheritDoc}
*/
public function initialize()
{
}
/**
* {@inheritDoc}
*/
public function get(string $key)
{
$key = static::validateKey($key, $this->prefix);
$data = $this->getItem($key);
return is_array($data) ? $data['data'] : null;
}
/**
* {@inheritDoc}
*/
public function save(string $key, $value, int $ttl = 60)
{
$key = static::validateKey($key, $this->prefix);
$contents = [
'time' => Time::now()->getTimestamp(),
'ttl' => $ttl,
'data' => $value,
];
if ($this->writeFile($this->path . $key, serialize($contents))) {
try {
chmod($this->path . $key, $this->mode);
// @codeCoverageIgnoreStart
} catch (Throwable $e) {
log_message('debug', 'Failed to set mode on cache file: ' . $e);
// @codeCoverageIgnoreEnd
}
return true;
}
return false;
}
/**
* {@inheritDoc}
*/
public function delete(string $key)
{
$key = static::validateKey($key, $this->prefix);
return is_file($this->path . $key) && unlink($this->path . $key);
}
/**
* {@inheritDoc}
*
* @return int
*/
public function deleteMatching(string $pattern)
{
$deleted = 0;
foreach (glob($this->path . $pattern, GLOB_NOSORT) as $filename) {
if (is_file($filename) && @unlink($filename)) {
$deleted++;
}
}
return $deleted;
}
/**
* {@inheritDoc}
*/
public function increment(string $key, int $offset = 1)
{
$prefixedKey = static::validateKey($key, $this->prefix);
$tmp = $this->getItem($prefixedKey);
if ($tmp === false) {
$tmp = ['data' => 0, 'ttl' => 60];
}
['data' => $value, 'ttl' => $ttl] = $tmp;
if (! is_int($value)) {
return false;
}
$value += $offset;
return $this->save($key, $value, $ttl) ? $value : false;
}
/**
* {@inheritDoc}
*/
public function decrement(string $key, int $offset = 1)
{
return $this->increment($key, -$offset);
}
/**
* {@inheritDoc}
*/
public function clean()
{
return $this->deleteFiles($this->path, false, true);
}
/**
* {@inheritDoc}
*/
public function getCacheInfo()
{
return $this->getDirFileInfo($this->path);
}
/**
* {@inheritDoc}
*/
public function getMetaData(string $key)
{
$key = static::validateKey($key, $this->prefix);
if (false === $data = $this->getItem($key)) {
return false; // @TODO This will return null in a future release
}
return [
'expire' => $data['ttl'] > 0 ? $data['time'] + $data['ttl'] : null,
'mtime' => filemtime($this->path . $key),
'data' => $data['data'],
];
}
/**
* {@inheritDoc}
*/
public function isSupported(): bool
{
return is_writable($this->path);
}
/**
* Does the heavy lifting of actually retrieving the file and
* verifying it's age.
*
* @return array{data: mixed, ttl: int, time: int}|false
*/
protected function getItem(string $filename)
{
if (! is_file($this->path . $filename)) {
return false;
}
$data = @unserialize(file_get_contents($this->path . $filename));
if (! is_array($data)) {
return false;
}
if (! isset($data['ttl']) || ! is_int($data['ttl'])) {
return false;
}
if (! isset($data['time']) || ! is_int($data['time'])) {
return false;
}
if ($data['ttl'] > 0 && Time::now()->getTimestamp() > $data['time'] + $data['ttl']) {
@unlink($this->path . $filename);
return false;
}
return $data;
}
/**
* Writes a file to disk, or returns false if not successful.
*
* @param string $path
* @param string $data
* @param string $mode
*
* @return bool
*/
protected function writeFile($path, $data, $mode = 'wb')
{
if (($fp = @fopen($path, $mode)) === false) {
return false;
}
flock($fp, LOCK_EX);
for ($result = $written = 0, $length = strlen($data); $written < $length; $written += $result) {
if (($result = fwrite($fp, substr($data, $written))) === false) {
break;
}
}
flock($fp, LOCK_UN);
fclose($fp);
return is_int($result);
}
/**
* Deletes all files contained in the supplied directory path.
* Files must be writable or owned by the system in order to be deleted.
* If the second parameter is set to TRUE, any directories contained
* within the supplied base directory will be nuked as well.
*
* @param string $path File path
* @param bool $delDir Whether to delete any directories found in the path
* @param bool $htdocs Whether to skip deleting .htaccess and index page files
* @param int $_level Current directory depth level (default: 0; internal use only)
*/
protected function deleteFiles(string $path, bool $delDir = false, bool $htdocs = false, int $_level = 0): bool
{
// Trim the trailing slash
$path = rtrim($path, '/\\');
if (! $currentDir = @opendir($path)) {
return false;
}
while (false !== ($filename = @readdir($currentDir))) {
if ($filename !== '.' && $filename !== '..') {
if (is_dir($path . DIRECTORY_SEPARATOR . $filename) && $filename[0] !== '.') {
$this->deleteFiles($path . DIRECTORY_SEPARATOR . $filename, $delDir, $htdocs, $_level + 1);
} elseif ($htdocs !== true || ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) {
@unlink($path . DIRECTORY_SEPARATOR . $filename);
}
}
}
closedir($currentDir);
return ($delDir === true && $_level > 0) ? @rmdir($path) : true;
}
/**
* Reads the specified directory and builds an array containing the filenames,
* filesize, dates, and permissions
*
* Any sub-folders contained within the specified path are read as well.
*
* @param string $sourceDir Path to source
* @param bool $topLevelOnly Look only at the top level directory specified?
* @param bool $_recursion Internal variable to determine recursion status - do not use in calls
*
* @return array|false
*/
protected function getDirFileInfo(string $sourceDir, bool $topLevelOnly = true, bool $_recursion = false)
{
static $_filedata = [];
$relativePath = $sourceDir;
if ($fp = @opendir($sourceDir)) {
// reset the array and make sure $source_dir has a trailing slash on the initial call
if ($_recursion === false) {
$_filedata = [];
$sourceDir = rtrim(realpath($sourceDir) ?: $sourceDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}
// Used to be foreach (scandir($source_dir, 1) as $file), but scandir() is simply not as fast
while (false !== ($file = readdir($fp))) {
if (is_dir($sourceDir . $file) && $file[0] !== '.' && $topLevelOnly === false) {
$this->getDirFileInfo($sourceDir . $file . DIRECTORY_SEPARATOR, $topLevelOnly, true);
} elseif (! is_dir($sourceDir . $file) && $file[0] !== '.') {
$_filedata[$file] = $this->getFileInfo($sourceDir . $file);
$_filedata[$file]['relative_path'] = $relativePath;
}
}
closedir($fp);
return $_filedata;
}
return false;
}
/**
* Given a file and path, returns the name, path, size, date modified
* Second parameter allows you to explicitly declare what information you want returned
* Options are: name, server_path, size, date, readable, writable, executable, fileperms
* Returns FALSE if the file cannot be found.
*
* @param string $file Path to file
* @param array|string $returnedValues Array or comma separated string of information returned
*
* @return array|false
*/
protected function getFileInfo(string $file, $returnedValues = ['name', 'server_path', 'size', 'date'])
{
if (! is_file($file)) {
return false;
}
if (is_string($returnedValues)) {
$returnedValues = explode(',', $returnedValues);
}
$fileInfo = [];
foreach ($returnedValues as $key) {
switch ($key) {
case 'name':
$fileInfo['name'] = basename($file);
break;
case 'server_path':
$fileInfo['server_path'] = $file;
break;
case 'size':
$fileInfo['size'] = filesize($file);
break;
case 'date':
$fileInfo['date'] = filemtime($file);
break;
case 'readable':
$fileInfo['readable'] = is_readable($file);
break;
case 'writable':
$fileInfo['writable'] = is_writable($file);
break;
case 'executable':
$fileInfo['executable'] = is_executable($file);
break;
case 'fileperms':
$fileInfo['fileperms'] = fileperms($file);
break;
}
}
return $fileInfo;
}
}

276
system4.4.6/Cache/Handlers/MemcachedHandler.php

@ -1,276 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Handlers;
use CodeIgniter\Exceptions\CriticalError;
use CodeIgniter\I18n\Time;
use Config\Cache;
use Exception;
use Memcache;
use Memcached;
/**
* Mamcached cache handler
*
* @see \CodeIgniter\Cache\Handlers\MemcachedHandlerTest
*/
class MemcachedHandler extends BaseHandler
{
/**
* The memcached object
*
* @var Memcache|Memcached
*/
protected $memcached;
/**
* Memcached Configuration
*
* @var array
*/
protected $config = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* Note: Use `CacheFactory::getHandler()` to instantiate.
*/
public function __construct(Cache $config)
{
$this->prefix = $config->prefix;
$this->config = array_merge($this->config, $config->memcached);
}
/**
* Closes the connection to Memcache(d) if present.
*/
public function __destruct()
{
if ($this->memcached instanceof Memcached) {
$this->memcached->quit();
} elseif ($this->memcached instanceof Memcache) {
$this->memcached->close();
}
}
/**
* {@inheritDoc}
*/
public function initialize()
{
try {
if (class_exists(Memcached::class)) {
// Create new instance of Memcached
$this->memcached = new Memcached();
if ($this->config['raw']) {
$this->memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
}
// Add server
$this->memcached->addServer(
$this->config['host'],
$this->config['port'],
$this->config['weight']
);
// attempt to get status of servers
$stats = $this->memcached->getStats();
// $stats should be an associate array with a key in the format of host:port.
// If it doesn't have the key, we know the server is not working as expected.
if (! isset($stats[$this->config['host'] . ':' . $this->config['port']])) {
throw new CriticalError('Cache: Memcached connection failed.');
}
} elseif (class_exists(Memcache::class)) {
// Create new instance of Memcache
$this->memcached = new Memcache();
// Check if we can connect to the server
$canConnect = $this->memcached->connect(
$this->config['host'],
$this->config['port']
);
// If we can't connect, throw a CriticalError exception
if ($canConnect === false) {
throw new CriticalError('Cache: Memcache connection failed.');
}
// Add server, third parameter is persistence and defaults to TRUE.
$this->memcached->addServer(
$this->config['host'],
$this->config['port'],
true,
$this->config['weight']
);
} else {
throw new CriticalError('Cache: Not support Memcache(d) extension.');
}
} catch (Exception $e) {
throw new CriticalError('Cache: Memcache(d) connection refused (' . $e->getMessage() . ').');
}
}
/**
* {@inheritDoc}
*/
public function get(string $key)
{
$data = [];
$key = static::validateKey($key, $this->prefix);
if ($this->memcached instanceof Memcached) {
$data = $this->memcached->get($key);
// check for unmatched key
if ($this->memcached->getResultCode() === Memcached::RES_NOTFOUND) {
return null;
}
} elseif ($this->memcached instanceof Memcache) {
$flags = false;
$data = $this->memcached->get($key, $flags);
// check for unmatched key (i.e. $flags is untouched)
if ($flags === false) {
return null;
}
}
return is_array($data) ? $data[0] : $data;
}
/**
* {@inheritDoc}
*/
public function save(string $key, $value, int $ttl = 60)
{
$key = static::validateKey($key, $this->prefix);
if (! $this->config['raw']) {
$value = [
$value,
Time::now()->getTimestamp(),
$ttl,
];
}
if ($this->memcached instanceof Memcached) {
return $this->memcached->set($key, $value, $ttl);
}
if ($this->memcached instanceof Memcache) {
return $this->memcached->set($key, $value, 0, $ttl);
}
return false;
}
/**
* {@inheritDoc}
*/
public function delete(string $key)
{
$key = static::validateKey($key, $this->prefix);
return $this->memcached->delete($key);
}
/**
* {@inheritDoc}
*
* @return never
*/
public function deleteMatching(string $pattern)
{
throw new Exception('The deleteMatching method is not implemented for Memcached. You must select File, Redis or Predis handlers to use it.');
}
/**
* {@inheritDoc}
*/
public function increment(string $key, int $offset = 1)
{
if (! $this->config['raw']) {
return false;
}
$key = static::validateKey($key, $this->prefix);
return $this->memcached->increment($key, $offset, $offset, 60);
}
/**
* {@inheritDoc}
*/
public function decrement(string $key, int $offset = 1)
{
if (! $this->config['raw']) {
return false;
}
$key = static::validateKey($key, $this->prefix);
// FIXME: third parameter isn't other handler actions.
return $this->memcached->decrement($key, $offset, $offset, 60);
}
/**
* {@inheritDoc}
*/
public function clean()
{
return $this->memcached->flush();
}
/**
* {@inheritDoc}
*/
public function getCacheInfo()
{
return $this->memcached->getStats();
}
/**
* {@inheritDoc}
*/
public function getMetaData(string $key)
{
$key = static::validateKey($key, $this->prefix);
$stored = $this->memcached->get($key);
// if not an array, don't try to count for PHP7.2
if (! is_array($stored) || count($stored) !== 3) {
return false; // @TODO This will return null in a future release
}
[$data, $time, $limit] = $stored;
return [
'expire' => $limit > 0 ? $time + $limit : null,
'mtime' => $time,
'data' => $data,
];
}
/**
* {@inheritDoc}
*/
public function isSupported(): bool
{
return extension_loaded('memcached') || extension_loaded('memcache');
}
}

235
system4.4.6/Cache/Handlers/PredisHandler.php

@ -1,235 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Handlers;
use CodeIgniter\Exceptions\CriticalError;
use CodeIgniter\I18n\Time;
use Config\Cache;
use Exception;
use Predis\Client;
use Predis\Collection\Iterator\Keyspace;
/**
* Predis cache handler
*
* @see \CodeIgniter\Cache\Handlers\PredisHandlerTest
*/
class PredisHandler extends BaseHandler
{
/**
* Default config
*
* @var array
*/
protected $config = [
'scheme' => 'tcp',
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
];
/**
* Predis connection
*
* @var Client
*/
protected $redis;
/**
* Note: Use `CacheFactory::getHandler()` to instantiate.
*/
public function __construct(Cache $config)
{
$this->prefix = $config->prefix;
if (isset($config->redis)) {
$this->config = array_merge($this->config, $config->redis);
}
}
/**
* {@inheritDoc}
*/
public function initialize()
{
try {
$this->redis = new Client($this->config, ['prefix' => $this->prefix]);
$this->redis->time();
} catch (Exception $e) {
throw new CriticalError('Cache: Predis connection refused (' . $e->getMessage() . ').');
}
}
/**
* {@inheritDoc}
*/
public function get(string $key)
{
$key = static::validateKey($key);
$data = array_combine(
['__ci_type', '__ci_value'],
$this->redis->hmget($key, ['__ci_type', '__ci_value'])
);
if (! isset($data['__ci_type'], $data['__ci_value']) || $data['__ci_value'] === false) {
return null;
}
switch ($data['__ci_type']) {
case 'array':
case 'object':
return unserialize($data['__ci_value']);
case 'boolean':
case 'integer':
case 'double': // Yes, 'double' is returned and NOT 'float'
case 'string':
case 'NULL':
return settype($data['__ci_value'], $data['__ci_type']) ? $data['__ci_value'] : null;
case 'resource':
default:
return null;
}
}
/**
* {@inheritDoc}
*/
public function save(string $key, $value, int $ttl = 60)
{
$key = static::validateKey($key);
switch ($dataType = gettype($value)) {
case 'array':
case 'object':
$value = serialize($value);
break;
case 'boolean':
case 'integer':
case 'double': // Yes, 'double' is returned and NOT 'float'
case 'string':
case 'NULL':
break;
case 'resource':
default:
return false;
}
if (! $this->redis->hmset($key, ['__ci_type' => $dataType, '__ci_value' => $value])) {
return false;
}
if ($ttl !== 0) {
$this->redis->expireat($key, Time::now()->getTimestamp() + $ttl);
}
return true;
}
/**
* {@inheritDoc}
*/
public function delete(string $key)
{
$key = static::validateKey($key);
return $this->redis->del($key) === 1;
}
/**
* {@inheritDoc}
*
* @return int
*/
public function deleteMatching(string $pattern)
{
$matchedKeys = [];
foreach (new Keyspace($this->redis, $pattern) as $key) {
$matchedKeys[] = $key;
}
return $this->redis->del($matchedKeys);
}
/**
* {@inheritDoc}
*/
public function increment(string $key, int $offset = 1)
{
$key = static::validateKey($key);
return $this->redis->hincrby($key, 'data', $offset);
}
/**
* {@inheritDoc}
*/
public function decrement(string $key, int $offset = 1)
{
$key = static::validateKey($key);
return $this->redis->hincrby($key, 'data', -$offset);
}
/**
* {@inheritDoc}
*/
public function clean()
{
return $this->redis->flushdb()->getPayload() === 'OK';
}
/**
* {@inheritDoc}
*/
public function getCacheInfo()
{
return $this->redis->info();
}
/**
* {@inheritDoc}
*/
public function getMetaData(string $key)
{
$key = static::validateKey($key);
$data = array_combine(['__ci_value'], $this->redis->hmget($key, ['__ci_value']));
if (isset($data['__ci_value']) && $data['__ci_value'] !== false) {
$time = Time::now()->getTimestamp();
$ttl = $this->redis->ttl($key);
return [
'expire' => $ttl > 0 ? $time + $ttl : null,
'mtime' => $time,
'data' => $data['__ci_value'],
];
}
return null;
}
/**
* {@inheritDoc}
*/
public function isSupported(): bool
{
return class_exists(Client::class);
}
}

267
system4.4.6/Cache/Handlers/RedisHandler.php

@ -1,267 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Handlers;
use CodeIgniter\Exceptions\CriticalError;
use CodeIgniter\I18n\Time;
use Config\Cache;
use Redis;
use RedisException;
/**
* Redis cache handler
*
* @see \CodeIgniter\Cache\Handlers\RedisHandlerTest
*/
class RedisHandler extends BaseHandler
{
/**
* Default config
*
* @var array
*/
protected $config = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/**
* Redis connection
*
* @var Redis|null
*/
protected $redis;
/**
* Note: Use `CacheFactory::getHandler()` to instantiate.
*/
public function __construct(Cache $config)
{
$this->prefix = $config->prefix;
$this->config = array_merge($this->config, $config->redis);
}
/**
* Closes the connection to Redis if present.
*/
public function __destruct()
{
if (isset($this->redis)) {
$this->redis->close();
}
}
/**
* {@inheritDoc}
*/
public function initialize()
{
$config = $this->config;
$this->redis = new Redis();
try {
// Note:: If Redis is your primary cache choice, and it is "offline", every page load will end up been delayed by the timeout duration.
// I feel like some sort of temporary flag should be set, to indicate that we think Redis is "offline", allowing us to bypass the timeout for a set period of time.
if (! $this->redis->connect($config['host'], ($config['host'][0] === '/' ? 0 : $config['port']), $config['timeout'])) {
// Note:: I'm unsure if log_message() is necessary, however I'm not 100% comfortable removing it.
log_message('error', 'Cache: Redis connection failed. Check your configuration.');
throw new CriticalError('Cache: Redis connection failed. Check your configuration.');
}
if (isset($config['password']) && ! $this->redis->auth($config['password'])) {
log_message('error', 'Cache: Redis authentication failed.');
throw new CriticalError('Cache: Redis authentication failed.');
}
if (isset($config['database']) && ! $this->redis->select($config['database'])) {
log_message('error', 'Cache: Redis select database failed.');
throw new CriticalError('Cache: Redis select database failed.');
}
} catch (RedisException $e) {
throw new CriticalError('Cache: RedisException occurred with message (' . $e->getMessage() . ').');
}
}
/**
* {@inheritDoc}
*/
public function get(string $key)
{
$key = static::validateKey($key, $this->prefix);
$data = $this->redis->hMGet($key, ['__ci_type', '__ci_value']);
if (! isset($data['__ci_type'], $data['__ci_value']) || $data['__ci_value'] === false) {
return null;
}
switch ($data['__ci_type']) {
case 'array':
case 'object':
return unserialize($data['__ci_value']);
case 'boolean':
case 'integer':
case 'double': // Yes, 'double' is returned and NOT 'float'
case 'string':
case 'NULL':
return settype($data['__ci_value'], $data['__ci_type']) ? $data['__ci_value'] : null;
case 'resource':
default:
return null;
}
}
/**
* {@inheritDoc}
*/
public function save(string $key, $value, int $ttl = 60)
{
$key = static::validateKey($key, $this->prefix);
switch ($dataType = gettype($value)) {
case 'array':
case 'object':
$value = serialize($value);
break;
case 'boolean':
case 'integer':
case 'double': // Yes, 'double' is returned and NOT 'float'
case 'string':
case 'NULL':
break;
case 'resource':
default:
return false;
}
if (! $this->redis->hMSet($key, ['__ci_type' => $dataType, '__ci_value' => $value])) {
return false;
}
if ($ttl !== 0) {
$this->redis->expireAt($key, Time::now()->getTimestamp() + $ttl);
}
return true;
}
/**
* {@inheritDoc}
*/
public function delete(string $key)
{
$key = static::validateKey($key, $this->prefix);
return $this->redis->del($key) === 1;
}
/**
* {@inheritDoc}
*
* @return int
*/
public function deleteMatching(string $pattern)
{
$matchedKeys = [];
$iterator = null;
do {
// Scan for some keys
$keys = $this->redis->scan($iterator, $pattern);
// Redis may return empty results, so protect against that
if ($keys !== false) {
foreach ($keys as $key) {
$matchedKeys[] = $key;
}
}
} while ($iterator > 0);
return $this->redis->del($matchedKeys);
}
/**
* {@inheritDoc}
*/
public function increment(string $key, int $offset = 1)
{
$key = static::validateKey($key, $this->prefix);
return $this->redis->hIncrBy($key, '__ci_value', $offset);
}
/**
* {@inheritDoc}
*/
public function decrement(string $key, int $offset = 1)
{
return $this->increment($key, -$offset);
}
/**
* {@inheritDoc}
*/
public function clean()
{
return $this->redis->flushDB();
}
/**
* {@inheritDoc}
*/
public function getCacheInfo()
{
return $this->redis->info();
}
/**
* {@inheritDoc}
*/
public function getMetaData(string $key)
{
$value = $this->get($key);
if ($value !== null) {
$time = Time::now()->getTimestamp();
$ttl = $this->redis->ttl(static::validateKey($key, $this->prefix));
assert(is_int($ttl));
return [
'expire' => $ttl > 0 ? $time + $ttl : null,
'mtime' => $time,
'data' => $value,
];
}
return null;
}
/**
* {@inheritDoc}
*/
public function isSupported(): bool
{
return extension_loaded('redis');
}
}

150
system4.4.6/Cache/Handlers/WincacheHandler.php

@ -1,150 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache\Handlers;
use CodeIgniter\I18n\Time;
use Config\Cache;
use Exception;
/**
* Cache handler for WinCache from Microsoft & IIS.
*
* @codeCoverageIgnore
*/
class WincacheHandler extends BaseHandler
{
/**
* Note: Use `CacheFactory::getHandler()` to instantiate.
*/
public function __construct(Cache $config)
{
$this->prefix = $config->prefix;
}
/**
* {@inheritDoc}
*/
public function initialize()
{
}
/**
* {@inheritDoc}
*/
public function get(string $key)
{
$key = static::validateKey($key, $this->prefix);
$success = false;
$data = wincache_ucache_get($key, $success);
// Success returned by reference from wincache_ucache_get()
return $success ? $data : null;
}
/**
* {@inheritDoc}
*/
public function save(string $key, $value, int $ttl = 60)
{
$key = static::validateKey($key, $this->prefix);
return wincache_ucache_set($key, $value, $ttl);
}
/**
* {@inheritDoc}
*/
public function delete(string $key)
{
$key = static::validateKey($key, $this->prefix);
return wincache_ucache_delete($key);
}
/**
* {@inheritDoc}
*
* @return never
*/
public function deleteMatching(string $pattern)
{
throw new Exception('The deleteMatching method is not implemented for Wincache. You must select File, Redis or Predis handlers to use it.');
}
/**
* {@inheritDoc}
*/
public function increment(string $key, int $offset = 1)
{
$key = static::validateKey($key, $this->prefix);
return wincache_ucache_inc($key, $offset);
}
/**
* {@inheritDoc}
*/
public function decrement(string $key, int $offset = 1)
{
$key = static::validateKey($key, $this->prefix);
return wincache_ucache_dec($key, $offset);
}
/**
* {@inheritDoc}
*/
public function clean()
{
return wincache_ucache_clear();
}
/**
* {@inheritDoc}
*/
public function getCacheInfo()
{
return wincache_ucache_info(true);
}
/**
* {@inheritDoc}
*/
public function getMetaData(string $key)
{
$key = static::validateKey($key, $this->prefix);
if ($stored = wincache_ucache_info(false, $key)) {
$age = $stored['ucache_entries'][1]['age_seconds'];
$ttl = $stored['ucache_entries'][1]['ttl_seconds'];
$hitcount = $stored['ucache_entries'][1]['hitcount'];
return [
'expire' => $ttl > 0 ? Time::now()->getTimestamp() + $ttl : null,
'hitcount' => $hitcount,
'age' => $age,
'ttl' => $ttl,
];
}
return false; // @TODO This will return null in a future release
}
/**
* {@inheritDoc}
*/
public function isSupported(): bool
{
return extension_loaded('wincache') && ini_get('wincache.ucenabled');
}
}

151
system4.4.6/Cache/ResponseCache.php

@ -1,151 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Cache;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Cache as CacheConfig;
use Exception;
/**
* Web Page Caching
*
* @see \CodeIgniter\Cache\ResponseCacheTest
*/
final class ResponseCache
{
/**
* Whether to take the URL query string into consideration when generating
* output cache files. Valid options are:
*
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* array('q') = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|string[]
*/
private $cacheQueryString = false;
/**
* Cache time to live.
*
* @var int seconds
*/
private int $ttl = 0;
private CacheInterface $cache;
public function __construct(CacheConfig $config, CacheInterface $cache)
{
$this->cacheQueryString = $config->cacheQueryString;
$this->cache = $cache;
}
/**
* @return $this
*/
public function setTtl(int $ttl)
{
$this->ttl = $ttl;
return $this;
}
/**
* Generates the cache key to use from the current request.
*
* @param CLIRequest|IncomingRequest $request
*
* @internal for testing purposes only
*/
public function generateCacheKey($request): string
{
if ($request instanceof CLIRequest) {
return md5($request->getPath());
}
$uri = clone $request->getUri();
$query = $this->cacheQueryString
? $uri->getQuery(is_array($this->cacheQueryString) ? ['only' => $this->cacheQueryString] : [])
: '';
return md5($uri->setFragment('')->setQuery($query));
}
/**
* Caches the response.
*
* @param CLIRequest|IncomingRequest $request
*/
public function make($request, ResponseInterface $response): bool
{
if ($this->ttl === 0) {
return true;
}
$headers = [];
foreach ($response->headers() as $header) {
$headers[$header->getName()] = $header->getValueLine();
}
return $this->cache->save(
$this->generateCacheKey($request),
serialize(['headers' => $headers, 'output' => $response->getBody()]),
$this->ttl
);
}
/**
* Gets the cached response for the request.
*
* @param CLIRequest|IncomingRequest $request
*/
public function get($request, ResponseInterface $response): ?ResponseInterface
{
if ($cachedResponse = $this->cache->get($this->generateCacheKey($request))) {
$cachedResponse = unserialize($cachedResponse);
if (
! is_array($cachedResponse)
|| ! isset($cachedResponse['output'])
|| ! isset($cachedResponse['headers'])
) {
throw new Exception('Error unserializing page cache');
}
$headers = $cachedResponse['headers'];
$output = $cachedResponse['output'];
// Clear all default headers
foreach (array_keys($response->headers()) as $key) {
$response->removeHeader($key);
}
// Set cached headers
foreach ($headers as $name => $value) {
$response->setHeader($name, $value);
}
$response->setBody($output);
return $response;
}
return null;
}
}

1163
system4.4.6/CodeIgniter.php

File diff suppressed because it is too large Load Diff

88
system4.4.6/Commands/Cache/ClearCache.php

@ -1,88 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Cache;
use CodeIgniter\Cache\CacheFactory;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use Config\Cache;
/**
* Clears current cache.
*/
class ClearCache extends BaseCommand
{
/**
* Command grouping.
*
* @var string
*/
protected $group = 'Cache';
/**
* The Command's name
*
* @var string
*/
protected $name = 'cache:clear';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Clears the current system caches.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = 'cache:clear [<driver>]';
/**
* the Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'driver' => 'The cache driver to use',
];
/**
* Clears the cache
*/
public function run(array $params)
{
$config = config(Cache::class);
$handler = $params[0] ?? $config->handler;
if (! array_key_exists($handler, $config->validHandlers)) {
CLI::error($handler . ' is not a valid cache handler.');
return;
}
$config->handler = $handler;
$cache = CacheFactory::getHandler($config);
if (! $cache->clean()) {
// @codeCoverageIgnoreStart
CLI::error('Error while clearing the cache.');
return;
// @codeCoverageIgnoreEnd
}
CLI::write(CLI::color('Cache cleared.', 'green'));
}
}

89
system4.4.6/Commands/Cache/InfoCache.php

@ -1,89 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Cache;
use CodeIgniter\Cache\CacheFactory;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\I18n\Time;
use Config\Cache;
/**
* Shows information on the cache.
*/
class InfoCache extends BaseCommand
{
/**
* Command grouping.
*
* @var string
*/
protected $group = 'Cache';
/**
* The Command's name
*
* @var string
*/
protected $name = 'cache:info';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Shows file cache information in the current system.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = 'cache:info';
/**
* Clears the cache
*/
public function run(array $params)
{
$config = config(Cache::class);
helper('number');
if ($config->handler !== 'file') {
CLI::error('This command only supports the file cache handler.');
return;
}
$cache = CacheFactory::getHandler($config);
$caches = $cache->getCacheInfo();
$tbody = [];
foreach ($caches as $key => $field) {
$tbody[] = [
$key,
clean_path($field['server_path']),
number_to_size($field['size']),
Time::createFromTimestamp($field['date']),
];
}
$thead = [
CLI::color('Name', 'green'),
CLI::color('Server Path', 'green'),
CLI::color('Size', 'green'),
CLI::color('Date', 'green'),
];
CLI::table($tbody, $thead);
}
}

152
system4.4.6/Commands/Database/CreateDatabase.php

@ -1,152 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Database;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\Config\Factories;
use CodeIgniter\Database\SQLite3\Connection;
use Config\Database;
use Throwable;
/**
* Creates a new database.
*/
class CreateDatabase extends BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
/**
* The Command's name
*
* @var string
*/
protected $name = 'db:create';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Create a new database schema.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = 'db:create <db_name> [options]';
/**
* The Command's arguments
*
* @var array<string, string>
*/
protected $arguments = [
'db_name' => 'The database name to use',
];
/**
* The Command's options
*
* @var array<string, string>
*/
protected $options = [
'--ext' => 'File extension of the database file for SQLite3. Can be `db` or `sqlite`. Defaults to `db`.',
];
/**
* Creates a new database.
*/
public function run(array $params)
{
$name = array_shift($params);
if (empty($name)) {
$name = CLI::prompt('Database name', null, 'required'); // @codeCoverageIgnore
}
try {
$config = config(Database::class);
// Set to an empty database to prevent connection errors.
$group = ENVIRONMENT === 'testing' ? 'tests' : $config->defaultGroup;
$config->{$group}['database'] = '';
$db = Database::connect();
// Special SQLite3 handling
if ($db instanceof Connection) {
$ext = $params['ext'] ?? CLI::getOption('ext') ?? 'db';
if (! in_array($ext, ['db', 'sqlite'], true)) {
$ext = CLI::prompt('Please choose a valid file extension', ['db', 'sqlite']); // @codeCoverageIgnore
}
if ($name !== ':memory:') {
$name = str_replace(['.db', '.sqlite'], '', $name) . ".{$ext}";
}
$config->{$group}['DBDriver'] = 'SQLite3';
$config->{$group}['database'] = $name;
if ($name !== ':memory:') {
$dbName = strpos($name, DIRECTORY_SEPARATOR) === false ? WRITEPATH . $name : $name;
if (is_file($dbName)) {
CLI::error("Database \"{$dbName}\" already exists.", 'light_gray', 'red');
CLI::newLine();
return;
}
unset($dbName);
}
// Connect to new SQLite3 to create new database
$db = Database::connect(null, false);
$db->connect();
if (! is_file($db->getDatabase()) && $name !== ':memory:') {
// @codeCoverageIgnoreStart
CLI::error('Database creation failed.', 'light_gray', 'red');
CLI::newLine();
return;
// @codeCoverageIgnoreEnd
}
} elseif (! Database::forge()->createDatabase($name)) {
// @codeCoverageIgnoreStart
CLI::error('Database creation failed.', 'light_gray', 'red');
CLI::newLine();
return;
// @codeCoverageIgnoreEnd
}
CLI::write("Database \"{$name}\" successfully created.", 'green');
CLI::newLine();
} catch (Throwable $e) {
$this->showError($e);
} finally {
Factories::reset('config');
Database::connect(null, false);
}
}
}

102
system4.4.6/Commands/Database/Migrate.php

@ -1,102 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Database;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use Config\Services;
use Throwable;
/**
* Runs all new migrations.
*/
class Migrate extends BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
/**
* The Command's name
*
* @var string
*/
protected $name = 'migrate';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Locates and runs all new migrations against the database.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = 'migrate [options]';
/**
* the Command's Options
*
* @var array<string, string>
*/
protected $options = [
'-n' => 'Set migration namespace',
'-g' => 'Set database group',
'--all' => 'Set for all namespaces, will ignore (-n) option',
];
/**
* Ensures that all migrations have been run.
*/
public function run(array $params)
{
$runner = Services::migrations();
$runner->clearCliMessages();
CLI::write(lang('Migrations.latest'), 'yellow');
$namespace = $params['n'] ?? CLI::getOption('n');
$group = $params['g'] ?? CLI::getOption('g');
try {
if (array_key_exists('all', $params) || CLI::getOption('all')) {
$runner->setNamespace(null);
} elseif ($namespace) {
$runner->setNamespace($namespace);
}
if (! $runner->latest($group)) {
CLI::error(lang('Migrations.generalFault'), 'light_gray', 'red'); // @codeCoverageIgnore
}
$messages = $runner->getCliMessages();
foreach ($messages as $message) {
CLI::write($message);
}
CLI::write(lang('Migrations.migrated'), 'green');
// @codeCoverageIgnoreStart
} catch (Throwable $e) {
$this->showError($e);
// @codeCoverageIgnoreEnd
}
}
}

87
system4.4.6/Commands/Database/MigrateRefresh.php

@ -1,87 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Database;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
/**
* Does a rollback followed by a latest to refresh the current state
* of the database.
*/
class MigrateRefresh extends BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
/**
* The Command's name
*
* @var string
*/
protected $name = 'migrate:refresh';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Does a rollback followed by a latest to refresh the current state of the database.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = 'migrate:refresh [options]';
/**
* the Command's Options
*
* @var array<string, string>
*/
protected $options = [
'-n' => 'Set migration namespace',
'-g' => 'Set database group',
'--all' => 'Set latest for all namespace, will ignore (-n) option',
'-f' => 'Force command - this option allows you to bypass the confirmation question when running this command in a production environment',
];
/**
* Does a rollback followed by a latest to refresh the current state
* of the database.
*/
public function run(array $params)
{
$params['b'] = 0;
if (ENVIRONMENT === 'production') {
// @codeCoverageIgnoreStart
$force = array_key_exists('f', $params) || CLI::getOption('f');
if (! $force && CLI::prompt(lang('Migrations.refreshConfirm'), ['y', 'n']) === 'n') {
return;
}
$params['f'] = null;
// @codeCoverageIgnoreEnd
}
$this->call('migrate:rollback', $params);
$this->call('migrate', $params);
}
}

104
system4.4.6/Commands/Database/MigrateRollback.php

@ -1,104 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Database;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use Config\Services;
use Throwable;
/**
* Runs all of the migrations in reverse order, until they have
* all been unapplied.
*/
class MigrateRollback extends BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
/**
* The Command's name
*
* @var string
*/
protected $name = 'migrate:rollback';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Runs the "down" method for all migrations in the last batch.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = 'migrate:rollback [options]';
/**
* the Command's Options
*
* @var array<string, string>
*/
protected $options = [
'-b' => 'Specify a batch to roll back to; e.g. "3" to return to batch #3',
'-f' => 'Force command - this option allows you to bypass the confirmation question when running this command in a production environment',
];
/**
* Runs all of the migrations in reverse order, until they have
* all been unapplied.
*/
public function run(array $params)
{
if (ENVIRONMENT === 'production') {
// @codeCoverageIgnoreStart
$force = array_key_exists('f', $params) || CLI::getOption('f');
if (! $force && CLI::prompt(lang('Migrations.rollBackConfirm'), ['y', 'n']) === 'n') {
return;
}
// @codeCoverageIgnoreEnd
}
$runner = Services::migrations();
try {
$batch = $params['b'] ?? CLI::getOption('b') ?? $runner->getLastBatch() - 1;
CLI::write(lang('Migrations.rollingBack') . ' ' . $batch, 'yellow');
if (! $runner->regress($batch)) {
CLI::error(lang('Migrations.generalFault'), 'light_gray', 'red'); // @codeCoverageIgnore
}
$messages = $runner->getCliMessages();
foreach ($messages as $message) {
CLI::write($message);
}
CLI::write('Done rolling back migrations.', 'green');
// @codeCoverageIgnoreStart
} catch (Throwable $e) {
$this->showError($e);
// @codeCoverageIgnoreEnd
}
}
}

167
system4.4.6/Commands/Database/MigrateStatus.php

@ -1,167 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Database;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use Config\Services;
/**
* Displays a list of all migrations and whether they've been run or not.
*
* @see \CodeIgniter\Commands\Database\MigrateStatusTest
*/
class MigrateStatus extends BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
/**
* The Command's name
*
* @var string
*/
protected $name = 'migrate:status';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Displays a list of all migrations and whether they\'ve been run or not.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = 'migrate:status [options]';
/**
* the Command's Options
*
* @var array<string, string>
*/
protected $options = [
'-g' => 'Set database group',
];
/**
* Namespaces to ignore when looking for migrations.
*
* @var string[]
*/
protected $ignoredNamespaces = [
'CodeIgniter',
'Config',
'Kint',
'Laminas\ZendFrameworkBridge',
'Laminas\Escaper',
'Psr\Log',
];
/**
* Displays a list of all migrations and whether they've been run or not.
*
* @param array<string, mixed> $params
*/
public function run(array $params)
{
$runner = Services::migrations();
$paramGroup = $params['g'] ?? CLI::getOption('g');
// Get all namespaces
$namespaces = Services::autoloader()->getNamespace();
// Collection of migration status
$status = [];
foreach (array_keys($namespaces) as $namespace) {
if (ENVIRONMENT !== 'testing') {
// Make Tests\\Support discoverable for testing
$this->ignoredNamespaces[] = 'Tests\Support'; // @codeCoverageIgnore
}
if (in_array($namespace, $this->ignoredNamespaces, true)) {
continue;
}
if (APP_NAMESPACE !== 'App' && $namespace === 'App') {
continue; // @codeCoverageIgnore
}
$migrations = $runner->findNamespaceMigrations($namespace);
if (empty($migrations)) {
continue;
}
$runner->setNamespace($namespace);
$history = $runner->getHistory((string) $paramGroup);
ksort($migrations);
foreach ($migrations as $uid => $migration) {
$migrations[$uid]->name = mb_substr($migration->name, mb_strpos($migration->name, $uid . '_'));
$date = '---';
$group = '---';
$batch = '---';
foreach ($history as $row) {
// @codeCoverageIgnoreStart
if ($runner->getObjectUid($row) !== $migration->uid) {
continue;
}
$date = date('Y-m-d H:i:s', $row->time);
$group = $row->group;
$batch = $row->batch;
// @codeCoverageIgnoreEnd
}
$status[] = [
$namespace,
$migration->version,
$migration->name,
$group,
$date,
$batch,
];
}
}
if (! $status) {
// @codeCoverageIgnoreStart
CLI::error(lang('Migrations.noneFound'), 'light_gray', 'red');
CLI::newLine();
return;
// @codeCoverageIgnoreEnd
}
$headers = [
CLI::color(lang('Migrations.namespace'), 'yellow'),
CLI::color(lang('Migrations.version'), 'yellow'),
CLI::color(lang('Migrations.filename'), 'yellow'),
CLI::color(lang('Migrations.group'), 'yellow'),
CLI::color(str_replace(': ', '', lang('Migrations.on')), 'yellow'),
CLI::color(lang('Migrations.batch'), 'yellow'),
];
CLI::table($status, $headers);
}
}

82
system4.4.6/Commands/Database/Seed.php

@ -1,82 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Database;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\Database\Seeder;
use Config\Database;
use Throwable;
/**
* Runs the specified Seeder file to populate the database
* with some data.
*/
class Seed extends BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
/**
* The Command's name
*
* @var string
*/
protected $name = 'db:seed';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Runs the specified seeder to populate known data into the database.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = 'db:seed <seeder_name>';
/**
* the Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'seeder_name' => 'The seeder name to run',
];
/**
* Passes to Seeder to populate the database.
*/
public function run(array $params)
{
$seeder = new Seeder(new Database());
$seedName = array_shift($params);
if (empty($seedName)) {
$seedName = CLI::prompt(lang('Migrations.migSeeder'), null, 'required'); // @codeCoverageIgnore
}
try {
$seeder->call($seedName);
} catch (Throwable $e) {
$this->showError($e);
}
}
}

285
system4.4.6/Commands/Database/ShowTableInfo.php

@ -1,285 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Database;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\Database\BaseConnection;
use Config\Database;
/**
* Get table data if it exists in the database.
*
* @see \CodeIgniter\Commands\Database\ShowTableInfoTest
*/
class ShowTableInfo extends BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
/**
* The Command's name
*
* @var string
*/
protected $name = 'db:table';
/**
* the Command's short description
*
* @var string
*/
protected $description = 'Retrieves information on the selected table.';
/**
* the Command's usage
*
* @var string
*/
protected $usage = <<<'EOL'
db:table [<table_name>] [options]
Examples:
db:table --show
db:table --metadata
db:table my_table --metadata
db:table my_table
db:table my_table --limit-rows 5 --limit-field-value 10 --desc
EOL;
/**
* The Command's arguments
*
* @var array<string, string>
*/
protected $arguments = [
'table_name' => 'The table name to show info',
];
/**
* The Command's options
*
* @var array<string, string>
*/
protected $options = [
'--show' => 'Lists the names of all database tables.',
'--metadata' => 'Retrieves list containing field information.',
'--desc' => 'Sorts the table rows in DESC order.',
'--limit-rows' => 'Limits the number of rows. Default: 10.',
'--limit-field-value' => 'Limits the length of field values. Default: 15.',
];
/**
* @var list<list<int|string>> Table Data.
*/
private array $tbody;
private BaseConnection $db;
/**
* @var bool Sort the table rows in DESC order or not.
*/
private bool $sortDesc = false;
private string $DBPrefix;
public function run(array $params)
{
$this->db = Database::connect();
$this->DBPrefix = $this->db->getPrefix();
$tables = $this->db->listTables();
if (array_key_exists('desc', $params)) {
$this->sortDesc = true;
}
if ($tables === []) {
CLI::error('Database has no tables!', 'light_gray', 'red');
CLI::newLine();
return;
}
if (array_key_exists('show', $params)) {
$this->showAllTables($tables);
return;
}
$tableName = $params[0] ?? null;
$limitRows = (int) ($params['limit-rows'] ?? 10);
$limitFieldValue = (int) ($params['limit-field-value'] ?? 15);
while (! in_array($tableName, $tables, true)) {
$tableNameNo = CLI::promptByKey(
['Here is the list of your database tables:', 'Which table do you want to see?'],
$tables,
'required'
);
CLI::newLine();
$tableName = $tables[$tableNameNo] ?? null;
}
if (array_key_exists('metadata', $params)) {
$this->showFieldMetaData($tableName);
return;
}
$this->showDataOfTable($tableName, $limitRows, $limitFieldValue);
}
private function removeDBPrefix(): void
{
$this->db->setPrefix('');
}
private function restoreDBPrefix(): void
{
$this->db->setPrefix($this->DBPrefix);
}
private function showDataOfTable(string $tableName, int $limitRows, int $limitFieldValue)
{
CLI::write("Data of Table \"{$tableName}\":", 'black', 'yellow');
CLI::newLine();
$this->removeDBPrefix();
$thead = $this->db->getFieldNames($tableName);
$this->restoreDBPrefix();
// If there is a field named `id`, sort by it.
$sortField = null;
if (in_array('id', $thead, true)) {
$sortField = 'id';
}
$this->tbody = $this->makeTableRows($tableName, $limitRows, $limitFieldValue, $sortField);
CLI::table($this->tbody, $thead);
}
private function showAllTables(array $tables)
{
CLI::write('The following is a list of the names of all database tables:', 'black', 'yellow');
CLI::newLine();
$thead = ['ID', 'Table Name', 'Num of Rows', 'Num of Fields'];
$this->tbody = $this->makeTbodyForShowAllTables($tables);
CLI::table($this->tbody, $thead);
CLI::newLine();
}
private function makeTbodyForShowAllTables(array $tables): array
{
$this->removeDBPrefix();
foreach ($tables as $id => $tableName) {
$table = $this->db->protectIdentifiers($tableName);
$db = $this->db->query("SELECT * FROM {$table}");
$this->tbody[] = [
$id + 1,
$tableName,
$db->getNumRows(),
$db->getFieldCount(),
];
}
$this->restoreDBPrefix();
if ($this->sortDesc) {
krsort($this->tbody);
}
return $this->tbody;
}
private function makeTableRows(
string $tableName,
int $limitRows,
int $limitFieldValue,
?string $sortField = null
): array {
$this->tbody = [];
$this->removeDBPrefix();
$builder = $this->db->table($tableName);
$builder->limit($limitRows);
if ($sortField !== null) {
$builder->orderBy($sortField, $this->sortDesc ? 'DESC' : 'ASC');
}
$rows = $builder->get()->getResultArray();
$this->restoreDBPrefix();
foreach ($rows as $row) {
$row = array_map(
static fn ($item): string => mb_strlen((string) $item) > $limitFieldValue
? mb_substr((string) $item, 0, $limitFieldValue) . '...'
: (string) $item,
$row
);
$this->tbody[] = $row;
}
if ($sortField === null && $this->sortDesc) {
krsort($this->tbody);
}
return $this->tbody;
}
private function showFieldMetaData(string $tableName): void
{
CLI::write("List of Metadata Information in Table \"{$tableName}\":", 'black', 'yellow');
CLI::newLine();
$thead = ['Field Name', 'Type', 'Max Length', 'Nullable', 'Default', 'Primary Key'];
$this->removeDBPrefix();
$fields = $this->db->getFieldData($tableName);
$this->restoreDBPrefix();
foreach ($fields as $row) {
$this->tbody[] = [
$row->name,
$row->type,
$row->max_length,
isset($row->nullable) ? $this->setYesOrNo($row->nullable) : 'n/a',
$row->default,
isset($row->primary_key) ? $this->setYesOrNo($row->primary_key) : 'n/a',
];
}
if ($this->sortDesc) {
krsort($this->tbody);
}
CLI::table($this->tbody, $thead);
}
private function setYesOrNo(bool $fieldValue): string
{
if ($fieldValue) {
return CLI::color('Yes', 'green');
}
return CLI::color('No', 'red');
}
}

199
system4.4.6/Commands/Encryption/GenerateKey.php

@ -1,199 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Encryption;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\Config\DotEnv;
use CodeIgniter\Encryption\Encryption;
/**
* Generates a new encryption key.
*/
class GenerateKey extends BaseCommand
{
/**
* The Command's group.
*
* @var string
*/
protected $group = 'Encryption';
/**
* The Command's name.
*
* @var string
*/
protected $name = 'key:generate';
/**
* The Command's usage.
*
* @var string
*/
protected $usage = 'key:generate [options]';
/**
* The Command's short description.
*
* @var string
*/
protected $description = 'Generates a new encryption key and writes it in an `.env` file.';
/**
* The command's options
*
* @var array<string, string>
*/
protected $options = [
'--force' => 'Force overwrite existing key in `.env` file.',
'--length' => 'The length of the random string that should be returned in bytes. Defaults to 32.',
'--prefix' => 'Prefix to prepend to encoded key (either hex2bin or base64). Defaults to hex2bin.',
'--show' => 'Shows the generated key in the terminal instead of storing in the `.env` file.',
];
/**
* Actually execute the command.
*/
public function run(array $params)
{
$prefix = $params['prefix'] ?? CLI::getOption('prefix');
if (in_array($prefix, [null, true], true)) {
$prefix = 'hex2bin';
} elseif (! in_array($prefix, ['hex2bin', 'base64'], true)) {
$prefix = CLI::prompt('Please provide a valid prefix to use.', ['hex2bin', 'base64'], 'required'); // @codeCoverageIgnore
}
$length = $params['length'] ?? CLI::getOption('length');
if (in_array($length, [null, true], true)) {
$length = 32;
}
$encodedKey = $this->generateRandomKey($prefix, $length);
if (array_key_exists('show', $params) || (bool) CLI::getOption('show')) {
CLI::write($encodedKey, 'yellow');
CLI::newLine();
return;
}
if (! $this->setNewEncryptionKey($encodedKey, $params)) {
CLI::write('Error in setting new encryption key to .env file.', 'light_gray', 'red');
CLI::newLine();
return;
}
// force DotEnv to reload the new env vars
putenv('encryption.key');
unset($_ENV['encryption.key'], $_SERVER['encryption.key']);
$dotenv = new DotEnv(ROOTPATH);
$dotenv->load();
CLI::write('Application\'s new encryption key was successfully set.', 'green');
CLI::newLine();
}
/**
* Generates a key and encodes it.
*/
protected function generateRandomKey(string $prefix, int $length): string
{
$key = Encryption::createKey($length);
if ($prefix === 'hex2bin') {
return 'hex2bin:' . bin2hex($key);
}
return 'base64:' . base64_encode($key);
}
/**
* Sets the new encryption key in your .env file.
*/
protected function setNewEncryptionKey(string $key, array $params): bool
{
$currentKey = env('encryption.key', '');
if ($currentKey !== '' && ! $this->confirmOverwrite($params)) {
// Not yet testable since it requires keyboard input
return false; // @codeCoverageIgnore
}
return $this->writeNewEncryptionKeyToFile($currentKey, $key);
}
/**
* Checks whether to overwrite existing encryption key.
*/
protected function confirmOverwrite(array $params): bool
{
return (array_key_exists('force', $params) || CLI::getOption('force')) || CLI::prompt('Overwrite existing key?', ['n', 'y']) === 'y';
}
/**
* Writes the new encryption key to .env file.
*/
protected function writeNewEncryptionKeyToFile(string $oldKey, string $newKey): bool
{
$baseEnv = ROOTPATH . 'env';
$envFile = ROOTPATH . '.env';
if (! is_file($envFile)) {
if (! is_file($baseEnv)) {
CLI::write('Both default shipped `env` file and custom `.env` are missing.', 'yellow');
CLI::write('Here\'s your new key instead: ' . CLI::color($newKey, 'yellow'));
CLI::newLine();
return false;
}
copy($baseEnv, $envFile);
}
$oldFileContents = (string) file_get_contents($envFile);
$replacementKey = "\nencryption.key = {$newKey}";
if (strpos($oldFileContents, 'encryption.key') === false) {
return file_put_contents($envFile, $replacementKey, FILE_APPEND) !== false;
}
$newFileContents = preg_replace($this->keyPattern($oldKey), $replacementKey, $oldFileContents);
if ($newFileContents === $oldFileContents) {
$newFileContents = preg_replace(
'/^[#\s]*encryption.key[=\s]*(?:hex2bin\:[a-f0-9]{64}|base64\:(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?)$/m',
$replacementKey,
$oldFileContents
);
}
return file_put_contents($envFile, $newFileContents) !== false;
}
/**
* Get the regex of the current encryption key.
*/
protected function keyPattern(string $oldKey): string
{
$escaped = preg_quote($oldKey, '/');
if ($escaped !== '') {
$escaped = "[{$escaped}]*";
}
return "/^[#\\s]*encryption.key[=\\s]*{$escaped}$/m";
}
}

98
system4.4.6/Commands/Generators/CellGenerator.php

@ -1,98 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a skeleton Cell and its view.
*/
class CellGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:cell';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new Controlled Cell file and its view.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:cell <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The Controlled Cell class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Cell';
$this->directory = 'Cells';
$params = array_merge($params, ['suffix' => null]);
$this->template = 'cell.tpl.php';
$this->classNameLang = 'CLI.generator.className.cell';
$this->generateClass($params);
$this->name = 'make:cell_view';
$this->template = 'cell_view.tpl.php';
$this->classNameLang = 'CLI.generator.viewName.cell';
$className = $this->qualifyClassName();
$viewName = decamelize(class_basename($className));
$viewName = preg_replace('/([a-z][a-z0-9_\/\\\\]+)(_cell)$/i', '$1', $viewName) ?? $viewName;
$namespace = substr($className, 0, strrpos($className, '\\') + 1);
$this->generateView($namespace . $viewName, $params);
return 0;
}
}

119
system4.4.6/Commands/Generators/CommandGenerator.php

@ -1,119 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a skeleton command file.
*/
class CommandGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:command';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new spark command.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:command <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The command class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--command' => 'The command name. Default: "command:name"',
'--type' => 'The command type. Options [basic, generator]. Default: "basic".',
'--group' => 'The command group. Default: [basic -> "App", generator -> "Generators"].',
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserCommand).',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Command';
$this->directory = 'Commands';
$this->template = 'command.tpl.php';
$this->classNameLang = 'CLI.generator.className.command';
$this->execute($params);
}
/**
* Prepare options and do the necessary replacements.
*/
protected function prepare(string $class): string
{
$command = $this->getOption('command');
$group = $this->getOption('group');
$type = $this->getOption('type');
$command = is_string($command) ? $command : 'command:name';
$type = is_string($type) ? $type : 'basic';
if (! in_array($type, ['basic', 'generator'], true)) {
// @codeCoverageIgnoreStart
$type = CLI::prompt(lang('CLI.generator.commandType'), ['basic', 'generator'], 'required');
CLI::newLine();
// @codeCoverageIgnoreEnd
}
if (! is_string($group)) {
$group = $type === 'generator' ? 'Generators' : 'App';
}
return $this->parseTemplate(
$class,
['{group}', '{command}'],
[$group, $command],
['type' => $type]
);
}
}

98
system4.4.6/Commands/Generators/ConfigGenerator.php

@ -1,98 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a skeleton config file.
*/
class ConfigGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:config';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new config file.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:config <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The config class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserConfig).',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Config';
$this->directory = 'Config';
$this->template = 'config.tpl.php';
$this->classNameLang = 'CLI.generator.className.config';
$this->execute($params);
}
/**
* Prepare options and do the necessary replacements.
*/
protected function prepare(string $class): string
{
$namespace = $this->getOption('namespace') ?? APP_NAMESPACE;
if ($namespace === APP_NAMESPACE) {
$class = substr($class, strlen($namespace . '\\'));
}
return $this->parseTemplate($class);
}
}

134
system4.4.6/Commands/Generators/ControllerGenerator.php

@ -1,134 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\CLI\GeneratorTrait;
use CodeIgniter\Controller;
use CodeIgniter\RESTful\ResourceController;
use CodeIgniter\RESTful\ResourcePresenter;
/**
* Generates a skeleton controller file.
*/
class ControllerGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:controller';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new controller file.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:controller <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The controller class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--bare' => 'Extends from CodeIgniter\Controller instead of BaseController.',
'--restful' => 'Extends from a RESTful resource, Options: [controller, presenter]. Default: "controller".',
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserController).',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Controller';
$this->directory = 'Controllers';
$this->template = 'controller.tpl.php';
$this->classNameLang = 'CLI.generator.className.controller';
$this->execute($params);
}
/**
* Prepare options and do the necessary replacements.
*/
protected function prepare(string $class): string
{
$bare = $this->getOption('bare');
$rest = $this->getOption('restful');
$useStatement = trim(APP_NAMESPACE, '\\') . '\Controllers\BaseController';
$extends = 'BaseController';
// Gets the appropriate parent class to extend.
if ($bare || $rest) {
if ($bare) {
$useStatement = Controller::class;
$extends = 'Controller';
} elseif ($rest) {
$rest = is_string($rest) ? $rest : 'controller';
if (! in_array($rest, ['controller', 'presenter'], true)) {
// @codeCoverageIgnoreStart
$rest = CLI::prompt(lang('CLI.generator.parentClass'), ['controller', 'presenter'], 'required');
CLI::newLine();
// @codeCoverageIgnoreEnd
}
if ($rest === 'controller') {
$useStatement = ResourceController::class;
$extends = 'ResourceController';
} elseif ($rest === 'presenter') {
$useStatement = ResourcePresenter::class;
$extends = 'ResourcePresenter';
}
}
}
return $this->parseTemplate(
$class,
['{useStatement}', '{extends}'],
[$useStatement, $extends],
['type' => $rest]
);
}
}

84
system4.4.6/Commands/Generators/EntityGenerator.php

@ -1,84 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a skeleton Entity file.
*/
class EntityGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:entity';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new entity file.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:entity <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The entity class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserEntity).',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Entity';
$this->directory = 'Entities';
$this->template = 'entity.tpl.php';
$this->classNameLang = 'CLI.generator.className.entity';
$this->execute($params);
}
}

84
system4.4.6/Commands/Generators/FilterGenerator.php

@ -1,84 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a skeleton Filter file.
*/
class FilterGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:filter';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new filter file.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:filter <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The filter class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserFilter).',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Filter';
$this->directory = 'Filters';
$this->template = 'filter.tpl.php';
$this->classNameLang = 'CLI.generator.className.filter';
$this->execute($params);
}
}

90
system4.4.6/Commands/Generators/MigrateCreate.php

@ -1,90 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
/**
* Deprecated class for the migration creation command.
*
* @deprecated Use make:migration instead.
*
* @codeCoverageIgnore
*/
class MigrateCreate extends BaseCommand
{
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's name
*
* @var string
*/
protected $name = 'migrate:create';
/**
* The Command's short description
*
* @var string
*/
protected $description = '[DEPRECATED] Creates a new migration file. Please use "make:migration" instead.';
/**
* The Command's usage
*
* @var string
*/
protected $usage = 'migrate:create <name> [options]';
/**
* The Command's arguments.
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The migration file name.',
];
/**
* The Command's options.
*
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Defaults to APP_NAMESPACE',
'--force' => 'Force overwrite existing files.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
// Resolve arguments before passing to make:migration
$params[0] ??= CLI::getSegment(2);
$params['namespace'] ??= CLI::getOption('namespace') ?? APP_NAMESPACE;
if (array_key_exists('force', $params) || CLI::getOption('force')) {
$params['force'] = null;
}
$this->call('make:migration', $params);
}
}

129
system4.4.6/Commands/Generators/MigrationGenerator.php

@ -1,129 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\CLI\GeneratorTrait;
use Config\Database;
use Config\Migrations;
use Config\Session as SessionConfig;
/**
* Generates a skeleton migration file.
*/
class MigrationGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:migration';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new migration file.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:migration <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The migration class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--session' => 'Generates the migration file for database sessions.',
'--table' => 'Table name to use for database sessions. Default: "ci_sessions".',
'--dbgroup' => 'Database group to use for database sessions. Default: "default".',
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserMigration).',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Migration';
$this->directory = 'Database\Migrations';
$this->template = 'migration.tpl.php';
if (array_key_exists('session', $params) || CLI::getOption('session')) {
$table = $params['table'] ?? CLI::getOption('table') ?? 'ci_sessions';
$params[0] = "_create_{$table}_table";
}
$this->classNameLang = 'CLI.generator.className.migration';
$this->execute($params);
}
/**
* Prepare options and do the necessary replacements.
*/
protected function prepare(string $class): string
{
$data = [];
$data['session'] = false;
if ($this->getOption('session')) {
$table = $this->getOption('table');
$DBGroup = $this->getOption('dbgroup');
$data['session'] = true;
$data['table'] = is_string($table) ? $table : 'ci_sessions';
$data['DBGroup'] = is_string($DBGroup) ? $DBGroup : 'default';
$data['DBDriver'] = config(Database::class)->{$data['DBGroup']}['DBDriver'];
/** @var SessionConfig|null $session */
$session = config(SessionConfig::class);
$data['matchIP'] = $session->matchIP;
}
return $this->parseTemplate($class, [], [], $data);
}
/**
* Change file basename before saving.
*/
protected function basename(string $filename): string
{
return gmdate(config(Migrations::class)->timestampFormat) . basename($filename);
}
}

133
system4.4.6/Commands/Generators/ModelGenerator.php

@ -1,133 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a skeleton Model file.
*/
class ModelGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:model';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new model file.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:model <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The model class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--table' => 'Supply a table name. Default: "the lowercased plural of the class name".',
'--dbgroup' => 'Database group to use. Default: "default".',
'--return' => 'Return type, Options: [array, object, entity]. Default: "array".',
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserModel).',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Model';
$this->directory = 'Models';
$this->template = 'model.tpl.php';
$this->classNameLang = 'CLI.generator.className.model';
$this->execute($params);
}
/**
* Prepare options and do the necessary replacements.
*/
protected function prepare(string $class): string
{
$table = $this->getOption('table');
$dbGroup = $this->getOption('dbgroup');
$return = $this->getOption('return');
$baseClass = class_basename($class);
if (preg_match('/^(\S+)Model$/i', $baseClass, $match) === 1) {
$baseClass = $match[1];
}
$table = is_string($table) ? $table : plural(strtolower($baseClass));
$return = is_string($return) ? $return : 'array';
if (! in_array($return, ['array', 'object', 'entity'], true)) {
// @codeCoverageIgnoreStart
$return = CLI::prompt(lang('CLI.generator.returnType'), ['array', 'object', 'entity'], 'required');
CLI::newLine();
// @codeCoverageIgnoreEnd
}
if ($return === 'entity') {
$return = str_replace('Models', 'Entities', $class);
if (preg_match('/^(\S+)Model$/i', $return, $match) === 1) {
$return = $match[1];
if ($this->getOption('suffix')) {
$return .= 'Entity';
}
}
$return = '\\' . trim($return, '\\') . '::class';
$this->call('make:entity', array_merge([$baseClass], $this->params));
} else {
$return = "'{$return}'";
}
return $this->parseTemplate($class, ['{dbGroup}', '{table}', '{return}'], [$dbGroup, $table, $return], compact('dbGroup'));
}
}

121
system4.4.6/Commands/Generators/ScaffoldGenerator.php

@ -1,121 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a complete set of scaffold files.
*/
class ScaffoldGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:scaffold';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a complete set of scaffold files.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:scaffold <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The class name',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--bare' => 'Add the "--bare" option to controller component.',
'--restful' => 'Add the "--restful" option to controller component.',
'--table' => 'Add the "--table" option to the model component.',
'--dbgroup' => 'Add the "--dbgroup" option to model component.',
'--return' => 'Add the "--return" option to the model component.',
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name.',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->params = $params;
$options = [];
if ($this->getOption('namespace')) {
$options['namespace'] = $this->getOption('namespace');
}
if ($this->getOption('suffix')) {
$options['suffix'] = null;
}
if ($this->getOption('force')) {
$options['force'] = null;
}
$controllerOpts = [];
if ($this->getOption('bare')) {
$controllerOpts['bare'] = null;
} elseif ($this->getOption('restful')) {
$controllerOpts['restful'] = $this->getOption('restful');
}
$modelOpts = [
'table' => $this->getOption('table'),
'dbgroup' => $this->getOption('dbgroup'),
'return' => $this->getOption('return'),
];
$class = $params[0] ?? CLI::getSegment(2);
// Call those commands!
$this->call('make:controller', array_merge([$class], $controllerOpts, $options));
$this->call('make:model', array_merge([$class], $modelOpts, $options));
$this->call('make:migration', array_merge([$class], $options));
$this->call('make:seeder', array_merge([$class], $options));
}
}

84
system4.4.6/Commands/Generators/SeederGenerator.php

@ -1,84 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a skeleton seeder file.
*/
class SeederGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:seeder';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new seeder file.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:seeder <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The seeder class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserSeeder).',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Seeder';
$this->directory = 'Database\Seeds';
$this->template = 'seeder.tpl.php';
$this->classNameLang = 'CLI.generator.className.seeder';
$this->execute($params);
}
}

113
system4.4.6/Commands/Generators/SessionMigrationGenerator.php

@ -1,113 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
use CodeIgniter\CLI\GeneratorTrait;
use Config\App;
use Config\Migrations;
/**
* Generates a migration file for database sessions.
*
* @deprecated Use `make:migration --session` instead.
*
* @codeCoverageIgnore
*/
class SessionMigrationGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'session:migration';
/**
* The Command's Description
*
* @var string
*/
protected $description = '[DEPRECATED] Generates the migration file for database sessions, Please use "make:migration --session" instead.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'session:migration [options]';
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'-t' => 'Supply a table name.',
'-g' => 'Database group to use. Default: "default".',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Migration';
$this->directory = 'Database\Migrations';
$this->template = 'migration.tpl.php';
$table = 'ci_sessions';
if (array_key_exists('t', $params) || CLI::getOption('t')) {
$table = $params['t'] ?? CLI::getOption('t');
}
$params[0] = "_create_{$table}_table";
$this->execute($params);
}
/**
* Performs the necessary replacements.
*/
protected function prepare(string $class): string
{
$data = [];
$data['session'] = true;
$data['table'] = $this->getOption('t');
$data['DBGroup'] = $this->getOption('g');
$data['matchIP'] = config(App::class)->sessionMatchIP ?? false;
$data['table'] = is_string($data['table']) ? $data['table'] : 'ci_sessions';
$data['DBGroup'] = is_string($data['DBGroup']) ? $data['DBGroup'] : 'default';
return $this->parseTemplate($class, [], [], $data);
}
/**
* Change file basename before saving.
*/
protected function basename(string $filename): string
{
return gmdate(config(Migrations::class)->timestampFormat) . basename($filename);
}
}

84
system4.4.6/Commands/Generators/ValidationGenerator.php

@ -1,84 +0,0 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands\Generators;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\GeneratorTrait;
/**
* Generates a skeleton Validation file.
*/
class ValidationGenerator extends BaseCommand
{
use GeneratorTrait;
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Generators';
/**
* The Command's Name
*
* @var string
*/
protected $name = 'make:validation';
/**
* The Command's Description
*
* @var string
*/
protected $description = 'Generates a new validation file.';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = 'make:validation <name> [options]';
/**
* The Command's Arguments
*
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The validation class name.',
];
/**
* The Command's Options
*
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
'--suffix' => 'Append the component title to the class name (e.g. User => UserValidation).',
'--force' => 'Force overwrite existing file.',
];
/**
* Actually execute a command.
*/
public function run(array $params)
{
$this->component = 'Validation';
$this->directory = 'Validation';
$this->template = 'validation.tpl.php';
$this->classNameLang = 'CLI.generator.className.validation';
$this->execute($params);
}
}

10
system4.4.6/Commands/Generators/Views/cell.tpl.php

@ -1,10 +0,0 @@
<@php
namespace {namespace};
use CodeIgniter\View\Cells\Cell;
class {class} extends Cell
{
//
}

3
system4.4.6/Commands/Generators/Views/cell_view.tpl.php

@ -1,3 +0,0 @@
<div>
<!-- Your HTML here -->
</div>

76
system4.4.6/Commands/Generators/Views/command.tpl.php

@ -1,76 +0,0 @@
<@php
namespace {namespace};
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
<?php if ($type === 'generator'): ?>
use CodeIgniter\CLI\GeneratorTrait;
<?php endif ?>
class {class} extends BaseCommand
{
<?php if ($type === 'generator'): ?>
use GeneratorTrait;
<?php endif ?>
/**
* The Command's Group
*
* @var string
*/
protected $group = '{group}';
/**
* The Command's Name
*
* @var string
*/
protected $name = '{command}';
/**
* The Command's Description
*
* @var string
*/
protected $description = '';
/**
* The Command's Usage
*
* @var string
*/
protected $usage = '{command} [arguments] [options]';
/**
* The Command's Arguments
*
* @var array
*/
protected $arguments = [];
/**
* The Command's Options
*
* @var array
*/
protected $options = [];
/**
* Actually execute a command.
*
* @param array $params
*/
public function run(array $params)
{
<?php if ($type === 'generator'): ?>
$this->component = 'Command';
$this->directory = 'Commands';
$this->template = 'command.tpl.php';
$this->execute($params);
<?php else: ?>
//
<?php endif ?>
}
}

10
system4.4.6/Commands/Generators/Views/config.tpl.php

@ -1,10 +0,0 @@
<@php
namespace {namespace};
use CodeIgniter\Config\BaseConfig;
class {class} extends BaseConfig
{
//
}

186
system4.4.6/Commands/Generators/Views/controller.tpl.php

@ -1,186 +0,0 @@
<@php
namespace {namespace};
use {useStatement};
use CodeIgniter\HTTP\ResponseInterface;
class {class} extends {extends}
{
<?php if ($type === 'controller'): ?>
/**
* Return an array of resource objects, themselves in array format.
*
* @return ResponseInterface
*/
public function index()
{
//
}
/**
* Return the properties of a resource object.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function show($id = null)
{
//
}
/**
* Return a new resource object, with default properties.
*
* @return ResponseInterface
*/
public function new()
{
//
}
/**
* Create a new resource object, from "posted" parameters.
*
* @return ResponseInterface
*/
public function create()
{
//
}
/**
* Return the editable properties of a resource object.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function edit($id = null)
{
//
}
/**
* Add or update a model resource, from "posted" properties.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function update($id = null)
{
//
}
/**
* Delete the designated resource object from the model.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function delete($id = null)
{
//
}
<?php elseif ($type === 'presenter'): ?>
/**
* Present a view of resource objects.
*
* @return ResponseInterface
*/
public function index()
{
//
}
/**
* Present a view to present a specific resource object.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function show($id = null)
{
//
}
/**
* Present a view to present a new single resource object.
*
* @return ResponseInterface
*/
public function new()
{
//
}
/**
* Process the creation/insertion of a new resource object.
* This should be a POST.
*
* @return ResponseInterface
*/
public function create()
{
//
}
/**
* Present a view to edit the properties of a specific resource object.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function edit($id = null)
{
//
}
/**
* Process the updating, full or partial, of a specific resource object.
* This should be a POST.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function update($id = null)
{
//
}
/**
* Present a view to confirm the deletion of a specific resource object.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function remove($id = null)
{
//
}
/**
* Process the deletion of a specific resource object.
*
* @param int|string|null $id
*
* @return ResponseInterface
*/
public function delete($id = null)
{
//
}
<?php else: ?>
public function index()
{
//
}
<?php endif ?>
}

12
system4.4.6/Commands/Generators/Views/entity.tpl.php

@ -1,12 +0,0 @@
<@php
namespace {namespace};
use CodeIgniter\Entity\Entity;
class {class} extends Entity
{
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save