From: Vincent Vanwaelscappel Date: Wed, 18 Mar 2026 18:25:36 +0000 (+0100) Subject: wait #8068 @5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f72bdf7c0dea9f94b3e358289ae75929e9f3aea6;p=fluidbook-toolbox.git wait #8068 @5 --- diff --git a/.env.prod b/.env.prod index 3153956aa..3772aa896 100644 --- a/.env.prod +++ b/.env.prod @@ -4,7 +4,7 @@ APP_KEY=base64:DRIdIwSEuQNkxuUTfyyRyssizosh3D9QHWTnobrW44U= APP_DEBUG=true DEBUGBAR_ENABLED=false -DEBUGBAR_OPEN_STORAGE=false +DEBUGBAR_OPEN_STORAGE=true APP_URL=https://toolbox.fluidbook.com HEADER_COLOR="#263340" diff --git a/app/Models/LinkShortener.php b/app/Models/LinkShortener.php index 92829c8b4..7790ffcda 100644 --- a/app/Models/LinkShortener.php +++ b/app/Models/LinkShortener.php @@ -78,7 +78,7 @@ class LinkShortener extends ToolboxModel start_measure('shorten url ' . $url); $res = self::_request('shorturl', ['url' => $url], $shortener, $code); if ($code === 200) { - + ShortLink::touchChangeFile(); } if (isset($res->shorturl) && $res->shorturl) { return $res->shorturl; @@ -90,9 +90,10 @@ class LinkShortener extends ToolboxModel public static function updateURL($shorturl, $newurl, $shortener) { - $res = self::_request('update', ['shorturl' => $shorturl, 'url' => $newurl, 'title' => 'auto'], $shortener, $code); - if ($code === 200) { - ShortLink::touchChangeFile(); + self::_request('update', ['shorturl' => $shorturl, 'url' => $newurl, 'title' => 'auto'], $shortener, $code); + $cacheKey = 'shorturl_' . $shortener . '_' . $newurl; + if ($code == 200) { + cache()->set($cacheKey, $newurl, 3600); } } diff --git a/app/Models/ShortLink.php b/app/Models/ShortLink.php index 2398eff27..19758d861 100644 --- a/app/Models/ShortLink.php +++ b/app/Models/ShortLink.php @@ -46,7 +46,7 @@ class ShortLink extends ToolboxModel $this->addField('server', SelectFromArray::class, __('Serveur'), ['type' => 'hidden', 'options' => LinkShortener::getAvaiableShorteners()]); $this->addField('url', URL::class, __('URL'), ['column' => true]); - $this->addField('shortlink', URL::class, __('URL courte'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url', 'database_unique' => true]); + $this->addField('shortlink', URL::class, __('URL courte'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url', 'database_unique' => true, 'searchLogic' => 'text']); $this->addField('http_code', Integer::class, __('Code HTTP'), ['type' => 'hidden_visible', 'column' => true, 'column_label' => '', 'column_type' => 'http_code', 'column_view_namespace' => 'columns']); $this->addField('code_date', \Cubist\Backpack\Magic\Fields\Datetime::class, __('Code observé le'), ['type' => 'hidden_visible', 'column' => true]); $this->addField('target_code', Integer::class, __('Code final'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'http_code', 'column_view_namespace' => 'columns', 'column_label' => '']); @@ -141,14 +141,13 @@ class ShortLink extends ToolboxModel if ($currentLink['type'] == Link::WEBVIDEO && $currentLink['video_service'] == 'youtube') { $links[$uid]['to'] = WebVideo::_findVideoId($this->url, 'youtube'); } else { - $links[$uid]['to'] = $this->uid; + $links[$uid]['to'] = $this->url; } } LinksData::saveLinksInFile($id, backpack_user()->id, __('Lien court :shortlink édité', ['shortlink' => $this->shortlink]), $links, $rulers, [], [], false); } } - AuditLinkRegister::dispatchSync(); - static::touchChangeFile(); + AuditLinkRegister::dispatch(); } return parent::onSaved(); }