Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
DB_DATABASE: db_test
DB_DATABASE: testbench
DB_USERNAME: root
DB_PASSWORD: root
steps:
Expand Down
2 changes: 1 addition & 1 deletion config/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
|
*/

'urlPolicy' => env('IGNITER_URL_POLICY', 'detect'),
'urlPolicy' => env('IGNITER_URL_POLICY', 'force'),

/*
|--------------------------------------------------------------------------
Expand Down
24 changes: 24 additions & 0 deletions database/migrations/admin/2025_11_15_165912_add_indexes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('status_history', function(Blueprint $table) {
$table->index(['object_type', 'object_id', 'created_at'], 'idx_status_history_object_created');
$table->index(['object_type', 'object_id', 'status_history_id'], 'idx_status_history_object_status');
});
}

public function down(): void
{
Schema::table('status_history', function(Blueprint $table) {
$table->dropIndex('idx_status_history_object_created');
$table->dropIndex('idx_status_history_object_status');
});
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
Expand Down
46 changes: 46 additions & 0 deletions database/migrations/system/2025_11_15_165912_add_indexes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('media_attachments', function(Blueprint $table) {
$table->index(['attachment_type', 'attachment_id', 'priority'], 'idx_media_attachments_type_id_priority');
});

Schema::table('languages', function(Blueprint $table) {
$table->index(['status', 'is_default'], 'idx_languages_status_default');
});

Schema::table('countries', function(Blueprint $table) {
$table->index(['status', 'is_default'], 'idx_countries_status_default');
});

Schema::table('currencies', function(Blueprint $table) {
$table->index(['currency_status', 'is_default'], 'idx_currencies_status_default');
});
}

public function down(): void
{
Schema::table('media_attachments', function(Blueprint $table) {
$table->dropIndex('idx_media_attachments_type_id_priority');
});

Schema::table('languages', function(Blueprint $table) {
$table->dropIndex('idx_languages_status_default');
});

Schema::table('countries', function(Blueprint $table) {
$table->dropIndex('idx_countries_status_default');
});

Schema::table('currencies', function(Blueprint $table) {
$table->dropIndex('idx_currencies_status_default');
});
}
};
3 changes: 1 addition & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
<env name="APP_DEBUG" value="true"/>
<env name="APP_KEY" value="base64:cuULT9tUWlbKtqv1Mk3jBw832yDSMEv0BvXx6hZOFQQ="/>
<env name="DB_CONNECTION" value="mysql"/>
<!-- <env name="DB_HOST" value="db"/>-->
<env name="DB_DATABASE" value="db_test"/>
<env name="DB_DATABASE" value="testbench"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_PASSWORD" value="root"/>
</php>
Expand Down
2 changes: 0 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
use Rector\CodingStyle\Rector\FunctionLike\FunctionLikeToFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
Expand Down Expand Up @@ -45,7 +44,6 @@
__DIR__.'/src/Flame/Database/Concerns/HasRelationships.php',
],
FunctionFirstClassCallableRector::class,
FunctionLikeToFirstClassCallableRector::class,
SimplifyEmptyCheckOnEmptyArrayRector::class,
StrictStringParamConcatRector::class => [
__DIR__.'/src/Flame/Database/Concerns/HasRelationships.php',
Expand Down
2 changes: 1 addition & 1 deletion resources/models/main/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
],
'reset' => [
'label' => 'lang:igniter::system.themes.button_reset_to_default',
'class' => 'btn btn-secondary',
'class' => 'btn btn-default',
'context' => 'edit',
'data-request' => 'onReset',
'data-request-confirm' => 'lang:igniter::admin.alert_warning_confirm',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@if ($paginator->hasPages())
<ul class="pagination">
<ul class="pagination d-flex justify-content-between">
@if ($paginator->onFirstPage())
<li class="disabled"><span>@lang('pagination.previous')</span></li>
@else
Expand Down
7 changes: 5 additions & 2 deletions src/Admin/Widgets/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,23 @@ protected function prepareModel(): Builder
$primarySearchable = [];
$relationSearchable = [];

// Get the grammar from the model's connection to ensure it's properly initialized
$schemaGrammar = $query->getQuery()->getGrammar();

if (!empty($this->searchTerm) && ($searchableColumns = $this->getSearchableColumns())) {
foreach ($searchableColumns as $column) {
// Relation
if ($this->isColumnRelated($column)) {
$table = DB::getTablePrefix().$this->model->{$column->relation}()->getModel()->getTable();
$columnName = isset($column->sqlSelect)
? DB::raw($this->parseTableName($column->sqlSelect, $table))->getValue(DB::connection()->getSchemaGrammar())
? DB::raw($this->parseTableName($column->sqlSelect, $table))->getValue($schemaGrammar)
: $table.'.'.$column->valueFrom;

$relationSearchable[$column->relation][] = $columnName;
} // Primary
else {
$columnName = isset($column->sqlSelect)
? DB::raw($this->parseTableName($column->sqlSelect, $primaryTable))->getValue(DB::connection()->getSchemaGrammar())
? DB::raw($this->parseTableName($column->sqlSelect, $primaryTable))->getValue($schemaGrammar)
: DB::getTablePrefix().$primaryTable.'.'.$column->columnName;

$primarySearchable[] = $columnName;
Expand Down
19 changes: 17 additions & 2 deletions src/Flame/Composer/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class Manager
{
protected const string REPOSITORY_HOST = 'satis.tastyigniter.com';
protected const string REPOSITORY_HOST = 'composer.tastyigniter.com';

/** The primary composer instance. */
protected ?ClassLoader $loader = null;
Expand Down Expand Up @@ -86,9 +86,10 @@ protected function loadInstalledPackages(bool $fresh = false): Collection
->mapWithKeys(function(array $package): array {
if ($package['name'] === PackageInfo::CORE) {
$package['code'] = PackageInfo::CORE_CODE;
$package['type'] = PackageInfo::CORE_TYPE;
}

$package['type'] = $this->getPackageType($package);

return [$this->getPackageCode($package) => $package];
});
}
Expand Down Expand Up @@ -128,6 +129,20 @@ protected function getPackageCode(array $package): mixed
array_get($package, 'extra.tastyigniter-theme.code')));
}

protected function getPackageType(array $package): ?string
{
if (array_get($package, 'name') === PackageInfo::CORE) {
return PackageInfo::CORE_TYPE;
}

$packageType = 'extension';
if (array_get($package, 'extra.tastyigniter-theme')) {
$packageType = 'theme';
}

return $packageType;
}

//
//
//
Expand Down
1 change: 0 additions & 1 deletion src/Flame/Database/Relations/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class BelongsToMany extends BelongsToManyBase
* @param string $foreignPivotKey
* @param string $relatedPivotKey
* @param string $relationName
* @return void
*/
public function __construct(
Builder $query,
Expand Down
1 change: 0 additions & 1 deletion src/Flame/Database/Relations/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class HasMany extends HasManyBase

/**
* Create a new has many relationship instance.
* @return void
*/
public function __construct(Builder $query, Model $parent, $foreignKey, $localKey, $relationName = null)
{
Expand Down
1 change: 0 additions & 1 deletion src/Flame/Database/Relations/HasManyThrough.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class HasManyThrough extends HasManyThroughBase
/**
* Create a new has many relationship instance.
* @param string $relationName
* @return void
*/
public function __construct(
Builder $query,
Expand Down
1 change: 0 additions & 1 deletion src/Flame/Database/Relations/HasOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class HasOne extends HasOneBase

/**
* Create a new has many relationship instance.
* @return void
*/
public function __construct(Builder $query, Model $parent, $foreignKey, $localKey, $relationName = null)
{
Expand Down
1 change: 0 additions & 1 deletion src/Flame/Database/Relations/HasOneThrough.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class HasOneThrough extends HasOneThroughBase
/**
* Create a new has many relationship instance.
* @param string $relationName
* @return void
*/
public function __construct(
Builder $query,
Expand Down
1 change: 0 additions & 1 deletion src/Flame/Database/Relations/MorphMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class MorphMany extends MorphManyBase

/**
* Create a new has many relationship instance.
* @return void
*/
public function __construct(Builder $query, Model $parent, $type, $id, $localKey, $relationName = null)
{
Expand Down
1 change: 0 additions & 1 deletion src/Flame/Database/Relations/MorphOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class MorphOne extends MorphOneBase

/**
* Create a new has many relationship instance.
* @return void
*/
public function __construct(Builder $query, Model $parent, $type, $id, $localKey, $relationName = null)
{
Expand Down
1 change: 0 additions & 1 deletion src/Flame/Database/Relations/MorphToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class MorphToMany extends BelongsToMany
* @param string $otherKey
* @param string $relationName
* @param bool $inverse
* @return void
*/
public function __construct(
Builder $query,
Expand Down
3 changes: 2 additions & 1 deletion src/Flame/Database/Traits/HasQueryModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public function scopeApplyFilters(Builder $builder, array $options = []): Builde
collect($this->queryModifierFilters)
->each(function($value, $key) use ($builder, $options) {
$params = (array)$value;
if ($filterValue = array_get($options, $key, array_get($params, 'default'))) {
if (array_key_exists($key, $options)) {
$filterValue = array_get($options, $key, array_get($params, 'default'));
(new FiltersScope)($builder, $filterValue, $params[0]);
}
});
Expand Down
21 changes: 1 addition & 20 deletions src/Flame/Exception/ApplicationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace Igniter\Flame\Exception;

use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class ApplicationException extends Exception
{
Expand All @@ -15,25 +13,8 @@ class ApplicationException extends Exception
* @param int $code Error code.
* @param Exception|null $previous Previous exception.
*/
public function __construct($message = '', $code = 500, ?Exception $previous = null)
public function __construct(string $message = '', int $code = 500, ?Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}

public function render(Request $request): Response
{
$message = $this->getMessage();

if (config('app.debug', false)) {
$message = sprintf('"%s" on line %s of %s',
$this->getMessage(),
$this->getLine(),
$this->getFile()
);

$message .= $this->getTraceAsString();
}

return response($message, $this->code);
}
}
2 changes: 1 addition & 1 deletion src/Flame/Support/Helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ function name_to_array(string $string): array
array_unshift($result, $matches[1]);
}

return array_filter($result, fn($val): bool => (bool)strlen($val));
return array_filter($result, fn($val): bool => (bool)strlen((string) $val));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Flame/Support/Igniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class Igniter
{
protected const string VERSION = 'v4.0.15';
protected const string VERSION = 'minor (v4.2.0)';

/**
* The base path for extensions.
Expand Down
2 changes: 1 addition & 1 deletion src/Flame/Translation/Models/Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static function getFresh($locale, $group, $namespace = null)
->get();
}

public static function getCached($locale, $group, $namespace = null)
public static function getCached(string $locale, $group, $namespace = null)
{
$cacheKey = static::getCacheKey($locale, $group, $namespace);

Expand Down
2 changes: 1 addition & 1 deletion src/Main/Classes/MediaLibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function rename(string $path, string $newPath): bool

public function deleteFiles(string|array $paths): bool
{
return $this->getStorageDisk()->delete(array_map(fn(string $path): string => $this->getMediaPath($path), (array)$paths));
return $this->getStorageDisk()->delete(array_map($this->getMediaPath(...), (array)$paths));
}

public function deleteFolder(string $path): bool
Expand Down
2 changes: 1 addition & 1 deletion src/System/Classes/PackageInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PackageInfo

public const string CORE_CODE = 'tastyigniter';

public const string CORE_TYPE = 'tastyigniter-core';
public const string CORE_TYPE = 'core';

public const array CORE_MANIFEST = [
'code' => self::CORE_CODE,
Expand Down
4 changes: 2 additions & 2 deletions src/System/Console/Commands/ExtensionInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public function handle(): void
$extensionName = $this->argument('name');
$updateManager = resolve(UpdateManager::class)->setLogsOutput($this->output);

$itemDetail = $updateManager->requestItemDetail([
$itemDetail = rescue(fn() => $updateManager->requestItemDetail([
'name' => $extensionName,
'type' => 'extension',
]);
]), fn() => null, false) ?? [];

if (!$itemDetail || !array_has($itemDetail, 'package') || array_get($itemDetail, 'code') !== $extensionName) {
$this->output->writeln(sprintf('<info>Extension %s not found</info>', $extensionName));
Expand Down
2 changes: 1 addition & 1 deletion src/System/Models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static function onboardingMailIsComplete(): bool

public function getValueAttribute()
{
return ($value = @unserialize($this->attributes['value'] ?? ''))
return ($value = @unserialize($this->attributes['value'] ?? '')) !== false
? $value
: $this->attributes['value'];
}
Expand Down
2 changes: 2 additions & 0 deletions src/System/Traits/ManagesUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public function onApplyUpdate(): array

[$response, $success] = $this->processInstallOrUpdate($itemsToUpdate->all(), isUpdate: true);

$updateManager->requestUpdateList(true);

return [
'message' => implode('<br>', $response),
'success' => $success,
Expand Down
Loading