Recommended Posts

I haven't had a chance to play with this yet, but I know it will be used on an upcoming site - just wanted to say how great it looks and most importantly how impressive the documentation looks to be - love the use of Github wiki!

  • Like 1

Share this post


Link to post
Share on other sites

You were probably going to have countless issues if you'd played with it before yesterday as I didn't test across multiple PHP/MySQL versions. (I'm lazy like that.)

But all seems to be good now - lemme know if you bump into any issues.

Was going to host the docs myself... but the tools are there, so use them - hehe!

:)

Share this post


Link to post
Share on other sites

The mapping collection API has been modified:

  1. Method has changed from addCollection() to collection() due to:
  2. the fact that it now picks up if a collection already exists so that it can add data to it.

Docs updated.

(Thanks Dave.)

Share this post


Link to post
Share on other sites

Just fixed up a little issue regarding the first TIMESTAMP column being auto-updated.

Basically swapped the created_at and updated_at columns around, and removed the updated_at = CURRENT_TIMESTAMP bit from the SQL template used for updating mapping collections.

I could have just defaulted to NULL for both of these timestamps, but I think this is better. Who cares about column order, anyway?

Share this post


Link to post
Share on other sites

Okay, so after all those fixes, my testing seems to show that everything is stable. Everyone agree? I'd like to set this to stable in GH and in the directory.

  • Like 1

Share this post


Link to post
Share on other sites

Are we ready to go ahead and make this stable? I haven't encountered any further issues...

Hell yeah. I didn't encounter any further problems, but I haven't done the big test yet. 

  • Like 1

Share this post


Link to post
Share on other sites

I've just installed the module, but it seems the redirect is to late and I get a "Cannot modify header information - headers already sent by" error.

Edit:

Changing the hook from addHook() to addHookBefore() solved the issue.

Share this post


Link to post
Share on other sites

I've just installed the module, but it seems the redirect is to late and I get a "Cannot modify header information - headers already sent by" error.

Edit:

Changing the hook from addHook() to addHookBefore() solved the issue.

What sent headers first?

Share this post


Link to post
Share on other sites

My templates _init.php, but even as I removed that part the rendering of mustache in a appended TemplateFile was earlier than Jumplinks.

Share this post


Link to post
Share on other sites

I see. So there could be a lot of scenarios involved. Think it would be worth it to change the hook to something way early, and then check to see if a page representing the request exists? We could also add a configuration option that defaults the hook to pageNotFound, but allows you to specify if something is rendering output before the 404. Would be a simple checkbox that says, "Check Jumplinks in an early event - this prevents interruptions from other hooks/templates/etc."

What do you think?

Side note: my Redirects module for Bolt ties into a very early app event. Sure, the caveat is that pages that exist with the request uri are ignored, but we could add a simple check. Perhaps it would also perform redirects faster, as less things boot up?

Share this post


Link to post
Share on other sites

I think the hook is the right one, just addHookBefore does force template rendering to wait for your hooked function to finish, while addHook doesn't seem to do this.

Share this post


Link to post
Share on other sites

I think we're ready for stable. I'm first going to switch over to prepared statements - silly me for not doing this first. Once done, I'll switch over to stable.

Share this post


Link to post
Share on other sites

Version Bump to 1.1.0

Module is now stable (it looks to be, at least).

  1. Now using PDO Prepared Statements
  2. Tables honour responsiveness now - there was an issue with tfoot, so I just hid it from mobile...
  3. Various bug fixes
  4. No schema changes

Let me know if you bump into anything weird.  ;)

Oh, and there's this issue - anyone have any input on that? (Personally, I prefer to have full control... Don't really like modules making decisions for me.)

  • Like 3

Share this post


Link to post
Share on other sites

Version Bump to 1.1.1

  1. Using minified JS (manual call)
  2. Refactor SQL object
  3. Various other changes/fixes
  4. No schema changes

(And GitHub is under attack - boy, how I battled to commit the changes... Finally slipped through after about 20 minutes of trying.)

  • Like 2

Share this post


Link to post
Share on other sites

Version Bump to 1.1.2

  1. Correct page-check behaviour (was using name, now using URI)
  2. Use commitJumplink in CSV importer
  3. No schema changes
  • Like 2

Share this post


Link to post
Share on other sites

I actually had to uninstall the module - it was causing excessive mysql database connections (not usage) and my webserver nearly stalled.

Maybe I run into a loop or something?

I was redirecting from an old Drupal website to PW and used about 70 simple type redirects, such as sources  /drupal/page1/   

Got this (on the latest PW dev)

Error:

Exception: SQLSTATE[HY000]: General error: 1116 Too many tables; MySQL can only use 61 tables in a join (in /wire/core/PageFinder.php line 300)

Error:

Exception: DB connect error 1203 - User already has more than 'max_user_connections' active connections (in /wire/core/Database.php line 68)

I cannot say 100% that this was Jumplinks. I just noted that the performance was back to normal after I uninstalled the module.

So this is just for information in case anyone else can confirm this.

Share this post


Link to post
Share on other sites

Thanks for your post. :-)

Looks like another module is doing that. Jumplinks only creates two tables (one for jumplinks, and another for mapping collections).

In terms of performance, I'm unable to test that sort of thing. Are you saying that those errors go away when you uninstall Jumplinks? Do you have the same issue if you use ProcessRedirects?

If you (or anyone else) could provide me with more information, that would be great. Otherwise, I can't determine what's going on.

Share this post


Link to post
Share on other sites

On the topic of performance, I'm now wondering if I should set up a cache system for Jumplinks. It was mentioned by Antti a while back that Jumplinks is already feature-rich, but I think that caching redirects will actually be a life-saver for some users with large sites. At the end of the day, running the regex engine for every incoming request is sure to be a big performance hit on any server (the way I see it).

I'm sure everyone agrees this should be added?

There are also a few other fixes and enhancements in the pipeline, the most important one involves optional query-strings (much like the QSA flag for mod_rewrite). At the moment, if you want to match something.php and something.php?foo is requested, the redirect will not occur. In order to get it to work, you'd need to add {all} on the end of the source URI, which is, quite frankly, not the best way of doing it.

  • Like 3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Rudy
      Hi,
      I am writing a custom module that requires storing array of settings in the module config/settings.
      Is there a built-in fieldtype that allows me to store settings in an array (sort of like Repeater)?
      I tried using InputfieldAceExtended and InputfieldTextarea to store JSON array. Both times, my data was stored in the module settings (in the database) but upon reload, that information was not retrieved.
      Thanks
      Rudy
       
    • By Anssi
      A simple module to enable easy navigation between the public and the admin side of the site. After installation a green bar will appear to the upper side of the screen, containing a few navigation elements and displaying the PW version number.
      Heavily inspired by @apeisa's great AdminBar (Thanks!). I needed a bit simpler tool for my projects and as a result, this was made. Available on GitHub .

    • By Sebi
      I've created a small module which lets you define a timestamp after which a page should be accessible. In addition you can define a timestamp when the release should end and the page should not be accessable any more.
      Github: https://github.com/Sebiworld/PageAccessReleasetime
      Usage
      PageAccessReleasetime can be installed like every other module in ProcessWire. Check the following guide for detailed information: How-To Install or Uninstall Modules
      After that, you will find checkboxes for activating the releasetime-fields at the settings-tab of each page. You don't need to add the fields to your templates manually.
      Check e.g. the checkbox "Activate Releasetime from?" and fill in a date in the future. The page will not be accessable for your users until the given date is reached.
      If you have $config->pagefileSecure = true, the module will protect files of unreleased pages as well.
      How it works
      This module hooks into Page::viewable to prevent users to access unreleased pages:
      public function hookPageViewable($event) { $page = $event->object; $viewable = $event->return; if($viewable){ // If the page would be viewable, additionally check Releasetime and User-Permission $viewable = $this->canUserSee($page); } $event->return = $viewable; } To prevent access to the files of unreleased pages, we hook into Page::isPublic and ProcessPageView::sendFile.
      public function hookPageIsPublic($e) { $page = $e->object; if($e->return && $this->isReleaseTimeSet($page)) { $e->return = false; } } The site/assets/files/ directory of pages, which isPublic() returns false, will get a '-' as prefix. This indicates ProcessWire (with activated $config->pagefileSecure) to check the file's permissions via PHP before delivering it to the client.
      The check wether a not-public file should be accessable happens in ProcessPageView::sendFile. We throw an 404 Exception if the current user must not see the file.
      public function hookProcessPageViewSendFile($e) { $page = $e->arguments[0]; if(!$this->canUserSee($page)) { throw new Wire404Exception('File not found'); } } Additionally we hook into ProcessPageEdit::buildForm to add the PageAccessReleasetime fields to each page and move them to the settings tab.
      Limitations
      In the current version, releasetime-protected pages will appear in wire('pages')->find() queries. If you want to display a list of pages, where pages could be releasetime-protected, you should double-check with $page->viewable() wether the page can be accessed. $page->viewable() returns false, if the page is not released yet.
      If you have an idea how unreleased pages can be filtered out of ProcessWire selector queries, feel free to write an issue, comment or make a pull request!
    • By David Karich
      Thanks to the great Pro module "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use this module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      With this proof of concept I have created a module which adds the feature to copy a repeater item to the clipboard so that you can paste this item to another page with the same repeater field. The module has been developed very rudimentarily so far. It is currently not possible to copy nested items. There is also no check of Min/Max. You can also only copy items that have the same field on different pages. And surely you can solve all this more elegantly with AJAX. But personally I lack the deeper understanding of the repeaters. Also missing on the Javascript side are event triggers for the repeaters, which would make it easier. Like e.g. RepeaterItemInitReady or similar.
      it would be great if @ryan would implement this functionality in the core of RepeaterMatrix. I think he has better ways to implement this. Or what do you think, Ryan?
      Everybody is welcome to work on this module and improve it, if it should not be integrated into the matrix core. Therefore I put it for testing and as download on GitHub: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDublicate
      You can best see the functionality in the screencast: 
       
    • By anderson
      Hi,
      Please take a look at this:
      https://templatemag.com/demo/Good/
      The upper nav bar, including dropdowns like "pages" and "portfolios", what do you call this whole thing? At first I guess it's called "dropdown nav bar", but seems not.
      AND of course, what's the simplest way/module to achieve this in PW?
      Thanks in advance.