Jump to content

JayGee

Members
  • Posts

    247
  • Joined

  • Last visited

Posts posted by JayGee

  1. 30 minutes ago, bernhard said:

    Hi @Guy Incognito thx for the input. RockMigrations needs PHP>=8.0 and ProcessWire should warn you about that before installation: https://github.com/baumrock/RockMigrations/blob/1089f625048c4c68e883e46d1d57d7153c155bf2/RockMigrations.info.php#L14

    So you did a fresh install and got an error without PW showing the requirement fails?

    Ah ok - I didn't clock the PHP 8.0 requirement apologies. I just installed on auto pilot without thinking as have used your module before 🙂. It's odd though as I thought that operator had been supported pre 8.

    It wasn't a fresh PW install it was an existing project. I don't recall seeing the warning about PHP version, but Tracy Debugger intercepted the syntax error when I refreshed the modules, so I didn't see the default PW messaging.

    But all running smoothly now anyway thanks.

    • Like 1
  2. 20 hours ago, tires said:

    Thanks for the info!

    Is there a quick workarcoud to fix it on my own.
    Or do i need to downgrade to an older php?

     

    ----------------------------------------------------

    For now i just hide the error / warnings with this code in my site/config.php

    /** OWN ERROR HANDLER FOR DEPRECATION NOTES **********************************************/
    
        function myLocalDevDeprecationErrorHandler($errno, $errstr, $errfile, $errline) {
            if(!isset($GLOBALS['DEPRECATION_WARNINGS_BAG'])) {
                $GLOBALS['DEPRECATION_WARNINGS_BAG'] = [];
            }
            if(!is_array($GLOBALS['DEPRECATION_WARNINGS_BAG'])) {
                $GLOBALS['DEPRECATION_WARNINGS_BAG'] = [];
            }
            $GLOBALS['DEPRECATION_WARNINGS_BAG'][] = [$errfile, $errline, $errstr];
            return true; // true | false  = suppress further processing
        }
    
    /** OWN ERROR HANDLER FOR DEPRECATION NOTES **********************************************/

    See here:


     

    I've not actually checked the errors myself yet but I guess if you can supress them without issue for the time being that's going to get you out of jail until there's a fix. 🙂 

  3. I've seen previously on here somebody had a module or method to organise pages in the site tree visually into folders, whilst still keeping the root path for the page. Now I need it for something I can't find it!

    E.g.

    Instead of:

    Home
    -- /Page1
    --/Page2
    --/Page3

    I would like to organise as follows:

    Home
    --/folder
      -- /Page1
      --/Page2
      --/Page3

    whilst still keeping the URL as

    {site}.com/Page1

    not

    {site}.com/folder/Page1

    We're migrating a site from WP with significant number of pages with a URL structure that currently runs off of the root for every page URL and I'm trying to avoid a tangled mess of rewrites and htaccess edits!

    TIA,
    J

     

  4. 44 minutes ago, strandoo said:

    Thanks @Guy Incognito. Yes, now that I've dived in a bit, I can see that handling the communication may be tricky. (Logged-in sales rep initiates a 'stock query' > check if exists, creates a new DB record > writes file > waits for response > checks if new response file matches my stock query > parse file and update DB record > display result > rinse and repeat.)

    The php module 'Inotify' looks promising as far as checking for directory/file changes, but I haven't gotten there yet. Thanks again.

    Definitely sounds like they would be better off with a proper API to make for a shorter round-trip - but I know it can be hard sometimes to get people to change their ways! 😆

  5. 1 hour ago, strandoo said:

    Hi folks. I wonder if anyone has built or encountered an API-like FTP system of interacting with another computer. My client wishes to exchange product information (primarily stock quantity) via small text files that they will get/put via FTP to their website. (Currently, they FTP 10 csv files every day which I parse and use to update their website, so hopefully I can build on that). I think writing the files won't be difficult, but I imagine that I'll have to somehow monitor a directory, looking for new files and/or changes to existing files. I'd instigate the action on my end, then wait for a response via ftp and respond by parsing the new file and responding accordingly.

    I'm most worried about detecting the incoming files: any ideas on how this can be done? Maybe only start 'watching' after the initial action? Any other thoughts about parsing/writing/deleting the files?

    I'd appreciate any thoughts, ideas, etc. - Paul

    We have this kind of setup on integrations for a number of clients. It's a bit old fashioned and clunky but still seems to persist as a common way of working particularly in certain industries, e.g. fulfilment and ecommerce price lists.

    We have mainly used a couple of approaches.

    1) Creating cloud based endpoints to which files can be sent with cloud functions (E.g. Google cloud) sitting behind them. So the relevant processing is triggered automatically when the data arrives to the endpoint. Not quite a full API but not traditional FTP either.

    2) Time-based send-and-receive using SFTP and CRON tasks to trigger the processing by regularly checking for files in certain folders on the FTP servers.

    The biggest challenges we find are more about process and safeguarding the quality of data exchange rather than technical issues. E.g. should files be overwritten on arrival at the FTP sever? What is the naming convention for the files? What is the protocol for handling missing or overlapping data - e.g. if 2 files have a row with the same ID number should data be overwritten in your database? How are people notified if data exchange fails or there is a file parse error?

     

     

    • Like 2
  6. On 11/9/2022 at 11:02 AM, virtualgadjo said:

    Hi @marie.mdna

    if i'm not wrong this depends on your config file $config->httpHosts var, if the first host in the array contains the www, the sitemap will use it too (at least, that's what happens for all the websites, a lot..., for which i've this module installed 🙂

    have a nice day

    It's important that this is the case too because otherwise you could potentially be informing search engines you are using a different primary domain to one your site it actually using.

    • Like 1
  7. 1 hour ago, Martinus said:

    I actually do not use url-segments for my normal pages. At least, not that I know off. I click the page Departments (menu item or product sub link), and this use the browse template. On the browse template the php switch determines I access a parent page, so I include the parent markup php file (no template), and it displays all children of the Departments: department x, y, z, etc. Same applies to Categories, Sellers and Brands. Since these are actual PW pages they are not url segments.

    For the sorting, I do use url segments, which, btw, I still have to look at: 

    // Here we use a switch case to determine how to sort.
            // we are only using 1 URL segment, so send a 404 if there's more than 1
            // DO WE NEED TO MAKE A 404 PAGE FOR THIS ???
            if(strlen($input->urlSegment2)) throw new Wire404Exception();
            switch($input->urlSegment1) {
    
            case 'name-asc': // NAME
                $order = "title";
                $sorted = "name asc";
                break;
    
    etc.

     

    Ah ok that all makes sense - maybe I misunderstood the original question sorry!

    Re: the 404 page I can't see why your approach wouldn't work - but I think you can just do if($input->urlSegment2) btw to check for the segments. 🙂 

     

  8. @Robin S I just wanted to post back and confirm that now I know not to look for

    ___upgrade() method firing on module refresh alone I can see everything working exactly as you described.

     Thanks all. 🙂

     

    On 10/26/2022 at 2:26 AM, Robin S said:

    image.png.ab88fdc3957511c5d58caf7ac96b4d0d.png

    An aside - I wonder if the wording here would be better as 'applied when each module is next loaded' just to clarify that the refresh itself doesn't guarantee a module loading... although it may just be me that made this mistake!

     

    • Like 1
  9. 4 hours ago, Jim Bailie said:

    @Guy Incognito Your above explanation on url segments is very interesting. Can you expand any further on how you set this up?

    I've read through https://processwire.com/docs/front-end/how-to-use-url-segments/ , but I'm still not fully absorbing what I think is your approach. I'm sure the parent could benefit from this approach as well.

    @Martinushas summed it up pretty well. This is basically the same approach I use. So you build your navs/links up using your category (or sub page names) rather than a 'traditional' link to a sub-page url and append them to the parent page URL.

    <a href="<?=$page->url.{CAT-NAME-GOES-HERE};?>">Example Category</a>

    Then you can get retrieve the url segment from the page URL and use it in your selectors for filling out the dynamic content.

    • Like 1
  10. @Martinusif I understand what you're trying to do correctly, I think url segments are the best approach.

    I frequently use ProcessWire for organising and displaying categorised data and usually approach this sort of thing with url segments rather than working with the actual pages (if that makes sense).

    So put all your items under a /items page rather than in a set structure. You can then you can create category pages as views of different sub pages by using the url segments in your selector.

    The advantage is that you can have your items in multiple categories without any duplication of pages, you only have to maintain one parent 'category' template and from an SEO perspective the url segments appear the same as regular URLs. (You may need to manually inject them into your sitemaps though).

    • Like 1
  11. Hi @Robin S thanks for your help on this. I have a few personal modules I want to update and then later submit on a couple of public modules we've adapted in-house, so wanted to be sure I got my head round what is going on with how upgrades are meant to work, so everybody's assistance and time here is much appreciated. 🙂 

     

    10 hours ago, Robin S said:

    as a general debugging tip.... you don't want any non-essential code executing. In your example you have:

    Yes I typically would carry out a more in-depth debugging but in this case, as it seems you have confirmed, I suspected that I may have been misusing the method rather than other bugs being at-play so was trying to keep things simple to start with. But definitely agree with your advised approach.

     

    10 hours ago, Robin S said:

    1. The method name must be ___upgrade() and not upgrade(). The docs for Module make it sound like it is optional whether the method is made hookable with the underscore prefix but that seems to be incorrect because I can't see the method firing if the underscores are missing. So either that's a bug or the docs need to be updated.

    Agree this isn't clear - I've always thought the hooks were optional.

     

    10 hours ago, Robin S said:

    If your module has autoload set to true then it will be loaded immediately after the refresh (and on every other page load). But if it's not autoload and you want to see the ___upgrade() method called then you can force the module to load like this:

    Ok this is interested as the module I was experimenting with is definitely set to autoload and this hasn't been my experience... so there's likely something else going on I need to troubleshoot. But now at least I know where not to be looking!!! 🤣

     

    10 hours ago, Robin S said:

    This isn't a bug as whatever actions you are taking in ___upgrade() will get applied in time for the next usage.

    I'll update and close the issue I raised accordingly.

  12. 8 hours ago, Guy Incognito said:

    Hi @BitPoet - I'm pretty sure I did try both with and without defining it as hookable, but will do another test to double check and report back.

    I've checked now. Making it hookable doesn't seem to make any difference. The method just doesn't get called and the test message is never displayed.

    I'm not misunderstanding the functionality am I? The method should be called whenever the version number bumps right?

  13. Yes, I've been using the module refresh to trigger the change but it doesn't seem to fire and it does register the change in version number and displays the default upgrade message. But no custom functionality within the upgrade method seems to get called.

    I've raised an issue now on GitHub just now actually: https://github.com/processwire/processwire-issues/issues/1634

    As an aside - I've tried setting the version both up and down... I presume as the version numbers are strings not numbers any version change should trigger the upgrade method?

  14. 1 hour ago, prestoav said:

    Hi @Guy Incognito, thanks for replying. In the short term it looks like the current client might be moving away from Zoho so we've paused further development for now. However, I know some of our other clients still use Zoho so I may be back in touch at some point if that's ok!

    Yes of course, feel free to DM me - always great to network with other UK based ProcessWire fans too 🙂

  15. Hi @prestoav. We've done a fair bit of work around the Zoho API for a client who uses Zoho products extensively. We've not (yet) turned this into a module, but have some work coming up for this client that may make this an options. But feel free to pick my brains if it helps. From memory their API can be a bit unconventional as I think it's centred around 'views' inside the Zoho UI.

×
×
  • Create New...