fix wrong exception being catched
This commit is contained in:
parent
2847589199
commit
91c6bb6aa9
2 changed files with 5 additions and 6 deletions
|
@ -35,7 +35,7 @@ class RebuildForumCacheCommand extends Command
|
|||
$posts = DB::table('posts')->get(['post_id']);
|
||||
|
||||
foreach ($posts as $post) {
|
||||
(new Post($post->post_id))->update(true);
|
||||
(new Post($post->post_id))->update();
|
||||
}
|
||||
|
||||
$this->getLogger()->writeln("Done!");
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Sakura\Forum;
|
|||
|
||||
use Sakura\BBCode\Parser as BBParser;
|
||||
use Sakura\DB;
|
||||
use Sakura\Exception;
|
||||
use Sakura\Exceptions\NetAddressTypeException;
|
||||
use Sakura\Net;
|
||||
use Sakura\User;
|
||||
|
||||
|
@ -126,7 +126,7 @@ class Post
|
|||
// Temporary backwards compatible IP storage system
|
||||
try {
|
||||
$this->ip = Net::ntop($postRow->poster_ip);
|
||||
} catch (Exception $e) {
|
||||
} catch (NetAddressTypeException $e) {
|
||||
$this->ip = $postRow->poster_ip;
|
||||
$this->update();
|
||||
}
|
||||
|
@ -183,10 +183,9 @@ class Post
|
|||
|
||||
/**
|
||||
* Commit the changes to the Database.
|
||||
* @param bool $ignoreIp
|
||||
* @return Post
|
||||
*/
|
||||
public function update(bool $ignoreIp = false): Post
|
||||
public function update(): Post
|
||||
{
|
||||
// Create a topic object
|
||||
$topic = new Topic($this->topic);
|
||||
|
@ -198,7 +197,7 @@ class Post
|
|||
'topic_id' => $topic->id,
|
||||
'forum_id' => $topic->forum,
|
||||
'poster_id' => $this->poster->id,
|
||||
'poster_ip' => Net::pton($ignoreIp ? $this->ip : Net::ip()),
|
||||
'poster_ip' => Net::pton($this->ip),
|
||||
'post_time' => $this->time,
|
||||
'post_subject' => $this->subject,
|
||||
'post_text' => $this->text,
|
||||
|
|
Reference in a new issue