-
Posts
24 -
Joined
-
Last visited
Everything posted by David Beesley
-
Hi @BitPoet Thanks again for you work on these modules. I have it all installed, the two server components on a Blank install of Processwire, and the two client components on a test version of a current client site. Both sites are hosted on an internet visible server (on the same IP address). I have configured both ends, but they aren't talking to each other. When I click "Connect/Refresh Server" on the client website it alerts "Invalid or empty response from server" I have added some screenshots of my configs with sensitive data removed. But the client secret and ping from server have never had any data in them
-
Hi All, Say I have a set of pages from the API. What is the easiest way to to get all unique values from a given text field on each page?
-
Some cracking solutions folks. Cheers
-
Hi All, We have a client with a requirement to change the content of one of their pages at midnight on a given day. I understand there is a module for scheduling the publishing and unpublishing of entire pages, but his would require two separate pages and urls, not good for SEO. Is there a way/module to schedule changes to a given field on a page?
-
Creating thousands of pages via the API
David Beesley replied to David Beesley's topic in API & Templates
@diogo Thanks for the update. I'll be honest with you, like most things in this profession I have inherited it from a predecessor and that bit was working so I left it alone. I have done loads of micro-optimisations through this process, so may add yours to it. I'm now also thinking that because debugging is off, and was the primary cause of the memory bloat (I hate the term memory leak), I may not need the multiple nulls, unsets and forced garbage collector cycles. -
Creating thousands of pages via the API
David Beesley replied to David Beesley's topic in API & Templates
@BitPoet I owe you an apology. I hadn't turned debug off properly. Once I did that the memory usage held between 25Mb and 40Mb. A drastic reduction -
Creating thousands of pages via the API
David Beesley replied to David Beesley's topic in API & Templates
Hey @netcarver Thanks for bringing WireQueue to my attention I'll have a look through the forum thread to see how this could be implemented in my case. @BitPoet I have tried turning debugging off and I end each foreach loop thusly $page = null; // null out page object unset($page); // remove pointer to page object (null) in memory wire('pages')->uncacheAll(); // clear the page cache gc_collect_cycles(); // force invoke the garbage collector But there is no discernible change in memory usage @kongondo I'm unsure how I would implement your example. My page creation process is $page = wire('pages')->get("parent={$parent_page->id}, this_id={$page['id']}"); // where this_id & $page['id'] are this entities id in the api if(!$page->id) { // CREATE new page $new_page = new Page(); ... // Some generic fields // save $new_page->save(); $page = wire('pages')->get($new_page->id); // Set my page object to this new page } ... // Set some more fields based on API data // save $page->save(); (nulling and unsetting omitted for clarity) Thanks all for your help so far. This is a great community -
Creating thousands of pages via the API
David Beesley replied to David Beesley's topic in API & Templates
No joy I'm afraid memory usage BEFORE page creation: 19656360 memory usage AFTER page creation: 19735712 memory usage BEFORE page creation: 19735712 memory usage AFTER page creation: 19815680 memory usage BEFORE page creation: 20493800 memory usage AFTER page creation: 20652664 -
Creating thousands of pages via the API
David Beesley replied to David Beesley's topic in API & Templates
I have tried using wire('pages')->uncacheAll(); That didn't seem to do anything. I'll try your more fine grained approach. -
Hi All, On one of our PW sites, we are importing data from an external API into the processwire database. The import contains around 450 "Objects" and on average each of these objects has around 20 sub-objects. This means I am creating around 9,500 pages during the initial full import (subsequent imports only make amends and additions) The problem here is I seem to be hitting the php memory limit. I have already upped it to 256Mb, and don't really want to up it further. I am nulling and unsetting everything I feasibly can, so the memory bloat now appears to be in the process of page creation. I am nulling the object after each page is fully saved, and can see the destructor method is running. So cannot fathom why I have this memory bloat. The bloat appears to be around 120kb, per page created. Which means currently I'd need over 1Gb dedicated to this process for it to complete. Is there something I have missed?
-
Hi folks, I have been asked by Pete (my boss) to pick up the ball and run with it, as he is quite keen to have a centralised solution for monitoring versions and updates. Having worked with Wordpress, Perch and Umbraco in my time, I must say this is the nicest CMS I have has the joy of using (Perch is a very close second). It seems to be very well maintained by a core of hard working individuals, but has yet to reach the size where it is a target for crackers and script kiddies. That said, with it being our CMS of choice, we don't want fragmentation to be come a problem. I remember the groans that went around the office of a former employers when we needed to make a change to an Umbraco 4 website. I'd be interested to know if anyone has had any success with developing a solution for this? @BitPoet thanks for being so pro-active and working on a prototype, although it looks like you haven't had chance to make a commit to it since January. Understandable, you have to pay the bills and keep the lights on rather than maintaining a side project for some guys you have never met. Perhaps we could have a quick chat on Slack, DM or similar about the project and see if we can pick it up and help develop a solution with/for you? In the meantime, I'll have a good poke around and see how it works on a test installation. Thanks all
-
Javascript in Processwire Admin tab
David Beesley replied to David Beesley's topic in Module/Plugin Development
This will only be client facing, and we have outlined that we will not be supporting below IE9. So based on the can i use stats, we are fine with DOMContentLoaded http://caniuse.com/#feat=domcontentloaded -
Javascript in Processwire Admin tab
David Beesley replied to David Beesley's topic in Module/Plugin Development
I have worked around it now, but adding an event listener for DOM ready document.addEventListener("DOMContentLoaded", function(event) { var app = document.getElementById('app'); app.innerHTML = '<p>It Works</p>'; }); -
Hi All, I am developing an admin tab for a site using Ben Byford's tutorial here -> https://webdesign.tutsplus.com/tutorials/extending-the-processwire-admin-using-custom-modules--cms-26863 So far so good, it's working and showing me some content. The ultimate aim for this is to be an interface with an external API. So I am looking to develop it as a mini Vue.Js single page app. I can inject the javascript for the app using the following code in my template $config = wire('config'); $config->scripts->add($config->urls->templates . "scripts/app.js"); The javascript is currently just grabbing a div with the id "app" and inserting "Hello World". 'use strict'; var app = document.getElementById('app'); app.innerHTML = '<p>Hello World</p>'; The problem is, presumably because the JavaScript is injected into the HEAD. I'm not grabbing the element 'app', app.js:4 Uncaught TypeError: Cannot set property 'innerHTML' of null Can anyone suggest a better approach for adding JavaScript to the admin area?
-
add support for progressive JPEG
David Beesley replied to Martijn Geerts's topic in Wishlist & Roadmap
Can I bump this? Or could someone point me to where it has been added if it already has? -
Multiple Environment Configuration
David Beesley replied to David Beesley's topic in Themes and Profiles
Wow @LostKobrakai that looks like exactly what we will need. -
Multiple Environment Configuration
David Beesley replied to David Beesley's topic in Themes and Profiles
A Secondary question. Is there any way to force the installer to have the "Delete .gitignore" option unchecked by default? I have placed a project specific gitignore in our base project -
Hi All, I am in the process of creating a base processwire setup for our company. This will include boilerplate templates, a sass/css framework and some common config settings. I have remove the bundled site profiles and will build ours out using the default one as a jumping off point. As part of this, I am trying to add a switch statement to the config.php files to store database details for all three environments the site can exist in (Dev, Stage, Production). switch (strpos($_SERVER['HTTP_HOST'])) { // Local Development Environment (MAMP) case 'name.project' : $config->dbHost = 'localhost'; $config->dbName = ''; $config->dbUser = ''; $config->dbPass = ''; $config->dbPort = '3306'; break; // Testing/Staging Environment case 'testdomain.co.uk' : $config->dbHost = 'localhost'; $config->dbName = ''; $config->dbUser = ''; $config->dbPass = ''; $config->dbPort = '3306'; break; // Live/Production Environment (domain.tld) case 'domain.tld' : $config->dbHost = 'localhost'; $config->dbName = ''; $config->dbUser = ''; $config->dbPass = ''; $config->dbPort = '3306'; break; } The installation process I originally envisaged was the once one of us had pulled down the base project, copied it to the project repo, pointed MAMP at it and setup a local database, they entered the dev database details and hostname in that case in the switch statement and ran the installer. I was hoping the installer would simply skip the part where you added the database details and populate the database and carry on. Instead, it throws an error that certain tables are missing but the installer was still present. My next approach was to leave the two other environments in the switch statement, run the installer and enter the database details like normal and hope it put the dev details straight after the comment /*** INSTALLER CONFIG ********************************************************************/ This would become the default, and then be overridden if the switch statement caught a case. However it inserts the entered details at the end of the file. Is there any way I can achieve one of the two goals above, or could anyone suggest an alternative approach? Thanks.
-
Crowdfunded Tinypng Integration Module
David Beesley replied to OllieMackJames's topic in Module/Plugin Development
@Roope Nice work. I have had a look at your GitHub repo. Is this production ready yet? And is it compatible with PW v3? -
In this scenario. The offers are short lived, and regularly replaced. So it hopefully shouldn't be an issue. That said, it's a valid consideration. I had considered a batch import of product data into PW via CRON. But that, I suppose, would have a similar issue if the product is removed it will be removed from PW. It's always the danger I suppose, when creating a replication of a data source. I'll take a look at creating an extension of Fieldtype/InputfieldSelect that get's its data from the API. Although perhaps an extension of a fieldtype with pagination may be a more user friendly solution when the product amounts get into the hundreds or more.
-
Kinda. I was thinking more about something that populates a field (most likely a select dropdown) from the API endpoint at the time you are editing the data. I assume I am going to have to write a module that does everything based on some kind of hook. https://processwire.com/api/modules/
-
Hi All, Second time poster, so please continue to go easy on me. I have a requirement to store some minimal data from an external API within ProcessWire, alongside some page data. Lets say I want to create a page of "Offers" but my products were stored externally and exposed to me via a REST API with the endpoint /products/all (assume we are authenticated) I would like to access the API from a repeater field in ProcessWire, show a list of "ID - NAME" and then store the external ID alongside some manually inputted data. This ID could then be used at a later date for any other sort of work with the external API. What would be the best approach to create a field for this? If it is even possible? Thanks, Dave
-
Perfect LK. Thanks very much
-
Hi All, First time poster, so please go easy on me. I am trying to write a small block of code so that if that if the page I am on doesn't have a "Hero Image" it will traverse up the tree until it finds a page that does have one. I am attempting to utilise $page->parentsUntil() to do so. Am I on the right track? if (!empty($page->hero_gallery)) { $hero_images = $page->hero_gallery; } else { $hero_images = $page->parentsUntil("hero_gallery!=''")->hero_gallery; } This code is currently returning nothing