Jump to content

asbjorn

Members
  • Posts

    179
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by asbjorn

  1. I'd like to set up a LazyCron function that fires every hour on each page that has a template named "post". So far I have gotten the function running. But when it has fired once on "Page with Title A", it takes and hour before it is fired again on any other pages. It makes sense, hooking the function with wire()->addHook().

    What I want to do, is to get the function to be fired with LazyCron individually for each page. So that "Page with Title A" fires every hour (if it has pageviews), and "Page with Title B" is fired individually and possibly during the same timeline, if it has pageviews.

    Is this possible? Or might there be another way to utilize a sort of LazyCron on individual pages?

  2. I am running on a PRO ISP (Norwegian) server with cPanel, Imunify 360, ModSecurity turned on and have recently (after 2 years without trouble) gotten some trouble with ProcessWire and the PageField AutoComplete showing a 403 notification in the ProcessWire Dashboard.

    The scenario is the following: I have a import script that collects data and creates ProcessWire pages and references in a four different PageFields. The data is collected from a JSON.

    The import might fire "too many" edits at the same time, and therefore the Imunify 360 security module in cPanel will try to prevent it. Afterwards, after the import (which works well) have been done, I want to edit a few of the PageFields manually, but when I type in the AutoComplete input field for the PageFields, the notification in ProcessWire only returns a "403.shtml" error. I turned off ModSecurity temporarily and managed to edit the field.

    Any one have an idea how I can whitelist ProcessWire with my import?

    (I can provide more details if necessary).

  3. As a follow up question to the first paragraphy solutions provided. Is there a way to get "the rest of the text" output? A way to exclude the first paragraph?

    The result I am looking for is to output the first paragraph from a body text field, then an image from an image field, and then the rest of the text from the body text field. So there might be other solutions?

  4. I have previously been using uppercase URL in $page->image->URL for browser cache busting query string purpose. Is this compatible with MarkupSrcSet? My current image url is $page->image->srcset('860x0,/2,/3'). 

    • Like 1
  5. VID (https://www.vid.no/) is searching for a Norwegian-speaking developer for development of all kinds: Updates, tweaks, possible major updates, as an adviser, and more. There are no concrete plans for new big projects as of this moment, but we're always taking our website a step further. So development of any size could and will arise. It is therefore important that you are open for development of all kinds.

    Some facts: We use GitHub. We stay updated with latest version of core and modules. We are fans of UIkit. We are interested in new ideas, more effective ways to work and think details are important.

    Send a message if you are interested. Got some projects you are proud of? Send us a link in your message as well!

  6. This will be a one-way sync (as I mentioned in my second post in this thread). The data will only be updated in the Directus database. No editing on these data will be done in ProcessWire.

    Also said, but in other words: When the data is imported (to ProcessWire) and kept updated/synced, I will be able to use the ProcessWire API to handle the data as per today. Meaning no extensive recoding of templates and so.

  7. I still have the need for ProcessWire to create a page for each item in Directus database. And be able to update the title if the item changes. And also I would prefer to keep working with the ProcessWire API, because of the way the end point for this import («person pages») is integrated with the rest of the website.

  8. The one-off task was rather easy, and I have managed this using the php sdk as you mention.

    But I'm not sure about how to go further, setting up a continuous synchronization. One-way, from Directus to ProcessWire. I'm new to this way of thinking (working with APIs). Should I use «cron jobs» of some sort? Or rely on Directus «pushing» when something is updated?

    Any good ideas are welcomed. Maybe this post could also be a heads up to others who are new to this …

  9. Has anyone integrated Directus with ProcessWire? I have a database in Directus that I want to sync with ProcessWire (create/update/delete pages). But I don't not know where to start. It might be possible with ProcessWire's API in some way?

  10. I have a webpage that I (think have) worked well with translation of dates based on a setlocale() code in a _init.php file until now.

    The page is in Norwegian (default) and English (english). But the date shown front end is now only in English. I have a multi-language textfield (locale) where I input nb_NO and en_US, and then I use the follow code in _init.php:

    $homepage = $pages->get('/');
    
    // For change of language, set default language
    switch($user->language->name) {
        case 'default':
            setlocale (LC_ALL, $homepage->locale);
            break;
    }

    To check what is output, I used this:

    echo setlocale(LC_ALL, 0);

    And it only outputs C both on the Norwegian and English page. (It should output nb_NO and en_US).

    I have the same setup on another page, at least I think so, but something must be different.

    I also tried changing the locale, and editing LanguageSupport.module, removing the setlocale() code from above, with no luck. I check both in development (MAMP) and on my production server.

    I use ProcessWire 3.0.59 (live) and 3.0.60 (development).

    There could be other code I have that messes this up. But I hope this could shine som light. My question is: What decides the locale and how could I fix the «C»?

  11. A couple of days ago my site went down for about 3–4 hours, due to what Cpanal calls EPf faults. There was over 300.000+ faults in total over the span of a few hours, resulting in a 508 error.

    I talked to my shared host support, which did not say anything about attacks or high traffic (this is a low traffic site on a decent shared host solution). But they said that the problem was the .htaccess file. Thing is, I've been using the same .htaccess file for months. Being said, I updated the file to a «out of the box» ProcessWire file with a few uncomments, and htaccess files from other installations of mine, but it did not seem to work stopping the 508.

    I ended up with a htaccess file from another installation, with the ProCache code implemented. And just when I removed that part, the page started working again. It might be coincidental, that it was just some processes that stopped or services that restartet. I don't know.

    What I do know is that ProCache was mostly turned off on my templates, which I have later turned on.

    All in all, I don't exactly know what the problem was, or what the solution could be. I'm hoping ProCache will work. If it even could help solve such a problem.

    What I am actually asking is, have anybody else had this problem? (Attacks, bad coding, cache turned off …?) Could ProDevTools shine a light on the issue if the webpage shows 508 due to a high number of faults?

    (Sorry for the messy post by the way, a lot of unstructured thoughts.)

×
×
  • Create New...