mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-19 13:01:19 +00:00
chore: update CI4 to 4.2.1
This commit is contained in:
parent
cca973e9c2
commit
9f4a467ad4
@ -87,11 +87,7 @@ class Mimes
|
||||
'application/vnd.ms-office',
|
||||
'application/msword',
|
||||
],
|
||||
'pptx' => [
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/x-zip',
|
||||
'application/zip',
|
||||
],
|
||||
'pptx' => ['application/vnd.openxmlformats-officedocument.presentationml.presentation'],
|
||||
'wbxml' => 'application/wbxml',
|
||||
'wmlc' => 'application/wmlc',
|
||||
'dcr' => 'application/x-director',
|
||||
@ -316,26 +312,19 @@ class Mimes
|
||||
|
||||
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
|
||||
|
||||
if ($proposedExtension !== '') {
|
||||
if (array_key_exists($proposedExtension, static::$mimes) && in_array(
|
||||
$type,
|
||||
is_string(static::$mimes[$proposedExtension]) ? [
|
||||
static::$mimes[$proposedExtension],
|
||||
] : static::$mimes[$proposedExtension],
|
||||
true
|
||||
)) {
|
||||
// The detected mime type matches with the proposed extension.
|
||||
return $proposedExtension;
|
||||
}
|
||||
|
||||
// An extension was proposed, but the media type does not match the mime type list.
|
||||
return null;
|
||||
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 ((is_string($types) && $types === $type) || (is_array($types) && in_array($type, $types, true))) {
|
||||
if (in_array($type, (array) $types, true)) {
|
||||
return $ext;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"require": {
|
||||
"php": "^8.0",
|
||||
"codeigniter4/framework": "^4.2.0",
|
||||
"codeigniter4/framework": "^4.2.1",
|
||||
"james-heinrich/getid3": "^2.0.x-dev",
|
||||
"whichbrowser/parser": "^v2.1.1",
|
||||
"geoip2/geoip2": "^v2.12.2",
|
||||
|
14720
composer.lock
generated
14720
composer.lock
generated
File diff suppressed because it is too large
Load Diff
112
preload.php
Normal file
112
preload.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* Sample file for Preloading
|
||||
*---------------------------------------------------------------
|
||||
* See https://www.php.net/manual/en/opcache.preloading.php
|
||||
*
|
||||
* How to Use:
|
||||
* 1. Set Preload::$paths.
|
||||
* 2. Set opcache.preload in php.ini.
|
||||
* php.ini:
|
||||
* opcache.preload=/path/to/preload.php
|
||||
*/
|
||||
|
||||
// Load the paths config file
|
||||
require __DIR__ . '/app/Config/Paths.php';
|
||||
|
||||
// Path to the front controller
|
||||
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
|
||||
|
||||
/**
|
||||
* See https://www.php.net/manual/en/function.str-contains.php#126277
|
||||
*/
|
||||
if (! function_exists('str_contains')) {
|
||||
/**
|
||||
* Polyfill of str_contains()
|
||||
*/
|
||||
function str_contains(string $haystack, string $needle): bool
|
||||
{
|
||||
return empty($needle) || strpos($haystack, $needle) !== false;
|
||||
}
|
||||
}
|
||||
|
||||
class preload
|
||||
{
|
||||
/**
|
||||
* @var array<array<string, mixed>> Paths to preload.
|
||||
*/
|
||||
private array $paths = [
|
||||
[
|
||||
'include' => __DIR__ . '/vendor/codeigniter4/framework/system',
|
||||
'exclude' => [
|
||||
// Not needed if you don't use them.
|
||||
'/system/Database/OCI8/',
|
||||
'/system/Database/Postgre/',
|
||||
'/system/Database/SQLSRV/',
|
||||
// Not needed.
|
||||
'/system/Database/Seeder.php',
|
||||
'/system/Test/',
|
||||
'/system/Language/',
|
||||
'/system/CLI/',
|
||||
'/system/Commands/',
|
||||
'/system/Publisher/',
|
||||
'/system/ComposerScripts.php',
|
||||
'/Views/',
|
||||
// Errors occur.
|
||||
'/system/Config/Routes.php',
|
||||
'/system/ThirdParty/',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->loadAutoloader();
|
||||
}
|
||||
|
||||
private function loadAutoloader(): void
|
||||
{
|
||||
$paths = new Config\Paths();
|
||||
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load PHP files.
|
||||
*/
|
||||
public function load(): void
|
||||
{
|
||||
foreach ($this->paths as $path) {
|
||||
$directory = new RecursiveDirectoryIterator($path['include']);
|
||||
$fullTree = new RecursiveIteratorIterator($directory);
|
||||
$phpFiles = new RegexIterator(
|
||||
$fullTree,
|
||||
'/.+((?<!Test)+\.php$)/i',
|
||||
RecursiveRegexIterator::GET_MATCH
|
||||
);
|
||||
|
||||
foreach ($phpFiles as $key => $file) {
|
||||
foreach ($path['exclude'] as $exclude) {
|
||||
if (str_contains($file[0], $exclude)) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
require_once $file[0];
|
||||
echo 'Loaded: ' . $file[0] . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(new preload())->load();
|
Loading…
x
Reference in New Issue
Block a user