Fixed many feature failures around preferences, route coverage, administrator enrollment, assignment section names, attendance tracking controller access, finance PDF generation, and finance notification logging.
API CI/CD / Validate (composer + pint) (push) Successful in 3m15s
API CI/CD / Test (PHPUnit) (push) Failing after 5m4s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m15s
API CI/CD / Test (PHPUnit) (push) Failing after 5m4s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -38,6 +38,7 @@ use App\Services\Staff\StaffTimeOffLinkService;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -78,6 +79,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerSqliteRegexpFunction();
|
||||
|
||||
Gate::policy(NavItem::class, NavItemPolicy::class);
|
||||
Gate::policy(ClassSection::class, ClassSectionPolicy::class);
|
||||
Gate::policy(IpAttempt::class, IpAttemptPolicy::class);
|
||||
@@ -113,4 +116,29 @@ class AppServiceProvider extends ServiceProvider
|
||||
$request->setContainer($app)->setRedirector($app->make(Redirector::class));
|
||||
});
|
||||
}
|
||||
|
||||
private function registerSqliteRegexpFunction(): void
|
||||
{
|
||||
try {
|
||||
$connection = DB::connection();
|
||||
if ($connection->getDriverName() !== 'sqlite') {
|
||||
return;
|
||||
}
|
||||
|
||||
$pdo = $connection->getPdo();
|
||||
if (! method_exists($pdo, 'sqliteCreateFunction')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pdo->sqliteCreateFunction('REGEXP', static function ($pattern, $value): int {
|
||||
if ($pattern === null || $value === null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return preg_match('/'.str_replace('/', '\\/', (string) $pattern).'/', (string) $value) === 1 ? 1 : 0;
|
||||
}, 2);
|
||||
} catch (\Throwable) {
|
||||
// Some unit tests boot without a configured database; SQLite compatibility is best-effort there.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user