Leaderboard
Popular Content
Showing content with the highest reputation on 04/19/2018 in all areas
-
That property is added by the ProcessWire installer, and reflects the date that PW was installed. Here's the purpose of it: when there are additions/modifications to the core that are potentially not backwards compatible, it will check the installed date to make sure it doesn't need to retain some backwards compatible behavior. There aren't many instances of this, but here are a couple: 1. If your PW was installed after 2017-12-15, then it uses an "ms" suffix on image variations that use the "maxSize" method on Pageimage. 2. Another example has to do with Markup Regions. These were originally introduced supporting class attributes for certain actions, and that was later removed, as Markup Regions now use their own attributes. But if you installed your site before 2017-06-21, then the legacy class attribute actions will still work, if you happen use them.5 points
-
Hi @Karl_T sorry for that and thanks for reporting this issue, I think I have an idea why is happening - checking this afternoon.5 points
-
Can you be more precise please? What kind of calculations are you talking about? I'll try an answer with a guess This is a quick test i did with 10.000 fake invoices. The result is great (but see later). Here the setup for the Tracy Console: $selector = 'parent=/invoices, limit=2'; // the limit is for demo of the sql $finder = new RockFinder($selector, ['value', 'date']); $finder->sort = false; $sql = $finder->getSQL(); d($sql, [6,999]); This finds all invoices and returns their "date" (a datetime field) and their "value" (random number between 1 and 100). The resulting SQL is this: SELECT `pages`.`id` AS `id`, `value`.`value` AS `value`, `date`.`date` AS `date` FROM `pages` /* --- join value --- */ LEFT JOIN (SELECT `pages_id` AS `pageid`, `value`.`data` AS `value` FROM `field_value` AS `value`) AS `value` ON `value`.`pageid` = `pages`.`id` /* --- end value --- */ /* --- join date --- */ LEFT JOIN (SELECT `pages_id` AS `pageid`, `date`.`data` AS `date` FROM `field_date` AS `date`) AS `date` ON `date`.`pageid` = `pages`.`id` /* --- end date --- */ WHERE `pages`.`id` IN (42063,42064) Now the funny part: You can do all kinds of custom SQL with that returned SQL statement, for example grouping the invoices by month and building a sum of their values: $results = $this->database->query("SELECT sum(value) as monthsum, DATE_FORMAT(date, '%Y-%m') as date FROM ($sql) AS rockfinder group by date"); And here the absolutely awesome result: So you get aggregated data for 12 months in no-time (166ms!!) with some VERY basic SQL. I'll think about how this can be made even easier in the future. Maybe by providing a method that does the query and returns the result. I'm open to suggestions. The maybe greatest thing about that is that you do not need to take care about processwire page statuses. That has always been a real pain when working with SQL because it makes things so complex. You always need to think about adding WHERE pages.status < ... and so on. That sucks. Now you just build your custom "view" with RockFinder and do some simple SQL on that result. You get the idea? Edit: I put $finder->getSQL() inside the timer, now it took 280ms - still great IMHO. And see how easy it is to add an invoice-count for that month for example3 points
-
Another year has passed... I was looking for a way to include database backup in my deployment process. I did not want to use some external secrets storage yet, so looked for a way to use db credentials already present in PW config. So I wrote a simple script, which I put in the project repo and call from cli during the deployment process like this: php -f backup.php For the sake of simplicity backup.php is in the web root. Here are its contents: <?php // backup.php include("index.php"); $backup = $database->backups(); $file = $backup->backup(); if($file) { echo "Backed up to: $file"; } else { echo "Backup failed: " . implode("<br>", $backup->errors()); } The full docs on how to customize it as you need should be here, but are now missing for some reason. One can still get them from the source code anyway) P.S. I am looking for a way to do it with a simple one-liner in cli to get rid of the backup.php, but not sure it is possible with php an easy way. Any advice appreciated! P.P.S. I knew I could do it, because @adrian done it in his wonderful Admin Actions module. Go read its code for inspiration and for education, if you are not a PW guru yet.3 points
-
3 points
-
I have encountered an issue for Duplicator ver 1.2.9. I am moving a site from localhost(windows 10) to Amazon Linux. I use RDS, which is a standalone server for database, so the dbHost is not localhost. The issue happened in the installation process after entering the database data and proceed. There's an error telling config file cannot be found. Then I go to config.php, there are at least 4 places are using old information. They are dbHost, dbName, dbUser, dbPass and httpHosts. I think for some reasons the config.php did not update at all after the installation complete. After I manually update the fields, the site works fine now. This means database import is working fine. I wonder if it is the dbHost matters. It is a long URL ended with xxx.rds.amazonaws.com.3 points
-
Didn't think about that. I use Soma's PageEditSoftLock for that. It also polls regularly, only in ProcessPageEdit, not all the time. Also, in general I just find the Notifications UI/UX really annoying and it's also frustratingly difficult to uninstall, but if others like it, then that's why we have options2 points
-
Concurrent page editing? At least it notifies the user, and often even me AOS has a sticky header option which fixes it. Thanks a lot @tpr !2 points
-
Hey @adrian, glad you gave it a try 1) No, I guess this was just for development. PR welcome (really need to work on other projects atm, see rockgrid and rockfinder for example and some client work). 2) Everybody who wants to (or needs to) remove the branding can contact me via PM 3) I agree. I've used Nette Live Validation in an older project and this looked a lot better, but I've just not had the time to implement it. This might be more complex when thinking about supporting different css frameworks. Or it might be as easy as loading this script: https://github.com/contributte/live-form-validation. I don't know and I wanted to go with the default tools as I'm short on resources for this module. And the most important part was that it works and is quick to setup and save, of course If you come up with a better solution I'm happy to merge it, but at the moment, I'm sorry, I have other priorities.2 points
-
Hey @bernhard - thanks for this - I decided to give it a go in one of my current projects. I usually build from scratch using the PW form API, but thought it was time to give this a go given how good most Nette products are. So far really enjoying using it A few thoughts: 1) Any reason you are loading netteForms.js instead of netteForms.min.js ? 2) Any chance you'd consider making the RockFormsBranding div optional? It might be ok on some projects, but on others I really don't think I could have it displayed. Not trying to take credit away, but hopefully you understand. 3) I find the alert dialog really annoying and very 90's. I know it's part of Nette and not something you added (https://github.com/nette/forms/blob/849b672612b709227371f0e0c7d4ee9110206ddc/src/assets/netteForms.js#L304) but I would love to see it gone without hacking that file. I am tempted to make a request to David at Nette, or maybe you could if you agree? Or is there a way to disable this that I am not seeing? Thanks!2 points
-
Hi @noelboss - as @bernhard noted Tracy isn't loaded yet. I try to load everything as early as possible but I don't have any control over the order in which modules are loaded, so when you make a dump call in init() it's a matter of luck really. Usually I find it works, but occasionally not. Also, if you are debugging in a method like that, you will most likely want bd() / barDump(), rather than d() / dump() so that the output is to the debug bar, rather than inline.2 points
-
2 points
-
Please see the current version of this module here: https://modules.processwire.com/modules/rock-finder/1 point
-
I have used the script below to do that, but must emphasise that this is destructive. The script does copy the original image to a "for_deletion" folder in the site root, but in case of disaster it would be a big PITA to go through and put the original images back to their relevant pages. So use at your own risk! // You could run this script manually, or put it on LazyCron if you have a lot of images // Maximum image dimensions $max_width = 1600; $max_height = 1600; // Images to process per operation $limit = 5; // Create array of large images $large_images = []; $i = 1; foreach($fields->find("type=FieldtypeImage") as $field) { if(!count($field->getFieldgroups())) continue; foreach($pages->find("{$field->name}.count>0") as $p) { foreach($p->getUnformatted($field->name) as $image) { if($i > $limit) break; if($image->width > $max_width || $image->height > $max_height) { $large_images[] = [ 'basename' => $image->basename, 'filename' => $image->filename, 'page' => $p->url, ]; $i++; } } } } // Iterate over images foreach($large_images as $large_image) { // Make backup copy of image (create the "for_deletion" folder first) $destination = $config->paths->root . 'for_deletion/' . $large_image['basename']; if(!file_exists($destination)) { $success = copy($large_image['filename'], $destination); // Don't carry on to the resizing stage if the copy wasn't successful if(!$success) continue; // Log file copy $log->save('resized_images', "Copied original image {$large_image['basename']} from {$large_image['page']} to /for_deletion/"); } /* @var ImageSizer $sizer */ $sizer = new ImageSizer($large_image['filename'], ['cropping' => false]); $sizer->resize($max_width, $max_height); // Log file resize $log->save('resized_images', "Resized image {$large_image['basename']} on page {$large_image['page']} to max width $max_width, max height $max_height"); } If you are using image field types besides the core FieldtypeImage you could modify the identification of image fields to something like this.1 point
-
I have posted this link in some other thread, but as this thread also relevant leave it here Search by "X-Powered-By" header - 8599 https://publicwww.com/websites/"X-Powered-By%3A+ProcessWire"/ Seach by "site/assets/files" - 17384 https://publicwww.com/websites/"%2Fsite%2Fassets%2Ffiles%2F"/1 point
-
I think you need quotes to get accurate results. How about this one: https://nerdydata.com/search?query="%2Fsite%2Fassets%2Ffiles%2F" Although I don't think the total count is relevant, but definitely show some sites I haven't seen, especially of interest is: https://www.payrexx.com/1 point
-
~488 websites listed here using ProCache: https://nerdydata.com/search?query=%2Fsite%2Fassets%2Fpwpc%2Fpwpc1 point
-
@tpr About the language switcher problem mentioned before: The problem is with the cookie "aos_lang_id". If it contains a value for the language (like e.g. 1010) which does not correspond to a language id of your current installation, then then PW backend crashes. This may happen, if you run multiple PW instances on localhost. A check for the existence of the id you get from the cookie would help imo. Thank you.1 point
-
thx @szabesz, cheating like that would definitely be an option (and also not too hard in that case). just thought there might be some magical pw-way of doing that1 point
-
Hi, It might suffice just to apply some extra compression to those original image files on the server. On my Mac I always use the desktop version of ImageOptim. Jpg files can be very small with using its algorithms. Sure, this will introduce more jpeg artifacts but if you do not crush them too much, then generating your final output can still be good quality, you just need to experiment a little bit what compression ratio works best. I normally batch-recompress image files on my local copy of the site and overwrite the ones on the server in one go. I often cheat like that. Pssst, don't tell @horst!1 point
-
Thanks @bernhard to the link to that live-form-validation script - that is a much nicer experience!1 point
-
1 point
-
I just took a look at the number of pages I got into the system, there is 407446 pages found, expecting around 1.2M pages at the end of the year. I didn't got the time to test your module again deeper but it look promising. The only thing I am scratching my head in, its the calculation of multiple fields on 100K+ pages at one time... Did you tried something already ? Actually, doing some calculation on 119k pages on one go take about 19seconds and rendering a chart from this number of pages take about two or three minutes! ?1 point
-
Solved, it happened after moving to a new server with PHP 7.0 apt-get install php7.0-gd1 point
-
I hadn't noticed. I don't use that theme because of the poor ui, but that is a different story. I disabled the system notification and this issue no longer exists. So this wasn't related to tracy at all, but thanks for your help.1 point
-
Hi, When I install a Processwire setup I always notice a config installed inside the config.php file. Example: $config->installed = 1524137464; I actually missed what this config is fore and also do you need to adapt it´s value when you move your site folder to another Processwire setup ?1 point
-
@MarcoPLY You still posting to PHP file. Instead, you can create a template, for example 'ajax'. Create a template file for this template. Now you have endpoint URL for your requests. site.com/ajax/ Then in your template file, you can do something like if($config->ajax) { if($input->post->email) { do something } } else { // $session->redirect("/"); // or //throw new Wire404Exception(); } Furthermore, you can enable URL segments for 'ajax' template and then you will be able to make requests to URLs like 'ajax/form/', 'ajax/cta/' etc. if($input->urlSegment2) throw new Wire404Exception(); if(!$config->ajax) throw new Wire404Exception(); if($input->urlSegment1 && $input->urlSegment1 == 'form') { do something } Hope you got the main idea.1 point
-
That's a pretty good idea right there If that doesn't help, I'd start by checking if /wire/modules/Inputfield/InputfieldInteger.module exists and is readable to your Apache user. In case you have a /site/assets/cache/FileCompiler/ directory, I'd also clear that, just to be sure.1 point
-
1 point
-
I guess Tracy is not loaded when your init fires. You can try to attach your hook in ready() instead of init(). Sidenote: You should also be able to use the d() shortcut method without the Tracy class1 point
-
1 point
-
Perhaps a hook priority issue? Search the forum, eg here: https://processwire.com/talk/topic/1983-prioritising-hooks-for-same-event/1 point
-
Sorry you had a battle There is a template settings - under the URLS tab for changing whether URLs end in a slash or not This thread is worth a read: https://processwire.com/talk/topic/16930-options-for-trailing-slashes-and-seo/ - it includes some links on slash vs no slash. Also, just an FYI - variables in a URL are GET, not POST1 point
-
This occurred back in January of this year. It's still a great analytical system.1 point
-
The "option" to sort on the server side is of course always there. But I set it to use sorting by default now. I think the worse performance will not matter in most of the cases. If it does, the user will realise it and can easily turn it off. It would be worse to think everything works as expected and then get some unexpected results due to sorting turned off while you think it should actually return a sorted resultset ( like from a selector containing the sort keyword ). Thanks for your feedback.1 point
-
Sort order in database can affect the results returned. So, unless you are 'finding' everything, it is good to have the option to sort server-side.1 point
-
Building a website is not the problem. Running a business with it can become the problem. Collecting e-mail addresses, tracking visitors and monitoring visitor-behaviour, combining it with 3rd parties like Facebook and ad networks will be a much bigger thing now. Cookie permissions here, double-opt-in there, and so on... it will be much more challenging than before. Don't know anything special about sources in Spain, UK, US but here in Germany there are some lawyers offering (free and paid) help for all kinds of businesses. Just to name two I prefer: https://www.e-recht24.de/ and https://drschwenke.de/ And as always with legal stuff: lawyers are my one and only trusted source. Not other companies (like the one above) that offer checklists, guides and tutorials.1 point
-
i haven't worked on this ajax module for several months so it really is not ready, but i do have a working version if you want to try it. It needs testing, and work; The screenshots show some elements of the setup in case of any confusion. ---the field--- ---the files--- InputfieldSelectizeAjax.js InputfieldSelectizeAjax.module1 point
-
Update: LoolEditor now uses its own simple modal without a title bar since the editor's close button also closes the modal. Things feel a lot smoother now. I think PW is currently the only CMS that integrates LibreOffice for free1 point
-
Quick update and version bump to 0.1.0 I updated the module to use the standard ProcessWire variation suffixes. Instead of image.0x200.optim.jpg, optimized images will now be named image.0x200-optim.jpg. Deleting images in the admin or via the API will delete any optimized variations as before, but the process is a lot more straightforward now. I also added a public method $image->removeOptimizedVariations() that does exactly what it says it does.1 point
-
Well after your reading I went back to suggest to the "customer" who is a close friend of mine and shared the reading. So now we agreed to have the language names versus the flags or even add a dropdown box listing some countries that speak the selected languages. Thanks again for the sharing.1 point
-
1 point