MarkE
Members-
Posts
1,051 -
Joined
-
Last visited
-
Days Won
12
Everything posted by MarkE
-
... just having a root around - I seem to have 12mb session file - is that normal?
-
It seems to be all pages. It was fixed after a reboot last time. I'm inclined to blame windoze - that's the usual source of my problems. Meanwhile, I'll turn Tracy off until I need it then reboot again...
-
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 33764184 bytes) in M:\xampp\apps\processwire\htdocs\site-ncog\modules\TracyDebugger\tracy-master\src\Tracy\Helpers.php on line 133 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10530816 bytes) in Unknown on line 0
-
Thanks, but as you say - it ought not to be necessary. Anyway, today it is working ?
-
It seems to make no difference which panels are enabled (or even none). However, unchecking the "Show debug bar" removes the error from the front end or back end accordingly.
-
Just got this error message: Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 25956352 bytes) (line 27 of M:\xampp\apps\processwire\htdocs\site-ncog\modules\TracyDebugger\tracy-master\src\Tracy\assets\Bar\panels.phtml) Any idea what might have caused it or how to fix it? I uninstalled the module and the error went away. After re-installing it, the error came back. The message at the bottom of the screen reads: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10563584 bytes) in Unknown on line 0
-
Maybe I am missing something, but I do find it hard to get an overview of what data a given user can access, including via the API. Having fixed the problem in the OP, a different part of the same code then gave problems: When run from the backend this works fine and finds all the relevant children. However, the webhook, coming in as guest returns an empty array. I checked and removed any access restrictions with no luck. I also changed the code to this (i.e. removed the selectors): if (wire()->session->webhook) echo('This mandate details - Title: ' . $this->title . ' Id: ' . $this->mandateId . ' Num of children = ' . $this->numChildren . '<br/>'); $osCollections = $this->children; // was find("template=Collection, paymentStatus!=paid_out"); if (wire()->session->webhook) echo('Number of collections found = ' . $osCollections->count() . '<br/>'); This resulted in the following response to the webhook: This mandate details - Title: Mandate Id: MD0004TV8F2YP3 Num of children = 24<br/>Number of collections found = 0<br/> So $this->numChildren is correct, but $this->children is empty ? FWIW, here is the print_r output immediately afterwards: ( [hooks] => Array ( [PageArray::render] => MarkupPageArray->renderPageArray() in MarkupPageArray.module [PaginatedArray::renderPager] => MarkupPageArray->renderPager() in MarkupPageArray.module ) [count] => 0 [total] => 0 [start] => 0 [limit] => 0 [selectors] => parent_id=2661, sort=sort, status<1024 )
-
I've been implementing the ideas in the excellent tutorial: https://processwire.com/docs/tutorials/using-custom-page-types-in-processwire/ I really like having a class to mirror certain important templates as it makes organising and structuring code more intuitive (to me) and avoids the need for many hooks. A key aspect of this is the ability to define a Page Class Name for a template, so that any pages with that template will automatically have the correct PHP class. To do this, you need to enable the advanced mode in the site/config.php and then edit the event template in the backend, under the system tab. However, I have a couple of issues that trouble me: The system tab carries a warning "Please note that all of these system settings are intended for ProcessWire system development (not site development). Use them at your own risk." Why is this? I assume that the term "ProcessWire system development" is intended to mean website apps (I am building a club membership site) as opposed to simple websites, and is not referring to the development of the Processwire system itself, but why the health warning? Is it still beta? What are the risks? The behaviour is not quite as I expected. If you create a new page with a template which has a pageClass then a hook after "save" shows the following: after entering the new page title and name and saving the "Add New" form, the page content is displayed. The page has presumably been saved as the "after" hook executes and shows that the template and custom pageClass have been assigned to the saved page, but the PHP class is still shown as Page, not the custom class. after the second save (of the page content), the hook shows that the PHP class is correct - the same as the custom pageClass. Is the behaviour in (2) intentional (and if so, why)? If not, is it a bug, or just unavoidable for some reason? (I also note, BTW, that the page id seems to be 0 after the first "save").
-
Thanks for that. Reading the explanation (i.e. that the contents are masked by output formatting), I wonder whether it is better to over-ride this for the field in general or just in the specific use case (the webhook). I tried inserting $os->of(false); and the problem was fixed ? It seems to me that if there is only one use case to fix, this approach may be better than generally allowing the API access. However, it's nice to have the choice and this episode once again proves how well-designed PW is (even if its features are not immediately apparent to relative newbies like me!).
-
... so I disabled the direct running from the webhook and left the save hook in place. The idea being that when the webhook updated the page, the save hook would then run. Which it did, but still exhibiting the same problem... ... might it be something to do with whether the method gets initiated from the front end (webhook) or back end?.. ... Aha! - looks like the missing fields have additional access restrictions. The webhook, coming from the front end is treated as "guest" so the fields are not visible to it. So I think I may have found the cause - just need to find a solution now ?
-
Hmm. I moved the code into a new method so that I could invoke it from the browser via a save hook or externally via a webhook. If I invoke it from the browser it works OK, but if it runs from the webhook then the problem persists. And I can't see how Tracy can help in the webhook case (which is why I dumped the vars to the page body).
-
Thanks for that. I have installed Tracy Debugger, but haven't yet fully comprehended it. I can't get barDump to give me anything - I guess because this whole thing is run from a webhook and not executed in the browser. I'll try initiating the same code from the browser and see what happens...
-
I'm probably being a bit dim, but I have been struggling a while with this: I'm developing a club membership site and generally it's going pretty well. I'm using custom page types as per this excellent tutorial: https://processwire.com/docs/tutorials/using-custom-page-types-in-processwire/ One such page type is a Mandate, which holds direct debit mandate details (using GoCardless). A method of the Mandate class is called whenever a webhook detects a change in status of a mandate. Two other templates are Payment and Collection. Payment pages (siblings of Mandates) hold details of required payments, whereas Collection pages (children of Mandates) hold details of collections attempted via direct debit. The relevant code of the webhook_update method of Mandate is: if ($event->action == 'created' || 'submitted' || 'active') { $osGCPayments = $this->parent->find("template=Payment, paymentStatus=order_placed, paymentMethod=1154"); // 1154 is id of GoCardless type if ($osGCPayments) { $osCollections = $this->find("template=Collection, paymentStatus!=paid_out"); $totalInCollection = 0; foreach($osCollections as $colln) { $totalInCollection += $colln->paymentAmount; } $unpaid = -$totalInCollection; $payIds = []; foreach($osGCPayments as $os) { foreach ($os->fields as $f){ $this->body .= ('Field: ' . $f->name . ', Val: ' . $os->$f . '; '); } $unpaid += $os->paymentAmount; $payIds += [$os->id]; } if ($unpaid > 0) { $amountInPence = $unpaid * 100; $this->create_payment($client, $mandateId, $amountInPence, $payIds); } } } The problem is that $os->paymentAmount, which has a value on the Payment page, returns no value in the above code. The line $this->body .= ('Field: ' . $f->name . ', Val: ' . $os->$f . '; '); was inserted to aid debugging and puts all the field names and values into the body of the Mandate page. The 'foreach's containing it run and inspecting the output shows that some of the fields have the correct values (including those that uniquely identify the page so that I am sure I am looking at the right one!), but that paymentAmount (float type), paymentMethod (page reference) and paymentDate (Datetime) are shown as empty. RuntimeMarkup and Text fields are shown correctly. The odd thing is that, for the foreach to run, $osGCPayments clearly contains the correct Payment pages, which means that the paymentMethod=1154 selector operated correctly, but paymentMethod is one of the field values that then appears to be empty in the selected pages. BTW, there are no Collection pages yet, so the first foreach does not run. Thanks in advance for any suggestions and apologies if I have done something stupid?
-
Thanks guys. I'll make a note not to include the cache folder in deployments.
-
Brief background: the live site is on a shared hosting service. I started developing on that but decided to continue it off-line. The development site is on W10 machine using Xampp. I had no significant trouble setting that up - importing the database using phpmyadmin. I then added a test environment on a Linux box (actually a Pi) running apache2 which is on the private network. I have done this (not with PW) a several times before and it has worked fine. So I exported and imported the database and copied over the files. After a few problems, I got everything running. However, I am getting one persistent warning, only in the test environment: Warning: touch(): Utime failed: Operation not permitted in /media/main/web/processwire/wire/core/FileCompiler.php on line 391 Any clues as to what is causing this?
-
That's really helpful, thanks. I've had a play with these and they should work well together. I'm particularly impressed with - it will save a lot of PHP head-scratching.
-
Just installed this and it looks good except that I am having difficulty adding new pages. I get this message: ProcessWire: ProcessPageAdd: Template Member is not allowed here (/members/) The settings I have used are parent = Members (i.e. url= /members/) and Template = Member. All the children of Members have template Member. If I deselect the Template = Member, the new page modal gives a choice of every template except Member. Am I being dim or what? The field is located on a completely different page (Memberships)
-
Just discovered FieldtypeRuntimeMarkup So I can include PHP in the page edit - it doesn't have to be on an admin template page. Even more choices ? (I'll shut up now and wait for a response)
-
Apologies - that was the wrong diagram attached in the previous post - this is the one I meant to attach: New website class diagram -Lucidchart.pdf
-
I'm starting to make some good progress with this. I'm seriously impressed with the PW API, but there is quite a lot to get to grips with. However the documentation (and support here ? ) is very good. I've done some simple ProcessModules and that works well. Now I have a bit of a head scratch. My (partial and draft) class diagram looks like this: New website design - class diagram.pdf Ignore the colour coding for now. What I am trying to decide is how to implement the relationships. It seems to me that PW provides multiple options: Parent-child PageTable PageRef - multiple select Repeating PageRef fields From what I can see, 4 doesn't offer any benefits over 3, which has a cleaner interface. PageTables look nice, but you can't add pages that already exist outside the table. (I saw @Macrura's post in on Nov 25, 2014, but I'm not clear where that code would go. Is there some guidance as to what page relationship type to use where? What would others use for the classes in my diagram? Also, a related issue: when is it best to just use the tree in the back end for admin tasks vs. using admin pages and Process Modules? It seems to me that the tree approach involves less coding, but requires a more tech-savvy user than a custom-coded admin page. Thanks in anticipation of suggestions (and corrections of any misunderstandings on my part).
-
Aha! I've worked out how to do that now, by adding the 'permission' item in the getModuleInfo array. I didn't see that in the tutorial ? , which is excellent BTW.
-
Thanks @fbg13. I have seen those and have been building some process modules using the tutorial - which is working well. Am I to understand that I have to explicitly code the access rights into each process module using the API? I was hoping that PW would allow me to use the users-roles-permissions menu in the normal way.
-
Thanks for all the help. I'm still scratching my head over the above question, perhaps better explained by: Any ideas how to do this? Thanks.
-
Finally got it working after re-installing ProcessWire locally using Bitnami. With that installation (in xampp/apps/processwire) the url needs to be {domain name}/processwire not just {domain name}. The issue as to whether multi-site is a good idea or not remains. I guess if I have problems I can always split them onto different installations.
-
Having decided to migrate to PW (one at a time) most of the half-dozen sites I manage, I thought that a multi-site (option#1 in https://processwire.com/api/modules/multi-site-support/) installation would be best as I would only have to do one upgrade each time (as well as saving a little space). So I set that up on the hosting service I use (two sites initially) and downloaded everything to my local (Windows 10) machine. Locally, I use XAMPP and PhpStorm. I put the ProcessWire directory (with both sites and Wire) into htdocs. The site in the /site/ directory works fine using the localhost/processwire url, but whatever I try in the index.config.php file, I cannot get the second site to show - it always falls back to /site/ (because of the '*' => 'site', entry). Let's say the second site is in /site-new/ . How do I configure index.config.php to get that to launch locally? At the moment, my work-round is to change the name of the "catch-all" site to be whichever site I am working on, which is a bit clumsy. Or would I have been better not to go multi-site at all? Thanks for any insights.