]> _ Git - fluidbook-toolbox.git/commitdiff
wait #8068 @5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 18 Mar 2026 18:25:36 +0000 (19:25 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 18 Mar 2026 18:25:36 +0000 (19:25 +0100)
.env.prod
app/Models/LinkShortener.php
app/Models/ShortLink.php

index 3153956aa531739cb799c712aca357f00ab36da2..3772aa8968badbd27f59f4641f0bd5dfa11aba7b 100644 (file)
--- 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"
index 92829c8b4da71208aaebdbbab83007175ae423f1..7790ffcda818679a813e417f020cfe76d322126b 100644 (file)
@@ -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);
         }
     }
 
index 2398eff27fc0748406783471efe114f2c1ad8548..19758d861e3017ae1e4fda4f0e43fed1ca37c1f0 100644 (file)
@@ -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' => '<i class="las la-chevron-circle-down" title="' . __('Résultat du test') . '"></i>', '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' => '<i class="las la-chevron-circle-right" title="' . __('Résultat du test de la page redirigée') . '"></i>']);
@@ -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();
     }