Commit 14d7d078 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix: replace deletedField with published_at for episodes

- remove delete_at field + soft delete for media and pages
- update CodeIgniter4 to 4.2.0 + update all starter files
- explicitly use builder() when creating queries from model 
parent dbb4030d
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ class App extends BaseConfig
     * (empty string) means default SameSite attribute set by browsers (`Lax`)
     * will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
     *
     * @deprecated use Config\Cookie::$samesite property instead.
     * @deprecated `Config\Cookie` $samesite property is used.
     */
    public string $cookieSameSite = 'Lax';

+18 −3
Original line number Diff line number Diff line
@@ -52,9 +52,9 @@ defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2592000);
defined('YEAR') || define('YEAR', 31536000);
defined('DECADE') || define('DECADE', 315360000);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);

/*
 | --------------------------------------------------------------------------
@@ -91,3 +91,18 @@ defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user inpu
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

/**
 * @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);
+15 −0
Original line number Diff line number Diff line
@@ -145,4 +145,19 @@ class ContentSecurityPolicy extends BaseConfig
     * @var string|string[]|null
     */
    public string | array | null $sandbox = null;

    /**
     * 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;
}
+3 −1
Original line number Diff line number Diff line
@@ -61,8 +61,9 @@ class Database extends Config
        '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' => ENVIRONMENT !== 'production',
        'DBDebug' => (ENVIRONMENT !== 'production'),
        'charset' => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre' => '',
@@ -71,6 +72,7 @@ class Database extends Config
        'strictOn' => false,
        'failover' => [],
        'port' => 3306,
        'foreignKeys' => true,
    ];

    //--------------------------------------------------------------------
+4 −6
Original line number Diff line number Diff line
@@ -39,9 +39,7 @@ Events::on('pre_system', function () {
            ob_end_flush();
        }

        ob_start(function ($buffer) {
            return $buffer;
        });
        ob_start(static fn ($buffer) => $buffer);
    }

    /*
@@ -132,11 +130,11 @@ Events::on('on_post_add', function ($post): void {

    if ($post->episode_id !== null) {
        if ($isReply) {
            model(EpisodeModel::class, false)
            model(EpisodeModel::class, false)->builder()
                ->where('id', $post->episode_id)
                ->increment('comments_count');
        } else {
            model(EpisodeModel::class, false)
            model(EpisodeModel::class, false)->builder()
                ->where('id', $post->episode_id)
                ->increment('posts_count');
        }
@@ -161,7 +159,7 @@ Events::on('on_post_remove', function ($post): void {
    }

    if ($episodeId = $post->episode_id) {
        model(EpisodeModel::class, false)
        model(EpisodeModel::class, false)->builder()
            ->where('id', $episodeId)
            ->decrement('posts_count');
    }
Loading