Jump to content

horst

PW-Moderators
  • Posts

    4,088
  • Joined

  • Last visited

  • Days Won

    88

Everything posted by horst

  1. @Tyssen sent you a PM.
  2. I have understand right, there is only one image field in use in how many pages, ca.? Maybe best bet would be also to create a test template with a new image field of type cai3, create a page and test things out. If this does work but the old one not, this would be good. If the new created one will not work too, this would be a greater disaster, I believe. On a side note: file access rights for image variations are correct? I have to leave office now for some hours, but will come back later here.
  3. There are different ways described in the thread how to upgrade from previous version. PW-versions and the Crop-modules! Have you followed them? Which was the origin PW version? Wich Crop modules was installed and used in the origin version? How have you updated the module, the user roles, the image fields? Without that information, it is hard to tell anything useful.
  4. I played around with multi-instances and found out that we currently (PW 3.0.163) are not able to use multiple instances when more then one site has set $config->useFunctionsAPI (in site/config.php) to true! Then I saw that, (when $config->useFunctionsAPI was set to false) in all instances $config->version returned the same version, that from the master instance. So, first I was a bit confused, but then I thought that this may have to do with the early step when PW processes/build the $config. And indeed, if I set in all site/config.php files the $config->useFunctionsAPI to false, and then in all site/init.php files to true, everything is working fine. Now we can use our sites with the functions API, and we can load as many multiple instances in parallel we want. ? TL;DR site/init.php /** * FOR BETTER SUPPORT OF MULTIINSTANCES, WE ENABLE $config->useFunctionsAPI HERE, * INSTEAD OF THE site/config.php FILE: */ $wire->config->useFunctionsAPI = true; Bootstrapping three different instances, in first step each of them in a single environment: <?php namespace ProcessWire; if(!defined('PW_MASTER_PATH')) define('PW_MASTER_PATH', 'E:/laragon/www/hwm/'); if(!defined('PW_MASTER_HTTPURL')) define('PW_MASTER_HTTPURL', 'https://hwm.local/'); // bootstrap ProcessWire instance site1 (3.0.163) require_once(PW_MASTER_PATH . 'index.php'); mvd([ 'httpurl' => $wire->wire('pages')->get(1)->httpURL, 'instanceNum' => $wire->getInstanceNum(), 'config->version' => $wire->wire('config')->version, 'useFunctionsAPI' => $wire->wire('config')->useFunctionsAPI ]); When running all three in a multi instance environment, they load fine, (no compile error), all with the use for the functions API enabled: <?php namespace ProcessWire; if(!defined('PW_MASTER_PATH')) define('PW_MASTER_PATH', 'E:/laragon/www/hwm/'); if(!defined('PW_MASTER_HTTPURL')) define('PW_MASTER_HTTPURL', 'https://hwm.local/'); if(!defined('PW_SITE2_PATH')) define('PW_SITE2_PATH', 'E:/laragon/www/hwm2/'); if(!defined('PW_SITE2_HTTPURL')) define('PW_SITE2_HTTPURL', 'https://hwm2.local/'); if(!defined('PW_SITE3_PATH')) define('PW_SITE3_PATH', 'E:/laragon/www/hwm3/'); if(!defined('PW_SITE3_HTTPURL')) define('PW_SITE3_HTTPURL', 'https://hwm3.local/'); // bootstrap ProcessWire master instance (3.0.163) require_once(PW_MASTER_PATH . 'index.php'); mvd([ 'httpurl' => $wire->wire('pages')->get(1)->httpURL, 'instanceNum' => $wire->getInstanceNum(), 'config->version' => $wire->wire('config')->version, 'useFunctionsAPI' => $wire->wire('config')->useFunctionsAPI ]); // create a secondary instance from master (3.0.163) $wire = new \ProcessWire\ProcessWire(PW_MASTER_PATH); mvd([ 'httpurl' => $wire->wire('pages')->get(1)->httpURL, 'instanceNum' => $wire->getInstanceNum(), 'config->version' => $wire->wire('config')->version, 'useFunctionsAPI' => $wire->wire('config')->useFunctionsAPI ]); // create instance of a second site (3.0.162) $site2 = new ProcessWire(PW_SITE2_PATH, PW_SITE2_HTTPURL); mvd([ 'httpurl' => $site2->wire('pages')->get(1)->httpURL, 'instanceNum' => $site2->getInstanceNum(), 'config->version' => $site2->wire('config')->version, 'useFunctionsAPI' => $site2->wire('config')->useFunctionsAPI ]); // create instance of a third site (3.0.152) $site3 = new ProcessWire(PW_SITE3_PATH, PW_SITE3_HTTPURL); mvd([ 'httpurl' => $site3->wire('pages')->get(1)->httpURL, 'instanceNum' => $site3->getInstanceNum(), 'config->version' => $site3->wire('config')->version, 'useFunctionsAPI' => $site3->wire('config')->useFunctionsAPI ]);
      • 13
      • Like
  5. In this post (https://processwire.com/docs/start/api-access/) Ryan says So, this has made me thinking it should be. Also I tried setting it on the fly to false before creating the second instance. But I had not verified that it was definetly disabled. Now after writing it into all site/config.php files, the error is gone and I get multiple instances. But I encountered a new weird thing: I loaded three instances with the PW versions 3.162 + 3.0.160 + 3.0.155. But when executing this code, every instance shows me the 162 !! ?? ? // bootstrap ProcessWire master instance require_once(PW_MASTER_PATH . 'index.php'); mvd($wire->getInstanceNum() .' # '. $wire->config->version); // echo instance and version of the master (expected: 3.0.162) $wire = new \ProcessWire\ProcessWire(PW_MASTER_PATH); mvd($wire->getInstanceNum() .' # '. $wire->config->version); // echo instance and version of the new created instance from master (expected: 3.0.162) $site2 = new ProcessWire(PW_SITE2_PATH, PW_SITE2_HTTPURL); mvd($site2->getInstanceNum() .' # '. $site2->config->version); // echo instance and version of site2 (expected: 3.0.160) $site3 = new ProcessWire(PW_SITE3_PATH, PW_SITE3_HTTPURL); mvd($site3->getInstanceNum() .' # '. $site3->config->version); // echo instance and version of site3 (expected: 3.0.155) die('RIP');
  6. Hi all, I tried to run two instances of pw that resides in parallel directories of the same server. I've done like it was explained in a older blog post (around PW 3.0.32) and it throughs me a compile error, regardless if in web environment or on CLI. <?php namespace ProcessWire; if(!defined('PW_MASTER_PATH')) define('PW_MASTER_PATH', 'E:/laragon/www/pw1/'); // PW 3.0.162 if(!defined('PW_MASTER_HTTPURL')) define('PW_MASTER_HTTPURL', 'https://pw1.local/'); if(!defined('PW_SITE2_PATH')) define('PW_SITE2_PATH', 'E:/laragon/www/pw2/'); // PW 3.0.160 if(!defined('PW_SITE2_HTTPURL')) define('PW_SITE2_HTTPURL', 'https://pw2.local/'); // bootstrap ProcessWire master instance require_once(PW_MASTER_PATH . 'index.php'); // create a second instance $site = new ProcessWire(PW_SITE2_PATH, PW_SITE2_HTTPURL); // or: new ProcessWire(PW_SITE2_PATH); The error is: Compile Error: Cannot redeclare pages() (previously declared in E:\__PW-DISTRIS\wire-3.0.162\core\FunctionsAPI.php:63) (line 63 of E:\__PW-DISTRIS\wire-3.0.160\core\FunctionsAPI.php) So, is there a newer / other way nowadays to create a second instance?
  7. But is the parent page there in your target system? If not, would you mind to simply create it first? Otherwise I don't get what you are asking for.
  8. Don't know this feature, but whats about: different PHP versions local and online? (or: different PHP extensions local and online?, that may be invoked by processing a base32 string.)
  9. There are related posts in the forums: just search for deepl in g**gle, specifying the PW sites forum. https://www.google.com/search?q=site%3Aprocesswire.com%2Ftalk+deepl BTW: the deepl service has to be paid, AFAIK.
  10. What is in /site/templates/resultado.php on line 23 , ... and maybe the two lines before and after?
  11. Are you sure that it outputs plain text? Maybe it is html entity encoded by a defined Text Formatter in your field. You can check this under Fields > NameOfYourField > Details the first point is "Text Formatter". If there is something selected like HTML entity encoder, htmlspecialchars, then remove it and try again, (after a browser cache flush).
  12. Ah, you are talking of the secondary languages path name. So, as it is the Homepage, what resides in the root, you previously have set it and now have to change it in the homepage under Settings Tab > Name:
  13. Check the site/assets/files/{ID-OF-YOUR-LANGUAGES}/ directories and delete all zip or json files belonging to the languages. Looks like there's some junk left over from all your trying. ? Or you messed a bit with the core and site translation files (?) Edit: you may go under fields -> filter; allow system fields; YES, then you see the fields language_files and language_files_site. If you click to edit them, you can on tab input and tip the checkbox near Overwrite existing files (at least while experimenting).
  14. Maybe not exactly what you are after, but ... You can dynamically enable / disable session (cookies ?) like this in site/config.php // DISABLE COOKIES FOR FE ONLY, AS WE NEED COOKIES ON THE BE (!) $config->sessionAllow = function($session) { // if there is a session cookie, chances are user is logged in if($session->hasCookie()) { return true; } // if requested URL is an admin URL, allow session if(isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/processwire/') === 0) { return true; } // otherwise disallow session return false; };
  15. Working until late night isn't always productive. ? watch: { options: { //event: ['added', 'changed', 'deleted'], // 'all' livereload: true, spawn: false }, styles: { files: ['localdev/styles/**/*.scss'], tasks: ['sass', 'postcss'], // , 'cssmin'], // ^^ while temporary switching between cssnano an cssmin, I finally forgot to register cssmin in "watch" options: { event: ['added', 'changed', 'deleted'] } }, So everything makes sense again. ?
  16. Hey all, I have setup a local dev workflow that used postcss (grunt-postcss) with the cssnano processor for finally minifying the css. But this broke a part of my css. So I switched to cssmin (grunt-contrib-cssmin). This does not brake my css when minifying but it get not invoked when the tasks get started through grunt watch. When I manually call grunt, all gets processed. I post my files below. Does anybody have an idea what I'm doing wrong? Gruntfile.js package.json
  17. Maybe the ProMailer can help out?
  18. Hi, for better readability and more stability in edge cases, I would use the $config->paths->get("NameOfMyModule") syntax to get the exact matching path to your modules root directory. This is working even if someone, for example, dropped in the module from zip from github and the directory name became something different like "NameOfMyModule-master". I only would use this in front- and back end. $includeFilename = $config->paths->get("NameOfMyModule") . 'css/style.php';
  19. I would go this way, without invoking ready.php or other resources: <div class="grid"> <?php foreach($page->grid_ext as $item): ?> <div id="pteg_<?= $item->id ?>"> <?php // specify the template viewfilename like this, if it is a single viewfile: $viewFilename = $wire('config')->paths->templates . 'blocks/myblockviewfile.php'; // or if you have different files get them from template properties: $viewFilename = $item->template->altFilename ? $item->template->altFilename : $item->template->name; $viewFilename = $wire('config')->paths->templates . 'blocks/' . $viewFilename . '.' . $wire('config')->templateExtension; // check if viewfile is available if(!is_readable($viewFilename)) { echo logSectionError('Missing Template-View-File!', '<strong>' . basename($viewFilename) . '</strong>'); continue; } // now pack a bag with all needed variables for the block render template file: $viewBag = []; $viewBag['item'] = $item; $viewBag['page'] = $item; // if you use the $page var in your template file, pass here the current item-page to it ! $viewBag['pages'] = $pages; // optionally if you need other vars, add them here $viewBag['config'] = $config; // " // and render the block echo "\n " . wireRenderFile($viewFilename, $viewBag); ?> </div> <?php endforeach; ?> </div> https://processwire.com/api/ref/functions/wire-render-file/
  20. Hi @elabx, thanks for the suggestion. I finally came up with a solution combining the hook and special names in the template flags. So with my example from above, I add a tag with the name allowedonly4-basic-b to the template that should be allowed only in the sub directory of basic-b, but not in other sub directories. $wire->addHookAfter('ProcessPageAdd::getAllowedTemplates', function($event) { $pages = wire()->pages; $parent = 'sub' == $pages->get(wire('input')->get->parent_id)->template->name ? $pages->get(wire('input')->get->parent_id)->parent() : new NullPage(); if(0 == $parent->id) return; $templates = $event->return; foreach($event->return as $template) { foreach(explode(' ', $template->tags) as $tag) { if('allowedonly4-' == substr($tag, 0, 13) && substr($tag, 13) != $parent->template->name && isset($templates[$template->id])) { unset($templates[$template->id]); } } } $event->return = $templates; }); With this combination I now can create templates allowed only for one or two defined sub directories.
  21. This is weird. Please can you post an issue on GitHub with this, so that Ryan gets informed about it?
  22. Have you also tried this: $page->image->width(1280)->webp()->url
  23. If you only need a single word, whats about $session->forceLogin('aSingleWord')? The you need to present a single input type text in the front end, check if the typed word matches a harcoded one an then use forceLogin().
  24. @antpre is it not possible to use one generic username? I know sites with download sections for press and they have a user named press with a good human readable password.
  25. Not both! - either TLS or SSL
×
×
  • Create New...