-
Posts
4,077 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
Hi @Ben Sayers, are you sure that you need to use the migration module for that onetime migration? For me it looks like you simply can run this example script once (with your fieldnames) and then you are ready. To do this, you can create a php file with a name you like, in your root directory, besides the index.php. Calling this script will bootstrap PW and do all your desired work. Here an example. NOTE: Not tested, written in the browser! Before running this, do a BACKUP-COPY of your database, so have option to roll back, when something went wrong. <?php namespace ProcessWire; // prepare server for continuous output if(function_exists('apache_setenv')) @apache_setenv('no-gzip', '1'); @ini_set('zlib.output_compression', 'Off'); @ini_set('output_buffering ', '0'); @ini_set('implicit_flush', '1'); @ob_implicit_flush(true); @ob_end_flush(); //if(isset($_SERVER['HTTP_HOST'])) header('Content-Type: text/plain'); // bootstrap PW require_once('./index.php'); // here you bootstrap PW, after that line you will have available the most PW variables and functions. if(!$user->isSuperuser()) { // when using those scripts online, I do secure them with forcing a login in the admin as Superuser, ... echo "ACCESS DENIED! ($user->name)"; exit(1); } elseif($user->isSuperuser() && 'horst' == $user->name) { // and where are multiple superusers registered, additionally limited to my username echo '<pre>'.$_SERVER['HTTP_HOST'].' :: '.basename(__FILE__)."\n"; $selector = " DEFINE YOUR SELECTOR HERE TO GET A PAGE ARRAY WITH YOUR PAGES "; $pa = $pages->find($selector); // or: $pa = $pages->findMany($selector); $max = count($pa); $cur = 0; foreach($pa as $p) { // loop over all collected pages set_time_limit(30); // renew the time limit for each loop, so that you may run this script long times, but lets it time out on failures in a reasonable short timeframe $cur++; // following do your work if(!$p->hasField('seo')) { continue; } echo " - [$cur / $max] {$p->title}\n"; $p->of(false); foreach (wire('languages') as $lang) { wire('user')->language = $lang; $title = $p->seo_title->getLanguageValue($lang); $desc = $p->seo_description->getLanguageValue($lang); $p->seo->meta->title = $title ?: 'inherit'; $p->seo->meta->description = $desc ?: 'inherit'; } $p->save(); $pages->uncacheAll($p); // after saving, uncahe the current page //die('BREAK!!'); // just when first test the script before processing all items } die('<p>READY!</p>'); } die('RIP');
-
Hi @szabesz Interesting workflow. Just a sidenote from me: if you want to start right now, you may store the new page class files within your workflow structure and additionally maintain the given site/classes directory by just give it proxy files that include or require the files from your internal structure. Just as a temporary workaround. And if Ryan cannot implement your request, it would be easy to use a script that scans and create / sync the proxy files directory for you in regard to portability. @ryan Well done! ?
-
@ryan many thanks for that useful piece of code. I used it a lot lately, also on sites that changed during my locally work. Therefor I need to adapt it a bit to first check if the remote file is available (and the optional use of basic auth). So, if it is of use for someone too, here it is: // use assets from remote host on demand for local development copies $wire->addHookAfter('Pagefile::url', function($event) { fetchRemoteAssetsToLocalDev($event); }); $wire->addHookAfter('Pagefile::filename', function($event) { fetchRemoteAssetsToLocalDev($event); }); function fetchRemoteAssetsToLocalDev($event) { if(!$event->wire('user')->isSuperuser()) return; // only my personal preference $config = $event->wire('config'); if(!$config->Remote2Local) return; // I set the domain name of a remote host in the site/config.php $remoteHost = 'https://' . $config->Remote2Local; // I always use https these days $file = $event->return; if('url' == $event->method) { $file = $config->paths->root . substr($file, strlen($config->urls->root)); // convert url to disk path } if(!file_exists($file)) { // download file from source if it doesn't exist here, but exist on source $src = $remoteHost . '/site/assets/files/'; $url = str_replace($config->paths->files, $src, $file); $http = new WireHttp(); if($config->Remote2LocalBasicAuth) { // optionally use basic auth with credentials from config.php $http->setHeader('Authorization', 'Basic '.base64_encode($config->Remote2LocalBasicAuth)); } // check if file exist on remote host $http->head($url, [], ['use'=>'curl']); if('404' != substr($http->getHttpCode($url), 0, 3)) { // file is available if($config->Remote2LocalBasicAuth) { $http->setHeader('Authorization', 'Basic '.base64_encode($config->Remote2LocalBasicAuth)); } $res = $http->download($url, $file, ['use'=>'curl']); } else { // file is missing, log it $event->wire('log')->save('remoteFetch404', $url); } } } // use assets from remote host on demand for local development copies
-
Hi, here is some code written in the browser that may do it. You should doublecheck if your $file variable is the right file basename! $p = $pages->get($album); // get the page $p->of(false); $p->images->trackChange('description'); // prepare page to keep track for changes $selectedImage = $p->images->getFile($fileBasename); // Get the Pagefile having the given !basename!, or null if not found. $selectedImage->description = "Test description"; // set new description $p->save('images'); // save the page $p->of(true);
- 3 replies
-
- 2
-
- description field
- frontend
-
(and 1 more)
Tagged with:
-
Module uninstall when Fieldtype is still in use?
horst replied to Gadgetto's topic in Module/Plugin Development
AFAIK, you can't uninstall any Filetype module that is in use. My experience is that I have to drop the fields out of all templates before I'm able to uninstall field-modules. And this makes sence. :-) -
There is currently no support for webp with CAI3 master. There (only) is a different branch with webp support on github. But I haven't got any feedback about it, so it shouldn't be called "production ready". 5 months ago, I locally started a complete rewrite of CAI3 to only use native core images support. But I get distracted from it. If I remember right, I have included it in one client project that is live since september. But not sure how stable it is. If you have some time for testing and you like, I send you my current version of CAI4. (?)
-
Hi @astock, ok. I think then something is not working as expected, and I cannot help any further here, as I never used this module. Maybe we can ping @Soma, or we need the help of someone who already used this. What is the PW version you are using?
-
Hi @astock, welcome to the PW forums. I haven't used this module myself, but looking at the code I think you need to configure it not to check by cookies | IP | UserAgent, but by user! Then there is a public function that you may query in your template file(s) before you display a poll form: https://github.com/somatonic/Pollino/blob/master/Pollino.module.php#L460 Can you check that you have configured all right for using users? Can you test if the above mentioned method is of any help in your case, or at least shed some light? As far as I understand this, after the first vote of a loggedin user, this method should return that he already has voted. If this doesn't help to bring you further, please come back again here. :-)
-
Designme - Visually Layout Your Edit Screens - Preview
horst replied to joshuag's topic in Modules/Plugins
Hi @elabx. Maybe it's an option to find another developer to fill in for Joshuaq? If you are a team again and not alone, maybe this will result in fresh energy? Also, if you later will release it as paid module, you may be able to follow Jens suggestion, once to block some time only for its development (to get more focused). So, not easy tasks nor easy decisions. But worth to think it over. ? -
Hi @LAPS, current implementation only allows one signature, set in the config screen. The option only defines when it should be send: never everytime or defined via API. Maybe it would be a nice addition to have a API method to pass in different signatures.
-
Hi @ak1001, many thanks for your investigations. Please can you provide me with some informations, so that I can test it locally here, and try to update the ___isVariation stuff to fit with recent PW versions? (When pim was build, we don't have had imge-rendering-engines and the image structures as it is today. We only have had the imagesizer.php and the pageimage.php, where I copy pasted that method from.) Which version of PW are you using: Do you use Pim1 or Pim2: Which module version of Pim: What is the exact full URL of the image(s) in question:
-
Howto make dynamic website with Processwire?
horst replied to uncle_bobson's topic in Getting Started
Hi and welcome @uncle_bobson. A good start is to look into the DOCS section of this website, maybe starting with a tutorial or the "Getting started" part. (Depends on your skills and knowledge). Reading a bit about and deciding for a "output strategie" may help to. Also you can download the latest PW and play around a bit with the included different site profiles. If you have additional or specific questions after that, please post and ask here again. :-) -
Hi @JC_G it can be and in most times it is that simple. Only thing I spotted is the version 2.5.7. I remember that there were some changes in regard of image (naming) processing around 2.5.11. So it can be a good additional check to look if there are some image related inputfieldtypes in use. (Check the modules - site screen, and if you find something like thumbnail- or croppable-image modules, please post there names here and I may provide some tipps or links, if necessary). But you also just can install it in a testversion on the new server, upgrade Processwire core to the latest stable and test and look if everything is working as expected.
-
Hi, I found this: https://processwire.com/api/ref/pagefile-extra/url/ Can you test it with passing a boolean false in the method call: webp->url(false)
-
Hi @eutervogel, I believe it has to do with a automatic optimization that Ryan has build into the webp->url method. Given that webp is used to get smaller filesizes, and that sometimes a png or jpeg can be smaller than its webp pendant, the smaller one of them is put out by the webp->url. In general a nice idea, but only when one output a single src url in an img tag. For the more advanced usage in picture or srcset elements it is wrong and also irritating the devs. If I remember right, there must be a config setting to disable this. If I find it, I post it here. If someone else reading this and knows where it is and how it is named, please shime in!
-
You can search like this via google: https://www.google.de/search?source=hp&ei=pdw6XtWCNbD4qwGGpYrQDA&q=site%3Aprocesswire.com+mp3&oq=site%3Aprocesswire.com+mp3&gs_l=mobile-gws-wiz-hp.3...3099.24029..29059...0.0..0.133.2617.5j19......0....1.......0..46i131i275j0i131j0j46i131j46.4qJhHOpUkyQ#sbfbu=1&pi=site:processwire.com mp3 Then you will get a list, possibly with a link to an inputfield, but definetly to some useful information.
-
Some infos may help. How are the dimensions of the images (orig images and the watermark image) How much is the dedicated memory for PHP on your server / account?
-
Hhm, this is a very old one, from 2013. Which version of PW do you use?
-
... more links, to newer code snippets:
- 2 replies
-
- imagesizer
- image size
- (and 4 more)
-
... and, if you want to do something that AOS doesn't support, one should use HOOKS instead of rewriting core modules, to avoid the version update hassle. ? TLDR; Following some example code from 2014/2015, (written before AOS was released).
-
Suggestion: add a new category "e-Commerce" to modules directory
horst replied to Gadgetto's topic in Wishlist & Roadmap
PING: @Pete- 1 reply
-
- 2
-
For me, uploading a file/image from URL works by simply copy paste the URL into the upload inputtextfield. The browser / OS does all necessary then.
-
You should check via phpinfo if there are more disabled functions or more restrictions on that hosting account. If yes, I would overthink to upgrade or switch to another.
-
That is correct. Additionally you can send the language files to the maintainers of language packs. I think that editors don‘t get the core backend untranslated, but need a single module translated. (What also can be done with one additional step, if the language files are distributed together with the module) For me it doesn‘t look that bad as described by @dragan.