Marc

Members
  • Content count

    72
  • Joined

  • Last visited

Community Reputation

17 Good

About Marc

  • Rank
    Full Member

Profile Information

  • Gender
    Male
  • Location
    Netherlands

Recent Profile Visitors

1,597 profile views
  1. Has anyone managed to overwrite the cache path and URL? It does not seem to work so all sites will be sharing the same cache, which might be problematic. Edit: looks like template cache does use the custom cache path/URL and other forms of cache use the default cache folder.
  2. I really like what you guys came up with here, I think I'm going to implement this on a bunch of websites. One thing to note is that when you are using multi-instance like I do, and you connect from a PW site that is not part of your 'multisite' setup, the $_SERVER['HTTP_HOST'] condition in config.php won't trigger and you will not get the data you are after. One way to get around this is to create the instance like this: $site = new ProcessWire('/srv/users/me/apps/website/public/', 'http://website.dev/'); Adding the domain as the second parameter will set a variable called $httpHost (to 'website.dev' in my example) in wire\core\ProcessWire.php which is available to config.php. Therefore, if you alter the condition in config.php to this, multi-instance should work: if ($_SERVER['HTTP_HOST'] == 'website.dev' || $httpHost == 'website.dev') { $config->dbName = 'name'; $config->dbUser = 'user'; $config->dbPass = 'pass'; //etc } I have not tested this extensively but it seems to work fine.
  3. Thank you, that's it of course I was using the wire way at first but searching the forums I noticed someone using $event object for this so I decided to give it a try, not really understanding the differences.
  4. I am trying to make a simple wiredata module that lets me select a page I want all visitors to be redirected to. I have this working in ready.php but then I decided on putting it in a module and I can't get it to work. Here's the relevant bits: public function ready() { $this->addHookBefore('Page::render', $this, 'redirectUsers'); } public function redirectUsers(HookEvent $e) { $page = $e->object; // The page we want to redirect to. $redirect = $e->pages->get($this->redirectPage); if ($page->id == $redirect->id) return; // Prevent infinite loop. if (!$e->user->isLoggedin()) { $e->session->redirect($redirect, false); // 'false' indicates 302 temp redirect. } } I left some checks out for simplification. Whenever I'm not on the page that I want to redirect to, an infinite redirect loop starts. Could anybody explain why that is?
  5. I have setup two websites, A and B. A can read pages from B using the multi-instance API. But how do I get A to save a new page to B? I have this simple test setup: $path = "C:/Users/Marc/Documents/development/www/siteB/"; $url = "/siteB/"; $siteB = new ProcessWire($path, $url); $np = new Page(); $np->template = "my-template"; $np->parent = $siteB->pages->get('/forms/'); $np->title = 'test multi-instance form'; $np->save(); The page is saved to site A instead of B, with no parent. Is this a case of saving it to the wrong instance? If so, how do I save it to the correct instance (site B)?
  6. Thanks, gonna try this out
  7. Is it possible to temporarily overwrite the smtp host and smtp user defined in settings with the API? I would like to send some emails using a different smtp server with different credentials from the one I entered in the module settings.
  8. I read that post but I was confused by it. But now understand: I need to open the site/modules/PageImageManipulator folder that was downloaded by PW and remove the module files that are not PageImageManipulator02 and then install it. Thanks for the module!
  9. This module is not working for me on PW 3.0.58. I'm trying to convert PNG to JPG. When I do $img->pim2Load('template')->setOptions($options)->width($img->width())->pimSave() I get a fatal error: When I use pimLoad instead of pim2Load, there's no error and JPG's are generated. But since I'm on PW 3, I should use pim2Load. I'm calling the function in one of my templates. Any idea as to why pim2Load would not be working?
  10. Looks like this can be resolved by making sure the same modules are installed on both websites. (Just like Ryan mentions in the docs...)
  11. I'm working on a process module that connects to another ProcessWire 3.0.54 installation on the same (local) server (both sites running 3.0.54). I'm trying to use multi-instance for this, so: namespace ProcessWire; $path = "C:/Users/Me/Documents/development/www/pw3/"; $url = "http://www.test.me"; $site = new ProcessWire($path, $url); Those simple three lines generate the following error: I'm probably missing something obvious here as I don't have much experience with namespaces yet. Any suggestions?
  12. Finally set up my Vagrant testing environment (provider Virtualbox) running a Ubuntu 14.04 server with PHP 7.1 with Nginx in front of Apache. I'll mimic Soma's report: PW2.7.3 TTFB Chrome: ~28ms PW3.0.42 TTFB Chrome: ~40ms Those are new installs of intermediate profiles without modifications. I will look into the other numbers later.
  13. Thank you Ryan for the detailed response. Given all of the optimizations you mention it is indeed quite strange myself and a few others are seeing this behavior. I'm using the most basic way of testing which is Chrome dev tools and repeatedly refreshing the page to inspect the load times. Doing this with unmodified and brand new intermediate profile installations of Processwire 2.7.3 and 3.0.42 I see the 30% difference in load times. By unmodified I mean I haven't changed a single template or page that is installed by default. I only modified config.php to connect to my database, everything else is untouched (no extra modules). This is on a Windows machine with Xampp running PHP 7.0 on an SSD drive and a remote database connection (which is surely slowing things down but it should be slowing both the PW 2 and 3 database connections equally I imagine). I will setup a different development environment at home later today or tomorrow that is Vagrant/Ubuntu-based and repeat the test. To be honest I'm expecting no difference as I've already seen similar degradation on my production server where I uploaded a site that I upgraded to PW 3 (which has load time differences of up to 100%, ouch). I should note that adding $config->moduleCompile = false to the PW 3 site makes no difference.
  14. I agree, that is suspicious and maybe I am jumping to conclusions. However in trying to rule out my local setup I uploaded my upgraded website to my server and saw the exact same degradation in speed. Which disappointed me greatly because I was really hoping it was just my local XAMPP setup causing this.