-
Posts
4,077 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
@ryan there is still one of my very first PW projects, the MP3-DB site profile, which doesn't work with any PW 3 version (or newer PHP versions ?). I've been wanting to put the essence of it into a module for quite some time, so that one can add MP3-DB support to any existing site with ease. It seems that I'm getting a bit closer to the goal thanks to your new features, because it will be much less work if partial file delivery and delivery of specific byte ranges and seeking is now natively supported by PW! ? When starting with it (maybe around christmas this year), I will contact you before.
-
Working fine from here, germany, via hoster netcologne and also routed over different IPs via VPNs like PureVPN and CyberGhost. @clsource and btw, nice work! ?
-
Looks like ImportPagesCSVData is null or empty here, when an array or countable object is expected. Have you checked that your data import results in more then 0 valid records?
-
Do you have enabled the Imagemagick rendering engine in PW? You also may set strictly use the webp variation, also if the jpeg or png source is smaller in filesize. This is not often the case, but its possible. site/config.php: $config->webpOptions = array_merge($config->webpOptions, [ 'quality' => 84, 'useSrcExt' => false, // Use source file extension in webp filename? (file.jpg.webp rather than file.webp) 'useSrcUrlOnSize' => false, // Fallback to source file URL when webp file is larger than source? 'useSrcUrlOnFail' => true // Fallback to source file URL when webp file fails for some reason? ]);
-
@NooseLadder ... or you take the easy way and get you a full copy of Laragon! It has everything you may need or not. Including One-Click-SSL-Certificates in your local dev environment to use and test full https protocol. And much more. ? see what others mean: site:processwire.com/talk laragon
-
See Line #7 in your Errorlog: site/modules/LoginRe ... gister
-
Flash of unstyled text in a special case of complex templatre rendering
horst replied to theoretic's topic in API & Templates
Maybe you can wrap a output buffer around it, (in a site/_main.php) ? ob_start(); // do all your template and include code // and finally flush it to the browser all at once: echo ob_get_clean(); -
To be honest: I don't know. I don't know why you have this, and I don't know how to change this. ?
-
I think in its basic it can be something like https://www.php.net/manual/en/class.splobserver.php ?
-
module PrivacyWire - Cookie Management & async external asset loading
horst replied to joshua's topic in Modules/Plugins
Yep, too much freedom can be a big burden. ? -
module PrivacyWire - Cookie Management & async external asset loading
horst replied to joshua's topic in Modules/Plugins
The "processwirish way", IMO, is called hooking. Therefore the originals modules author need to add three underscores to a method name: "___myMethodName()". This method than can be hooked and its output changed. Joshua, if you would add three underscores to the public render() method, I think its all done. @The G then should be able to hook in (before or after) and changes the output the way he likes to. In this case it seems like a small autoloaded custom module should fit: class MyCustomModule extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => "MyCustomModule", 'summary' => "Customizes the output of PrivacyWire module", 'version' => "0.0.1", 'autoload' => true, 'singular' => true, 'requires' => [ "PrivacyWire", "PHP>=7.2", "ProcessWire>=3.0.0" ], 'icon' => 'cookie' ]; } public function ready() { $this->addHookBefore('PrivacyWire::render', $this, 'customRender'); } public function customRender(HookEvent $event) { // do your changes or complete override here // ... $myCustomOutput = $this->myHelperMethod(); $event->return = $myCustomOutput; } protected function myHelperMethod() { return 'something'; } } Not tested and I'm currently not perfect sure if its better to hook in before or after. (I think before, but you need to test it) TL;DR Other scenarios may be that the original modules author adds special hooking methods where an output finally is passed through. This function then optionally can be used for changes. // in PrivacyWire public function render(HookEvent $event) { ... $output = 'something'; $output = $this->finalizeOutput($output, $event); $event->return = $output; } public function ___finalizeOutput($output, $origEvent) { return str_replace("</body>", "{$output}</body>", $origEvent->return); } // in another module or site/ready.php, addHookAfter PrivacyWire::finalizeOutput -
If you need redirecting to the final domain name, you may have a look to this snippet. But you have to add it manually somewhere in the top of your root .htaccess file. ################################################################################ # Domain-Namen erzwingen # <IfModule mod_rewrite.c> RewriteEngine On AddDefaultCharset UTF-8 RewriteCond %{HTTP_HOST} ^example\.com [OR] RewriteCond %{HTTP_HOST} ^example-variation\.com [OR] RewriteCond %{HTTP_HOST} ^www\.example-variation\.com RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301] RewriteCond %{HTTPS} !=on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule> # ################################################################################
-
@teppo You already got setup by Kixe and Robin. So, only thing that I can contribute is, if you are using this in an environment that allows overwriting existing files with same filename, you should bind a check of last modified timestamps into your program logic: If fileFieldItem is image and not thumbnail exists: create a thumbnail If fileFieldItem is image and not thumbnail exists OR if origTimestamp is newer than thumbnailTimestamp: create a (new) thumbnail
-
Reviewer role: Permission to view unpublished pages?
horst replied to snck's topic in General Support
I think you have to hook into Page::viewable, then detect if user has role reviewer and page is unpublished. If yes, you can change the return to true. Please search for hook examples with Page::viewable here in the forums. There will be some available. Or you look into existing modules how it is done there, like this one: https://github.com/Sebiworld/PageAccessReleasetime/blob/master/PageAccessReleasetime.module.php#L182-L201 and here https://github.com/Sebiworld/PageAccessReleasetime/blob/master/PageAccessReleasetime.module.php#L241-L254 And you don't need to build a module, you can write the hook into the site/ready.php file.- 2 replies
-
- 2
-
- permissions
- user roles
-
(and 1 more)
Tagged with:
-
@Tyssen sent you a PM.
-
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.
-
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.
-
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 ]);
-
What is the actual way to start multiple instances? I get compile error
horst replied to horst's topic in General Support
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'); -
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?
-
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.
-
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.)
-
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.
- 1 reply
-
- 1