This repository was archived by the owner on Mar 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 2020
2121namespace WildPHP \Modules \LinkSniffer ;
2222
23- use GuzzleHttp \Exception \ClientException ;
23+ use GuzzleHttp \Exception \GuzzleException ;
2424use WildPHP \API \ShortenUri ;
2525use WildPHP \BaseModule ;
2626use WildPHP \CoreModules \Connection \IrcDataObject ;
@@ -64,10 +64,8 @@ public function sniffLinks(IrcDataObject $message)
6464 {
6565 try
6666 {
67- $ content_type = SnifferHelper::getContentTypeFromUri ($ uri );
68-
6967 $ shortUri = $ this ->createShortUri ($ uri );
70-
68+ $ content_type = SnifferHelper:: getContentTypeFromUri ( $ uri );
7169 $ title = '(not a web page, content type: ' . $ content_type . ') ' ;
7270
7371 if ($ content_type == 'text/html ' )
@@ -84,10 +82,10 @@ public function sniffLinks(IrcDataObject $message)
8482 return ;
8583 }
8684
87- // ClientExceptions can be thrown by Guzzle. If one occurs, just give up .
88- catch (ClientException $ e )
85+ // Guzzle exceptions (such as connection timeouts) should be ignored .
86+ catch (GuzzleException $ e )
8987 {
90- return ;
88+ $ title = ' (link was unresponsive: ' . $ uri . ' ) ' ;
9189 }
9290
9391 if (!empty ($ title ) && !empty ($ shortUri ))
Original file line number Diff line number Diff line change @@ -31,13 +31,13 @@ public function testAddEntry()
3131 $ uriCache = new UriCache ();
3232
3333 $ uriCache ->addCacheItem ('googleUri ' , 'Google ' );
34+
3435 $ checkObject = new CacheItem ();
3536 $ checkObject ->setTitle ('Google ' );
36- $ checkObject ->setExpireTime (time () + 60 * 60 );
3737
3838 $ retrieved = $ uriCache ->getCacheItem ('googleUri ' );
3939
40- $ this ->assertEquals ($ checkObject , $ retrieved );
40+ $ this ->assertSame ($ checkObject , $ retrieved );
4141 }
4242
4343 public function testRemoveItem ()
You can’t perform that action at this time.
0 commit comments