The issues, commiter etc. for this module look odd (mysteriously old)... am hoping that someone will pick this up. Happy to help if I can, but would be good to know I am not posting in a vacuum ;)

Installed using latest version of Drupal 8.0-dev installed apparently without error but no blog content type, view user profile resulted in a page title Error.

Had error entries in log as follows:
Recoverable fatal error: Object of class Drupal\Core\Entity\Field\Field could not be converted to string in blog_user_view() (line 30 of /srv/drupal8/modules/blog/blog.module).

Edit: url blog/
results in the error:
Fatal error: Class 'PagerDefault' not found in /srv/drupal8/core/lib/Drupal/Core/Database/Query/Select.php on line 300

Comments

deekayen’s picture

This isn't a complete vacuum.

deekayen’s picture

Issue summary: View changes

Adding another error..

chris_hall_hu_cheng’s picture

Assigned: Unassigned » chris_hall_hu_cheng

Excellent, then for want of knowing any better I have assigned to me and will attempt to work out what is required to make it work again, I suspect that the module has falling foul of one to many commits that have changed things in core and is failing on multiple issues (hence the nature general nature of my posting).

Looking at the code it is going to die anyway at some point, using drupal_set_breadcrumb(), page callbacks in menu hooks etc. all of which I believe are slated to die.

Maybe the weekend before I get to do anything constructive, but hopefully I can fix this as part of my Drupal 8 journey.....

chris_hall_hu_cheng’s picture

Wow!! This is going to be a mahoosive patch if I get it all working again...

For the record the first major problem is that hook_node_info() no longer exists, see here https://drupal.org/node/2029519

I added a comment or two to the hook_node_info() page for other poor lost little souls....

So no prospects of creating the blog content type without fixing that first.

chris_hall_hu_cheng’s picture

Have content type working the new way now, moving on to routing.

Apologies for the running commentary, I want to keep track of how many and what elements I need to change. My end goal is just to get the basic blog functionality working again in the current drupal 8 codebase.

Scratch the routing, it is wrong but still works, focusing on just getting working again $account->uid in the hook_user_view() implementation is a no-no have to use $account->id().

Run out of break times at work today continuing when I next have some free time.

chris_hall_hu_cheng’s picture

Just need to address the listings now I think, I had a quick bash at fixing the db_selects, the new way appears to be to use view (they are in core now after all). Apologies of the rambling in this issue but it keeps me motivated to carry on every time a get a few spare moments, and a bit tricky to stay focused when the basic issue is that a bunch of things have change in core to make it not work...

chris_hall_hu_cheng’s picture

Status: Active » Needs review
FileSize
6.1 KB
None View

Patch attached (not as big as I feared it would be as I confined to just making it work again).

The views thing seemed a bit over the top for stage one so I just fixed the db_selects instead.
This seems to work on the code I just checked out from Drupal 8.x

Please bear in mind when reviewing this that this should fix multiple failures and make the module work again in Drupal 8 (try installing the unpatched version and see what I mean). There are a number of things to do to make it not break again before Drupal 8 is finally released (update the routing, stop using drupal_set_breadcrumb()...) and a lot more to do to make it a useful blogging addition.

Although not important in the big scale of things I am setting up a site about Drupal 8 to run on Drupal 8 (can't think of any better way to learn about D8), wanted a multi-user blog ended up here and discovered it was useless in it's current state (I am sure others will do the same so worthwhile fixing it). Basically trying to update documentation add patches etc. for the problems I run across as I can).

Any chance of becoming a maintainer on this module? I intend to update to work fully with Drupal 8.x when released and add more Blog functionality (it has always been a bit of an after-thought). Based on my limited experiences so far that may be somewhat painful on an issue by issue basis and in that case I am probably better of just spinning off another module and Github and working with that.

Thank you for your time.

deekayen’s picture

Would you explain the removal of the default_node_main limiter? I'm picturing 1000 nodes trying to show on a page without any limit in place.

chris_hall_hu_cheng’s picture

Absolutely agree with you there, I think it happened when I was testing things around the removal of the pager, and forgot to put it back, my bad. Cheers for looking at this.

I will put that back in and attach another patch when I get home this evening.

The problem is I was seeing getting the db_select working again as a temporary solution, I would either use an EntityFieldQuery (which I haven't fully grokked yet in D8 and not sure about how that works with the node_field_data table). If this was still in Core though I understand it should be using views?? so I would be fixing the routing and replacing the listings as views, configured in D8 style. Then prioritizing anything else that is fated to break with upcoming api changes and deprecated functions.

I have spotted a formatting error just now and a 'stick' field that should be sticky for ordering, Will re-submit in a few hours, to much haste on my part.

chris_hall_hu_cheng’s picture

Status: Needs review » Needs work
chris_hall_hu_cheng’s picture

Status: Needs work » Needs review
FileSize
7.01 KB
None View

Ok now I remember why, limit (throws errors) and has gone .... I can't find EntityFieldQueries any longer (shock), and as the pager can't be used with db_select any more I have no re-course other than the views (which is probably the proper way to go anyway in this case).

To mitigate against potentially huge listings I have added ranges instead and checked code to make sure that will limit the queries. This does mean that only the top 10(by default) latest blog posts will float at the top of listings.

I suggest we just make the above one of the next issues (along with a whole bunch more) and fix it up iteratively, realistically virtually the entire module will been re-written and restructured by the time it is ready for the first release of Drupal 8. For example feed links don't work but there again they are been driven by page callbacks from menu hook, which is wrong anyway so that may be broken by neglect/design.

To cut along story short I have added another patch, which appears to have made things a whole heap better :).

Edit: EntityField query replaced by Drupal::entityQuery()

deekayen’s picture

Status: Needs review » Needs work

I'm not sure that's really much of an improvement, if at all. The problem with just committing this now and making a new issue is that someone else who might come along to help might think that a range is how the module has functioned historically and by unnecessarily mystified about it. I think the work must continue.

chris_hall_hu_cheng’s picture

My wittering again, not making myself clear, apologies.

If I clearly comment in the code, what is happening and re-submit would that be acceptable?

The improvement I was referring to was for the whole patch, all the range does is prevent someone from generating 1000 blog posts and listing pages attempting to display the lot (although I would think that Drupal Core changes would have broken it again long before they get to that point).

It would seem that range is the intended way to limit queries via db_select now so the real problem is the fact that there is no pager. If anyone can quick chip in a quick fix for paging in this code that would be good but bear in mind that this is wrong and should be re-factored to use views and appropriate configuration for that, re-factoring the routing alongside that would probably be sensible.

chris_hall_hu_cheng’s picture

Ok having looked at entityQuery I could refactor these listings to use that and page them it seems. If the effort is made to do that I would suggest they are left that way and views are saved for more fanciful extended functionality (once the module is a fully uptanding d8 citizen).

Which do you prefer?

deekayen’s picture

seems to me that would be the whole point of putting views in core, is to do exactly that.

chris_hall_hu_cheng’s picture

so comment approach Ok then! phew[^_^]! re-roll patch this evening.

chris_hall_hu_cheng’s picture

Status: Needs work » Needs review
FileSize
7.73 KB
None View

patch.

chris_hall_hu_cheng’s picture

Status: Needs review » Closed (fixed)

Committed and closing this issue. Allows blog module to be installed and used (in a limited way) on alpha-3 release of Drupal 8 without breaking user profile page. More work required to make everything work exactly as before (when in core on D7) and to prepare for first full release of Drupal 8.

chris_hall_hu_cheng’s picture

Issue summary: View changes

Clarification.