Jump to content

ErikMH

Members
  • Posts

    61
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by ErikMH

  1. That’s a shame, @bernhard — not the way I like my app developers to behave. ?

    But I’ve learned so much for your own helpful comments and answers and modules that it would never occur to me to withhold a helpful hand when there’s something I know a little bit about. I’ve been privileged to belong to several forums with very high signal-to-noise ratios, but this one is truly la crème de la crème.

    Tschüß, und Viel Glück!

    • Like 1
    • Thanks 1
  2. I don’t know @wbmnfktr’s source, but it sure sounds like that’ll do the trick nicely! My suggestion otherwise, honestly, if you don’t have a lot of digital typography knowledge or relevant tools, would simply be to experiment with the CSS: specify only one font at a time and include font-variant-numeric: tabular-nums, remembering (of course) to dump (or not use) your browser cache with each new page load.

    I believe all the various Arial varieties support it, as do the Avenirs. So do (at least) the macOS Helveticas. DIsappointingly, the current macOS system font (variations on “SF” and “San Francisco”) appear not to support it, other than the mono-spaced SF Mono variant.

    It probably goes without saying, but you’ve asked for “basic,” so: all monospaced fonts will do exactly what you want, even without the font-variant-numeric: tabular-nums. Even if you don’t want to use a monospaced font in general, you might consider using it just for the date/time stamp. My favorite is Michael Everson’s shareware (€25Everson Mono, which has beautiful glyphs for (I believe) every non-Han Unicode codepoint. Everson writes:

    Quote

    I have found it quite legible at sizes as small as 4 points. It is lighter and a bit looser than Courier.... Its clean, simple design makes Everson Mono an excellent default “fallback” font when no other, more “typographical” fonts are available for a specific script or Unicode character.

    I met Michael (nice guy!) a few years ago in the U.K., but otherwise I have no connection or vested interest — other than Everson Mono being my favorite monospaced font for the past 35 years....

    • Like 1
    • Thanks 1
  3. Sorry for suggesting something you’d already tried, @bernhard — I’d skimmed over some of the details of your post (pre-coffee!).

    Not all fonts have tabular numeric forms, of course. Actually, a quick look through my 361 installed typefaces shows that only about half of my installed fonts support tabular numbers — YMMV, of course. This, on a MacBook Pro running macOS 13.4.1 (the current “Ventura” release).

    So, it’s possible that tabular-nums is working just fine — only not with any of the fonts that have been called for.

  4. Thank you all very much for your suggestions for further research; I am consistently amazed by the high quality of responses here, as well as the high signal-to-noise ratio!

    I owe you an update:  As I mockingly predicted to myself, the mere act of writing the OP seems to have fixed the problem. Of course, I know this *isn’t* really true, but in truth I have not been unexpectedly logged out even once since I posted here two days ago — astonishing, given that I’d gotten logged out at least 25 or 30 times in the two or three hours leading up to my post.

    In a perfect world, I would hunt this down ASAP *before* it bites me again. Pragmatically, though, I have to admit that I’m on deadline and there are more immediately pressing concerns.

    Again, I am very grateful for all of the various pointed questions; they will be the first place I turn when the problem returns. And I promise to update the thread with more info when that happens!

    In the meantime, thank you, @Jonathan Lahijani, @bernhard, & @flydev!

    • Like 3
  5. There are quite a few threads here where users report ProcessWire repeatedly logging them out (see below). I, too, have had this problem intermittently over the two years I’ve been using PW. I was able to reduce the problem somewhat about a year ago by turning fingerprinting completely off — but the problem has never completely gone away.

    I’m now at my wits’ end: I was unexpectedly logged out a half-dozen times again earlier today, though I could never see a pattern. As of an hour ago, though, every single time I try to update a field definition, the change is discarded and I’m logged out.

    Using a different browser helped for a few minutes, but then it began having precisely the same predictable problem.

    • Fingerprinting is off altogether ($config->sessionFingerprint = false;).
    • CSRF protection is off ($config->protectCSRF = false;).
    • I have installed the Session Handler Database, so my /assets/sessions/ folder is empty.
    • This is my PW development environment, running on my MacBook Pro (M1 Max, current MacOS) via DDEV and Colima; restarting the environment has no effect.
    • I do use Cloudflare WARP/1.1.1.1 on my Mac, though that shouldn’t be relevant; turning it off has no effect.
    • session.gc_maxlifetime is the default  1440
    • session.gc_divisor is the default  10001

    I would like to fix this problem for good and never see it again, so that I can get back to far more important work.

    Does anyone have any ideas?

    ---

    Chronological (probably not comprehensive) list of relevant threads that I’ve read thoroughly:

     

     

     

     

     

     

     

     

     

     

     

    • Like 3
  6. Fantastic little module, and I especially like the “magic” that happens when certain interpolated punctuation marks (“,”, “|”) are used between concatenated strings and one of the concatenated strings is blank: they’re left out! ?

    Would it be simple to add an ellipsis (“”) to the list of characters so treated? My use case involves long paragraphs where I keep track of opening- and closing-words separately (in text fields), but I’d like to be able to represent the whole paragraph with

          Starting words concluding words.

    Occasionally, there’s a very short paragraph, and I don’t want to imply that something has been left out (which an ellipsis, of course, does) — and in those unusual cases I include all of the text in the “starting words” field, leaving the “ending words” field empty. But (unlike with , and with |) the ellipsis shows up regardless.

  7. OK, guys, it seems there was one more piece to the puzzle. Like @adrian, when I recreated the situation in a simple test environment running 3.0.192, I couldn’t recreate the problem. I should have tested this yesterday, but where I’d discovered that changing findMany() to find() in my code worked around the problem, I figured I’d found it.

    So, the following conditions are necessary but insufficient:

    1. PW 3.0.192 or greater (including the current version)
    2. page classes
    3. findMany() instead of find()

    I believe I’ve found the final ingredient. I have tested this in a simplified environment and recreated the problem:

      4.  getPage()

    In real life, I’ve rolled my own pagination (since I’d wanted to provide users with logarithmic-like controls for moving backwards and forwards through the site, and provide them with sign-post dates); this paginating has worked well. But it means that rather than a foreach loop I cycle through results in a for loop, and then assign the item with a getPage(). So, Adrian’s code looked like:

    foreach($pages->findMany('template-basic-page') as $p) {
        d($p->id . ' : ' . $p->returnParentId());
    }

    but mine looks more like:

    $items = $pages->findMany('template=Test');
    for ($idx = 0; $idx < 1; $idx++):
    	$p = $items->getPage($idx);
    	echo ($p->identify());
    endfor;

    (Yes, that’s my test system, where I’ve hard-coded it to “loop” through just one test record; it’s sufficient to show the problem though:

    ProcessWire\TestPage #279
    id: 1025
    name: 'test-record-a'
    parent: ''
    template: 'Test'
    title: 'Test record A'
    data: array (1)
    'title' => 'Test record A'
    

    parent there should = '1'.

    I see that I can do the same thing by removing getPage() altogether:

    $p = $items($idx);

    In the grand scheme of things, I don’t know which is better; however, this assignation — whether implicit or via getPage(), seems to be the final piece: add this, and $this->parent() becomes a NullPage.

    So, to sum up: all of this works fine in 3.0.150-or-so (where I developed it) on up through 3.0.191. As of .192, it breaks. Switching from findMany() to find() works around the problem. Sticking with findMany() and using the customary foreach() code pattern also works around the problem.

    Phew! @kongondo, I agree that the commit you link to looks relevant. Do you think the (implicit or explicit) getPage() may call any of that code?

    • Like 1
  8. Thank you, @adrian, for that pointer. I’d had no idea that JS hadn’t been running. I’ll look into your example soon!

    But the big news is that I’ve solved the problem! @ryan, @bernhard, & @kongondo — thanks to each of you, too, for your encouragement and good ideas!

    Essentially, there is a bug, but it only presents itself when using findMany() instead of find(). As of 3.0.192, if you assemble a batch of pages with findMany() , and then call a function defined in a page-class definition on one of those pages, the $this variable in that function will have an empty parent property.

    By contrast, in 3.0.191, the $this variable in that function will have the proper value in its parent property.

    And also by contrast, in both 3.0.191 and in 3.0.192, if you use find() instead of findMany(), the function  will have the proper value in its parent property.

    So, the bug shows up only in 3.0.192 or later and you’re using findMany() and you’re trying to find any parent-based information from the perspective of $this within a function of a page-class definition.

    For my own use today, I’m perfectly OK using find() instead of findMany(), though there may come a time when I’m dealing with too many records for that to work gracefully. So I can upgrade beyond 3.0.184!

    Thanks again to everyone for your help; I’ve learned a lot through this process. If an admin would like to break all this out (it has nothing to do with Ryan’s original post — I meant to reply initially to his announcement of 3.0.192!), I’d be grateful

    • Like 1
  9. Oh, bingo — you called it!

    sam.example.org/:1 Refused to load the script 'https://sam.example.org/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'nonce-MzlhOGMzOWY0OTdkMDIxMmZkZDRiNTE0ZDBiYTg3YzI=' 'strict-dynamic'". Note that 'strict-dynamic' is present, so host-based allowlisting is disabled. Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

    I’m out of my ken here, @adrian. I see that something is set to be more secure than optimal, but I’ve no idea where to make a change. Cloudflare is mentioned — do you think that’s because it’s really where rocket-loader is served from, or because I have Cloudflare guarding my cloud-based development machine too well? Or is that not a fruitful line of inquiry?

    This of course isn’t the serious problem that I need to resolve, but I’m glad to get these little points of friction worked out too. Thank you!

  10. 12 minutes ago, adrian said:

    But in the view you are seeing, it should look like this, in which case, it would be the checkbox to the left of "Table". But clearly that is missing from your screenshot. What I can tell is that based on that and some other missing UI elements, it looks like JS is disabled in your browser.

    Well now that’s very strange. I see exactly what I posted here, both in a WebKit browser and also in a Chromium-based browser — both of which have Javascript turned on. I thought perhaps there might be an invisible checkbox, but the pointer doesn’t change when I hover in that area, and clicking does nothing.

    But it doesn’t really matter for the problem at hand; I won’t worry about this for now. Thanks!

  11. 27 minutes ago, adrian said:

    Another crazy idea - can you point this problematic install to the DB of a site that is working in recent PW core versions? It might help to determine whether it's a problem with the DB or the core files.

    I’m not sure what you’re suggesting? I’ve backed up, made changes, tested, restored from backups countless times over the past eight weeks on my development installation.

    Whenever I need to update data in the live site, I’ve restored the development site to the last master release, added my new data, and then cloned everything over to the live site.

  12. Ah. Well, my workaround doesn’t work around everything. It turns out that not only is $this->parent() a NullPage, but in fact $this->url and $this->httpURL don’t include the parent’s node of the URL. So, for example, if page “Parent” has a child page “Child”, the child’s URL ought to be https://example.tld/parent/child/, but as of 3.0.192 it’s instead giving me https://example.tld/child/.

    I could probably work around this too (finding the parent via the workaround I posted this morning, getting its URL, and appending the child’s URL node to it), but I suspect that I’d then just find something else that doesn’t work because my page’s parent isn’t identified.

    So I’m back to analyzing the problem....

×
×
  • Create New...