mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-19 13:01:19 +00:00
refactor(migrations): replace 191 value with more relevant one
This commit is contained in:
parent
a9989d841a
commit
057559183c
@ -23,7 +23,7 @@ if (! function_exists('get_browser_language')) {
|
||||
}
|
||||
|
||||
if (! function_exists('slugify')) {
|
||||
function slugify(string $text, int $maxLength = 191): string
|
||||
function slugify(string $text, int $maxLength = 128): string
|
||||
{
|
||||
// trim text to the nearest whole word if too long
|
||||
if (strlen($text) > $maxLength) {
|
||||
|
@ -108,7 +108,7 @@ class EpisodeModel extends Model
|
||||
protected $validationRules = [
|
||||
'podcast_id' => 'required',
|
||||
'title' => 'required',
|
||||
'slug' => 'required|regex_match[/^[a-zA-Z0-9\-]{1,191}$/]',
|
||||
'slug' => 'required|regex_match[/^[a-zA-Z0-9\-]{1,128}$/]',
|
||||
'audio_id' => 'required',
|
||||
'description_markdown' => 'required',
|
||||
'number' => 'is_natural_no_zero|permit_empty',
|
||||
|
@ -51,7 +51,7 @@ class PageModel extends Model
|
||||
protected $validationRules = [
|
||||
'title' => 'required',
|
||||
'slug' =>
|
||||
'required|regex_match[/^[a-zA-Z0-9\-]{1,191}$/]|is_unique[pages.slug,id,{id}]',
|
||||
'required|regex_match[/^[a-zA-Z0-9\-]{1,128}$/]|is_unique[pages.slug,id,{id}]',
|
||||
'content_markdown' => 'required',
|
||||
];
|
||||
|
||||
|
@ -306,7 +306,7 @@ class PodcastImportController extends BaseController
|
||||
$textToSlugify = $this->request->getPost('slug_field') === 'title'
|
||||
? (string) $item->title
|
||||
: basename((string) $item->link);
|
||||
$slug = slugify($textToSlugify, 185);
|
||||
$slug = slugify($textToSlugify, 120);
|
||||
if (in_array($slug, $slugs, true)) {
|
||||
$slugNumber = 2;
|
||||
while (in_array($slug . '-' . $slugNumber, $slugs, true)) {
|
||||
|
@ -28,7 +28,7 @@ class AddAnalyticsWebsiteByBrowser extends Migration
|
||||
],
|
||||
'browser' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 191,
|
||||
'constraint' => 128,
|
||||
],
|
||||
'hits' => [
|
||||
'type' => 'INT',
|
||||
|
@ -26,7 +26,7 @@ class AddAnalyticsUnknownUseragents extends Migration
|
||||
],
|
||||
'useragent' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 191,
|
||||
'constraint' => 255,
|
||||
'unique' => true,
|
||||
],
|
||||
'hits' => [
|
||||
|
Loading…
x
Reference in New Issue
Block a user