ryan Posted June 3, 2016 Share Posted June 3, 2016 Working through GitHub issue reports was the focus of this week, and it looks like we've got one more week to go in working through the current queue. There have not been any major bugs in 3.x, so things are looking more and more stable. Most updates in this weeks version (3.0.20) are about fixing minor bugs and various cosmetic things. There's nothing particularly exciting to report in this version other than that. But working towards a fully stable 3.x master version is itself an exciting thing. So rather than focus on the small tweaks and fixes from this week, lets backtrack and review all that's new in 3.x relative to the current 2.7 master version… https://processwire.com/blog/posts/review-of-processwire-3.x-so-far/ 16 Link to comment Share on other sites More sharing options...
Can Posted June 4, 2016 Share Posted June 4, 2016 I'm really looking forward to "multi-instance" docs No pushing..just letting everybody know about my interest hehe 1 Link to comment Share on other sites More sharing options...
cstevensjr Posted June 4, 2016 Share Posted June 4, 2016 I'm really looking forward to "multi-instance" docs No pushing..just letting everybody know about my interest hehe +1 on the Multi-Instance feature and documentation. 1 Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 4, 2016 Share Posted June 4, 2016 Until Ryan can come up with something more elaborate I'll just share a snippet of him here. In template files you'll just need the part beginning with $config2 …. <?php namespace ProcessWire; // This file is named /nstest/multi-instance.php // and it exists in the first test installation // loaded at: http://localhost:8888/nstest/multi-instance.php echo "<pre>"; include("./wire/core/ProcessWire.php"); // Test first instance: /nstest/ $config = ProcessWire::buildConfig(__DIR__); $wire = new ProcessWire($config); $items = $wire->pages->find("id>0, include=all"); foreach($items as $item) { echo "$item->url\n"; } echo "\n---------------------\n"; // Test second instance /xyz/ $config2 = ProcessWire::buildConfig(realpath("../xyz/"), '/xyz/'); // LostKobrakai: Not sure, but I need this next line for it to work $config2->paths->modules = $config->paths->modules; $wire2 = new ProcessWire($config2); $items = $wire2->pages->find("id>0, include=all"); foreach($items as $item) { echo "$item->url\n"; } echo "\n---------------------\n"; // Test first instance again foreach($wire->pages->find("body*=about") as $item) { echo "$item->url\n"; } A working example of that is running here, where the images are pulled from my photography page: https://www.kobrakai.de/ Edit: Now it's also visible (missed to uncache the page). 3 Link to comment Share on other sites More sharing options...
Can Posted June 4, 2016 Share Posted June 4, 2016 Wow, looks good thanks a lot..tried to get some ideas how to do multi-instance from core but couldn't get any clue.. Will try your code as soon as possible Gracias Link to comment Share on other sites More sharing options...
Can Posted June 8, 2016 Share Posted June 8, 2016 Tried your code finally myself On the front end it works..but it kicks me out of admin and won't let me in anymore..just keeps showing login form..no log messagea as far as I can tell at least not in pw admin.. got this in /site/init.php $config2 = ProcessWire::buildConfig(realpath("../../happygaia8meta/"), 'http://www.hg8meta.dev'); $config2->paths->modules = $config->paths->modules; $wire->wire('happyMeta', new ProcessWire($config2)); after commenting this block out all good again.. Anybody a hint on that? Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 8, 2016 Share Posted June 8, 2016 You probably need to use different sessionNames for those sites (you can find the exact setting in wire/config.php) so it won't overwrite your session cookie, but I'm not 100% positive. Link to comment Share on other sites More sharing options...
Can Posted June 8, 2016 Share Posted June 8, 2016 Thought the same but the referenced page "happygaia8meta" got wire as session name whereas the requesting first page native php session_name() so this should be an issue right? Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 8, 2016 Share Posted June 8, 2016 If you haven't changed the sessionName it'll always default to 'wire'. Link to comment Share on other sites More sharing options...
Can Posted June 8, 2016 Share Posted June 8, 2016 (edited) In the first requesting page I'll set $config->sessionName = session_name(); in config-dev.php (and I'm on dev)And to make sure I just changed the session name of hg8meta.. Noticed that the requesting page is setting PHPSESSID and after first login try hg8meta cookie too..guess that's right because it's booting that second page too right? UPDATE interestingly // doesn't work $config->sessionName = 'hg'; // works, even though PW usses session_name itself $config->sessionName = session_name('hg'); Edited June 8, 2016 by Can Link to comment Share on other sites More sharing options...
Can Posted June 14, 2016 Share Posted June 14, 2016 Would be awesome to get this working properly errors.txt is telling me about compile errors failed opening required php from one of my custom modules which is placed in secondary pw instance, so the one I'm trying to connect to.. feels like it should be possible without matching $config2 modules to $config modules..but without this line I'm getting Compile Error: Cannot redeclare class ProcessWire\FieldtypePage both ar 3.0.21 right now and the hosting instance trying to pull $config2 is fresh install without anything changed.. Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 14, 2016 Share Posted June 14, 2016 You cannot load two modules (instance one / instance two) which are using the same classname. That is why my fix is preventing the other core modules from being loaded. It's the same issue if you'd use a site module on both installs. Probably the only way to really load each instances separately with all it's own modules and classes would be compiling at least one into a separate namespace. And that's not starting to talk about third party composer libraries, which might be part of both installations and worst case even in different versions. – It's not the kind of easy topic it seems to be. Link to comment Share on other sites More sharing options...
Can Posted June 14, 2016 Share Posted June 14, 2016 Hmm, maybe not getting you right..I basically get what you mean, but the pulling instance hasn't any site modules so there shouldn't be any collisions Here's the actual error Compile Error: require_once(): Failed opening required '/NEWINSTANCE/site/modules/HappyModules/HappyNotes.php' (include_path='.:/Applications/MAMP/bin/php/php5.6.7/lib/php') (line 36 of /OLDINSTANCE/site/modules/HappyModules/HappySubscriber.module) So the new instance (no modules, no customizations, templatefiles or the like so far) isn't able to open HappyNotes.php which is of course not in it's site/modules and this instance is not including anything (besides core stuff of course)And this happens with your fixWithout the fix I get a collision error (Cannot redeclare class Processwire\FieldtypePage).. Last time (other installation) it worked, I just wasn't able to login anymore..but at least I could import some pages etc from old instance.. Link to comment Share on other sites More sharing options...
Can Posted August 14, 2016 Share Posted August 14, 2016 Finally! http://processwire.com/blog/posts/multi-instance-pw3/ Working just as described for me =) (site note: I've both installs running on 3.0.30) 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now