Unverified Commit 54b84f96 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

perf(cache): update CI4 to use cache's deleteMatching method

add missing locale to category_options cache name
parent 05ace8cf
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
	"jamesbirtles.svelte-vscode",
	"dbaeumer.vscode-eslint",
	"stylelint.vscode-stylelint",
    "wongjn.php-sniffer"
	"wongjn.php-sniffer",
	"eamodio.gitlens"
]
}
+5 −4
Original line number Diff line number Diff line
@@ -50,15 +50,16 @@ Before uploading Castopod files to your web server:

PHP version 7.3 or higher is required, with the following extensions installed:

- [intl](http://php.net/manual/en/intl.requirements.php)
- [libcurl](http://php.net/manual/en/curl.requirements.php)
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
- [intl](https://php.net/manual/en/intl.requirements.php)
- [libcurl](https://php.net/manual/en/curl.requirements.php)
- [mbstring](https://php.net/manual/en/mbstring.installation.php)
- [gd](https://www.php.net/manual/en/image.installation.php)

Additionally, make sure that the following extensions are enabled in your PHP:

- json (enabled by default - don't turn it off)
- xml (enabled by default - don't turn it off)
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php)
- [mysqlnd](https://php.net/manual/en/mysqlnd.install.php)

### MySQL compatible database

+4 −3
Original line number Diff line number Diff line
@@ -39,14 +39,15 @@ class PermissionModel extends \Myth\Auth\Authorization\PermissionModel
     */
    public function getPermissionsForGroup(int $groupId): array
    {
        if (!($found = cache("group{$groupId}_permissions"))) {
        $cacheName = "group{$groupId}_permissions";
        if (!($found = cache($cacheName))) {
            $groupPermissions = $this->db
                ->table('auth_groups_permissions')
                ->select('id, auth_permissions.name')
                ->join(
                    'auth_permissions',
                    'auth_permissions.id = permission_id',
                    'inner'
                    'inner',
                )
                ->where('group_id', $groupId)
                ->get()
@@ -57,7 +58,7 @@ class PermissionModel extends \Myth\Auth\Authorization\PermissionModel
                $found[$row->id] = strtolower($row->name);
            }

            cache()->save("group{$groupId}_permissions", $found, 300);
            cache()->save($cacheName, $found, 300);
        }

        return $found;
+22 −5
Original line number Diff line number Diff line
@@ -253,6 +253,8 @@ class App extends BaseConfig
     * Set a cookie name prefix if you need to avoid collisions.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$prefix property instead.
     */
    public $cookiePrefix = '';

@@ -264,6 +266,8 @@ class App extends BaseConfig
     * Set to `.your-domain.com` for site-wide cookies.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$domain property instead.
     */
    public $cookieDomain = '';

@@ -275,6 +279,8 @@ class App extends BaseConfig
     * Typically will be a forward slash.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$path property instead.
     */
    public $cookiePath = '/';

@@ -286,19 +292,23 @@ class App extends BaseConfig
     * Cookie will only be set if a secure HTTPS connection exists.
     *
     * @var boolean
     *
     * @deprecated use Config\Cookie::$secure property instead.
     */
    public $cookieSecure = false;

    /**
     * --------------------------------------------------------------------------
     * Cookie HTTP Only
     * Cookie HttpOnly
     * --------------------------------------------------------------------------
     *
     * Cookie will only be accessible via HTTP(S) (no JavaScript).
     *
     * @var boolean
     *
     * @deprecated use Config\Cookie::$httponly property instead.
     */
    public $cookieHTTPOnly = false;
    public $cookieHTTPOnly = true;

    /**
     * --------------------------------------------------------------------------
@@ -311,11 +321,18 @@ class App extends BaseConfig
     * - 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 no SameSite attribute will be set on cookies. If
     * set to `None`, `$cookieSecure` must also be set.
     * (empty string) means default SameSite attribute set by browsers (`Lax`)
     * will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
     *
     * @var string
     *
     * @var string 'Lax'|'None'|'Strict'
     * @deprecated use Config\Cookie::$samesite property instead.
     */
    public $cookieSameSite = 'Lax';

app/Config/Cookie.php

0 → 100644
+119 −0
Original line number Diff line number Diff line
<?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.
     *
     * @var string
     */
    public $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|integer|string
     */
    public $expires = 0;

    /**
     * --------------------------------------------------------------------------
     * Cookie Path
     * --------------------------------------------------------------------------
     *
     * Typically will be a forward slash.
     *
     * @var string
     */
    public $path = '/';

    /**
     * --------------------------------------------------------------------------
     * Cookie Domain
     * --------------------------------------------------------------------------
     *
     * Set to `.your-domain.com` for site-wide cookies.
     *
     * @var string
     */
    public $domain = '';

    /**
     * --------------------------------------------------------------------------
     * Cookie Secure
     * --------------------------------------------------------------------------
     *
     * Cookie will only be set if a secure HTTPS connection exists.
     *
     * @var boolean
     */
    public $secure = false;

    /**
     * --------------------------------------------------------------------------
     * Cookie HTTPOnly
     * --------------------------------------------------------------------------
     *
     * Cookie will only be accessible via HTTP(S) (no JavaScript).
     *
     * @var boolean
     */
    public $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.
     *
     * @var string
     */
    public $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.
     *
     * @var boolean
     *
     * @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 $raw = false;
}
Loading