Recommended Posts

New commits to the dev branch synced. Fixed the select statements, as mentioned above (still working here). Also, if the import from ProcessRedirects gets botched somehow, you can now try again. It doesn't keep track of the state of ProcessRedirects, so if you uninstall and reinstall it, the importer will still offer you the opportunity. However, that isn't an issue in my eyes as such a process-flow is not practical.

Hoping to merge into master as soon as possible. I'll give it another day (or just less, keeping in mind the severity of the issues encountered with the current 1.1.3) for more feedback until I merge.

  • Like 1

Share this post


Link to post
Share on other sites

Before I merge, I'd actually like to discuss the behaviour of the new selectors feature.

In its current state, you specify a selector in your destination path using square brackets ([[your-selector-goes-here]]). However, you can also use multiple selectors, and prepend and append to them, which I don't think it actually the right way to do it. Prepending a string to a selector will cause a redirect to a non-existent page. As such, I propose the following:

Instead of using double-square brackets to return the URL of the new destination page (using $page->url), I think it should return the name. This is handy when you want to redirect /blog/2015/<oldname> to /journal/<newname>/, for example.

Then, to return a full URL, we should use use find: as a prefix to the selector - find: template=basic-page, legacy_name={name}, for example.

post-2289-0-13332000-1429352189_thumb.pn

What do you think?

  • Like 1

Share this post


Link to post
Share on other sites

Version Bump to 1.2.0 - Important Upgrade

  1. Destination Selectors
  2. Fix ProcessRedirects Importer
    (You can now also try the import again, if the previous import gets botched somehow)
  3. Various other enhancements and important fixes
  4. No schema changes
  • Like 2

Share this post


Link to post
Share on other sites

@Mike - this is really great, especially the new features;

and a lot of care went into the documentation, and is much appreciated.. i hope others will find this useful!

will be upgrading that site i was testing on and report back any issues.

  • Like 1

Share this post


Link to post
Share on other sites

@Macrura

Thanks - I'm glad you're liking it. Yeah, documentation is pretty important to me, and so I make sure I do it to the best of my ability. Originally, I wanted to host the documentation myself, but thought the GH wiki system would be perfect enough for the task.

Regarding the selectors, I'm going to leave the implementation as-is for now (as mentioned in the docs).

  • Like 2

Share this post


Link to post
Share on other sites

Small update committed to dev branch: Debug Mode now shows conversion notes for each wildcard, as in the example below. This gives a little more insight, which I think is quite useful.

Page not found; scanning for jumplinks...
- Checked at: Fri, 24 Apr 2015 12:18:16 +0200
- Requested URL: http://processwire.dev.local/Articles/2015/4/24/Hello%20World.HTML
- PW Version: 2.5.27

== START ==

[Checking jumplink #12]
- Original Source Path:         Articles/{year}/{month}/{day}/{all}.{ext}
- After Smart Wildcards:        Articles/{year:num}/{month:num}/{day:num}/{all:all}.{ext:ext}
- Compiled Source Path:         Articles/(\d+)/(\d+)/(\d+)/(.*).(aspx|asp|cfm|cgi|fcgi|dll|html|htm|shtml|shtm|jhtml|phtml|xhtm|xhtml|rbml|jspx|jsp|phps|php4|php)
- > Wildcard Check:             1> year = 2015 -> 2015
- > Wildcard Check:             2> month = 4 -> 4
- > Wildcard Check:             3> day = 24 -> 24
- > Wildcard Check:             4> all = Hello%20World -> hello-world
- > Wildcard Check:             5> ext = HTML -> html
- Original Destination Path:    blog/{all}/
- Compiled Destination Path:    http://processwire.dev.local/blog/hello-world/

Match found! We'll do the following redirect (301, permanent) when Debug Mode has been turned off:

- From URL:   http://processwire.dev.local/Articles/2015/4/24/Hello%20World.HTML
- To URL:     http://processwire.dev.local/blog/hello-world/

I have a few plans in the pipeline, such as the ability to use your own expressions, but not decided yet.

Lastly, an issue came up a few days ago, where a jumplink is not working. I'm sure it has something to do with timed activation, and will look into it when I have more information. Seems that the end time (when not specified) is not being calculated properly. Normally, it would create a dummy time. I may actually need to look at redoing the whole timed activation feature...

Share this post


Link to post
Share on other sites

Hi Mike, all of my jumplinks have:

2015 years ago

in the start AND end column;

but the fields are all empty, no timed activation. None of the jumplinks work, even though in debug mode it shows

Match found! We'll do the following redirect (302, temporary) when Debug Mode has been turned off:

- From URL:   http://www.ohmspeaker.com/1/Bookshelf-Speakers.html
- To URL:     http://www.ohmspeaker.com/speakers/walsh-bookshelf/
- Timed:      From Wed, 30 Nov -001 00:00:00 -0500 to Wed, 30 Nov -001 00:00:00 -0500

if i go in and set a start and end date for the jumplink, it does work! but i guess this needs to be fixed?

Share this post


Link to post
Share on other sites

Hey Macrura - yeah, this seems to be quite weird. I'm sure it has something to do with storing null dates. Can you check in phpMyAdmin (or whatever you use) what the date is in the DB?

Share this post


Link to post
Share on other sites

hi Mike - here is how the date is formatted:

0000-00-00 00:00:00

Share this post


Link to post
Share on other sites

That is indeed how it should be... I assume you're running on Linux? I develop on Windows, and it appears that most of the troubles that have come up relate to OS differences...

I think I'm going to need to spend some time refactoring Jumplinks.

Share this post


Link to post
Share on other sites

I see 2015 years ago also, but only on the Mac (localhost dev server using MAMP). On the Linux 2.4 live server the dates are correct.

Share this post


Link to post
Share on other sites

yes, linux/apache

- mySQL  5.5.40-36.1-log

- PHP 5.4.3

also, i have another site on the same server and on that one everything works fine; no dates are show in the columns, they are empty.

on the problem site which is using the dev version of the module (latest, downloaded today) these were all imported from ProcessRedirects, but then some were added after that and all of the rows show the 2015 years ago;

Share this post


Link to post
Share on other sites

also, i have another site on the same server and on that one everything works fine; no dates are show in the columns, they are empty.

Those columns shouldn't be empty at all. If no date is specified, it should use 0000-00-00 00:00:00.

on the problem site which is using the dev version of the module (latest, downloaded today) these were all imported from ProcessRedirects, but then some were added after that and all of the rows show the 2015 years ago;

Also finding that to be quite strange because both the importer and the 'editor' use the same function (commitJumplink) to insert the jumplink.

Going to test this out on my Linux server to see if I can reproduce this.

Update: Okay, I'm able to reproduce this in CloudLinux running LightSpeed (and, thus, I'm sure many other nix setups will be the same). However, in my case, the date columns are not empty, but contain the zero date. I'll try and figure out what's going on.

Share this post


Link to post
Share on other sites

Mike, just curious why you are saving a zero dates? Shouldn't empty suffice and just check if $date_start and $date_end are empty?

Share this post


Link to post
Share on other sites

Mike, just curious why you are saving a zero dates? Shouldn't empty suffice and just check if $date_start and $date_end are empty?

At first, I was using NULL dates, but that seemed to break on some systems. I then saw that PW uses zero dates, and so used them instead. As the column type is TIMESTAMP, can I even save empty strings?

Edit: Although, I see where I am perhaps wrong. PW uses the following schema

Type          Not Null   Default
TIMESTAMP     TRUE       0000-00-00 00:00:00

Whereas Jumplinks uses:

Type          Not Null   Default
TIMESTAMP     FALSE      NULL

Whilst the default is NULL, Jumplinks sends a zero date to the database.

Will work on this shortly.

Share this post


Link to post
Share on other sites

Seemingly, PW compares dates in the database to the $lowestDate of 1974-10-10.

I've updated the dev branch to do pretty much the same thing. Also, I have changed the schema of the date_start and date_end columns. The schema will update automatically. To me, this seems to be the better approach. Sure, I could use NULL dates, but recall that giving me problems before.

I have tested on Windows, CloudLinux and CentOS. I'm sure the fix will work just fine on OS X and other nix variants, but please can those affected confirm for me?

As soon as this is confirmed to be fixed, I'll push 1.2.1 to master.

Thanks.

Share this post


Link to post
Share on other sites

In the context of dates, what I really would find useful, is a date for the latest hit.

So I could, after a period of time, delete those redirects, which had no hits since that period, so those links don't seem to matter any more. That helps to keep my list short. :-)

Share this post


Link to post
Share on other sites

In the context of dates, what I really would find useful, is a date for the latest hit.

So I could, after a period of time, delete those redirects, which had no hits since that period, so those links don't seem to matter any more. That helps to keep my list short. :-)

Indeed, that could be quite useful, and is better than a full-on hit log, as I wanted to do at the beginning. This will also be helpful for an upcoming site migration, so will implement this soon.

Share this post


Link to post
Share on other sites

Those columns shouldn't be empty at all. If no date is specified, it should use 0000-00-00 00:00:00.

Update: Okay, I'm able to reproduce this in CloudLinux running LightSpeed (and, thus, I'm sure many other nix setups will be the same). However, in my case, the date columns are not empty, but contain the zero date. I'll try and figure out what's going on.

I meant that the columns in the PW admin are blank; i didn't check the dates in the database, for the particular site that works...

Share this post


Link to post
Share on other sites

I meant that the columns in the PW admin are blank; i didn't check the dates in the database, for the particular site that works...

Ah, indeed. Those should be blank when not in use.

I'm sure the latest fix will work for you - please let me know if it does. :)

Share this post


Link to post
Share on other sites

I'm getting an error with mysql version: 5.6.24

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'null' for column 'date_start' at row 1

the error occurs when you don't populate either the start or end dates for a new jumplink.

Elsewhere it has been caused by mysql v5.6 being a lot stricter with datetime fields. Where previous versions have just ignored certain data, v5.6 now raises an error.

Starting mysql with the switch: --sql-mode=ALLOW_INVALID_DATES

removes the issue.

Share this post


Link to post
Share on other sites

When using mysql v5.6 with the switch: --sql-mode=ALLOW_INVALID_DATES

blank start and end dates get set to 2015 years ago, the dev branch solved this but unfortunately didn't fix the sql error.

Share this post


Link to post
Share on other sites

my issues appear to be solved.. thanks Mike! looking forward to using this a lot now!!

Share this post


Link to post
Share on other sites

I'm getting an error with mysql version: 5.6.24

the error occurs when you don't populate both either the start or end dates for a new jumplink.

Elsewhere it has been caused by mysql v5.6 being a lot stricter with datetime fields. Where previous versions have just ignored certain data, v5.6 now raises an error.

Starting mysql with the switch: --sql-mode=ALLOW_INVALID_DATES

removes the issue.

Hi guy, and thanks for bringing that up - will sort that out this afternoon.

my issues appear to be solved.. thanks Mike! looking forward to using this a lot now!!

You're very welcome. :-)

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 Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Github: https://github.com/MoritzLost/TextformatterPageTitleLinks
      ---
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.
    • By BitPoet
      I'm really in love with FormBuilder, but the one thing missing to match all my end users' expectations were repeatable field groups. Think repeaters, in ProcessWire terms. Our primary application of PW is our corporate intranet, so "lines" of fields are quite common in the forms I build. We have all kinds of request forms where the information for a varying number of colleagues needs to be entered (from meal order to flight booking request) and where it is simply impractical to send a form for each, and I don't want to clutter my forms with multiple instances of fields that may only get used ten percent of the time.
      That's why I started to build FormBuilderMultiplier (link to GitHub).
      What it does:
      Adds an option to make a regular Fieldgroup repeatable Lets you limit the number of instances of a Fieldgroup on the form Adds an "Add row" button the form that adds another instance of the Fieldgroup's fields Adds a counter suffix at the end of every affected field's label Stores the entered values just like regular fields Makes the entered values available in preview and email notifications Supports most text based fields, textareas and selects (really, I haven't had enough time to test all the available choices yet) What it doesn't do (yet):
      Support saving to ProcessWire pages (i.e. real Repeaters) I haven't tested all the validation stuff, Date/Time inputs etc. yet, but since I'm utterly swamped with other stuff at work, I didn't want to wait until I have it polished. Any feedback is welcome. There might also be some issues with different output frameworks that I haven't encountered yet. The forms I work with mostly use UIKit.
      Status:
      Still alpha, so test well before using it in the field.
      Known issues:
      When rows are added, the form's iframe needs to be resized, which isn't completely clean yet.
      How it works:
      The Fieldgroup settings are added through regular hooks, as is the logic that adds the necessary field copies for processing the form and displaying previews.
      "Multiplied" field instances are suffixed with _NUM, where NUM is an incremental integer starting from 1. So if you have add two fields named "surname" and "givenname" to a fieldgroup and check the "multiply" checkbox, the form will initially have "surname_1" and "givenname_1" field (I'm still considering changing that to make the risk to shoot oneself into the foot by having a regular "surname_1" field somewhere else in the form less likely).
      When a "row" is added, the first row is cloned through JS and the counter in the fields' IDs, names and "for" attributes as well as the counter in the label are incremented before appending the copies to the Fieldset container in the form.
      To keep backend and frontend in sync, a hidden field named [name of the fieldset]__multiplier_rows is added to the form. Both the backend and the frontend script use this to store and retrieve the number of "rows".
      ToDo:
      Naturally, add the option to store the data in real repeaters when saving to pages. Do a lot of testing (and likely fixing). Make a few things (like the "Add row" button label etc.) configurable in field(set) context. Add a smooth API to retrieve the multiplied values as WireArrays. The mandatory moving screenshot: