Merge branch 'hotfix/0.0.11.5'

This commit is contained in:
Jonny Barnes 2016-09-20 13:14:59 +01:00
commit 5e9d2aae6e
9 changed files with 21 additions and 39 deletions

View file

@ -42,7 +42,7 @@ class ReDownloadWebMentions extends Command
$webmentions = WebMention::all(); $webmentions = WebMention::all();
foreach ($webmentions as $webmention) { foreach ($webmentions as $webmention) {
$this->info('Initiation re-download of ' . $webmention->source); $this->info('Initiation re-download of ' . $webmention->source);
$this->dispatch(new DownloadWebMention($webmention->source)); dispatch(new DownloadWebMention($webmention->source));
} }
} }
} }

View file

@ -38,7 +38,7 @@ class WebMentionsController extends Controller
$numbers = new Numbers(); $numbers = new Numbers();
try { try {
$note = Note::findOrFail($numbers->b60tonum($noteId)); $note = Note::findOrFail($numbers->b60tonum($noteId));
$this->dispatch(new ProcessWebMention($note, $request->input('source'))); dispatch(new ProcessWebMention($note, $request->input('source')));
} catch (ModelNotFoundException $e) { } catch (ModelNotFoundException $e) {
return new Response('This note doesnt exist.', 400); return new Response('This note doesnt exist.', 400);
} }

View file

@ -1,21 +0,0 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
abstract class Job
{
/*
|--------------------------------------------------------------------------
| Queueable Jobs
|--------------------------------------------------------------------------
|
| This job base class provides a central location to place any logic that
| is shared across all of your jobs. The trait included with the class
| provides access to the "onQueue" and "delay" queue helper methods.
|
*/
use Queueable;
}

View file

@ -6,17 +6,17 @@ use Mf2;
use App\Note; use App\Note;
use App\WebMention; use App\WebMention;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Jonnybarnes\WebmentionsParser\Parser; use Jonnybarnes\WebmentionsParser\Parser;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\DispatchesJobs;
use App\Exceptions\RemoteContentNotFoundException; use App\Exceptions\RemoteContentNotFoundException;
class ProcessWebMention extends Job implements ShouldQueue class ProcessWebMention implements ShouldQueue
{ {
use InteractsWithQueue, SerializesModels, DispatchesJobs; use InteractsWithQueue, Queueable, SerializesModels;
protected $note; protected $note;
protected $source; protected $source;
@ -60,7 +60,7 @@ class ProcessWebMention extends Job implements ShouldQueue
return; return;
} }
//webmenion is still a reply, so update content //webmenion is still a reply, so update content
$this->dispatch(new SaveProfileImage($microformats)); dispatch(new SaveProfileImage($microformats));
$webmention->mf2 = json_encode($microformats); $webmention->mf2 = json_encode($microformats);
$webmention->save(); $webmention->save();
@ -87,7 +87,7 @@ class ProcessWebMention extends Job implements ShouldQueue
//no wemention in db so create new one //no wemention in db so create new one
$webmention = new WebMention(); $webmention = new WebMention();
$type = $parser->getMentionType($microformats); //throw error here? $type = $parser->getMentionType($microformats); //throw error here?
$this->dispatch(new SaveProfileImage($microformats)); dispatch(new SaveProfileImage($microformats));
$webmention->source = $this->source; $webmention->source = $this->source;
$webmention->target = $this->note->longurl; $webmention->target = $this->note->longurl;
$webmention->commentable_id = $this->note->id; $webmention->commentable_id = $this->note->id;

View file

@ -2,6 +2,7 @@
namespace App\Jobs; namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
@ -9,9 +10,9 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Jonnybarnes\WebmentionsParser\Authorship; use Jonnybarnes\WebmentionsParser\Authorship;
use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException; use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException;
class SaveProfileImage extends Job implements ShouldQueue class SaveProfileImage implements ShouldQueue
{ {
use InteractsWithQueue, SerializesModels; use InteractsWithQueue, Queueable, SerializesModels;
protected $microformats; protected $microformats;

View file

@ -4,13 +4,14 @@ namespace App\Jobs;
use App\Note; use App\Note;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
class SendWebMentions extends Job implements ShouldQueue class SendWebMentions implements ShouldQueue
{ {
use InteractsWithQueue, SerializesModels; use InteractsWithQueue, Queueable, SerializesModels;
protected $note; protected $note;

View file

@ -5,15 +5,16 @@ namespace App\Jobs;
use Twitter; use Twitter;
use App\Note; use App\Note;
use App\Contact; use App\Contact;
use Illuminate\Bus\Queueable;
use Jonnybarnes\IndieWeb\Numbers; use Jonnybarnes\IndieWeb\Numbers;
use Jonnybarnes\IndieWeb\NotePrep; use Jonnybarnes\IndieWeb\NotePrep;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
class SyndicateToTwitter extends Job implements ShouldQueue class SyndicateToTwitter implements ShouldQueue
{ {
use InteractsWithQueue, SerializesModels; use InteractsWithQueue, Queueable, SerializesModels;
protected $note; protected $note;

View file

@ -7,12 +7,9 @@ use App\Place;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Jobs\SendWebMentions; use App\Jobs\SendWebMentions;
use App\Jobs\SyndicateToTwitter; use App\Jobs\SyndicateToTwitter;
use Illuminate\Foundation\Bus\DispatchesJobs;
class NoteService class NoteService
{ {
use DispatchesJobs;
/** /**
* Create a new note. * Create a new note.
* *
@ -57,7 +54,7 @@ class NoteService
} }
} }
$this->dispatch(new SendWebMentions($note)); dispatch(new SendWebMentions($note));
if (//micropub request, syndication sent as array if (//micropub request, syndication sent as array
(is_array($request->input('syndicate-to')) (is_array($request->input('syndicate-to'))
@ -68,7 +65,7 @@ class NoteService
|| //local admin cp request || //local admin cp request
($request->input('twitter') == true)) ($request->input('twitter') == true))
) { ) {
$this->dispatch(new SyndicateToTwitter($note)); dispatch(new SyndicateToTwitter($note));
} }
return $note; return $note;

View file

@ -1,5 +1,8 @@
# Changelog # Changelog
## Version 0.0.11.5 (2016-09-20)
- Fix job dispatching to more in line with Laravel 5.3 practices
## Version 0.0.11.4 (2016-09-19) ## Version 0.0.11.4 (2016-09-19)
- Better console output for the new webmention commands - Better console output for the new webmention commands