-
Posts
211 -
Joined
-
Last visited
Everything posted by NorbertH
-
Additional fields/pages slowing down the whole system.
NorbertH replied to NorbertH's topic in General Support
Why all fields or templates need to be loaded on any request ? Whats the reason , sounds unnecessary to me ? -
Additional fields/pages slowing down the whole system.
NorbertH replied to NorbertH's topic in General Support
The application is BE only , no frontend . I added more or less just a land list whith many columns that i added. I never expected such an impact. Debug mode has almost no impact 30 ms. Tracy is installed , but i could need some hints how to use it to track those bottlenecks. The only hook added just composes a field from several others. No repeaters added . Concerning to ProDevTools The hook whith the biggest runtime was Tracy whith about 200 ms ? Turning it of made the page significantly faster. Still page isn't really responsive but most time intensitive hook now takes 13 ms Rendering of /site/templates/admin.php still takes about 220 ms. After Installing and adding modules it was about 60-80 ms which i feel is still very much as Applications like Dadabik come whith a rendering time of about 10 ms on this server. Ok turning tracy back on for further testing. Concerning to tracy Selector Queries (11) none of them took more than 1 ms The PDO queries do not show how long they took... Is there a way to show this ? Php Memmory limit is 128M Peak of allocated memory 23.01 MB PHP is 7.1.2 PW is 3.0.120 In general it would be interesting what the factors are that slow down PW and why. Modules installed ? Number of Templates/Fields.? Number of Pages? And even on really high powered server i never had a rendering time below 50 ms, feels kind of strange to me. -
I got a small PW application running on a relatively small server. Recently i needed to extend the application with 20 fields and about 260 Pages. I would expect that this possibly slows down the ProListers or pagetree where these additions are relevant , but this slows down the whole page. Even pages that have nothing to do whith it like the modules page. How is this possible ? The page rendering time gone up about 200ms from about 150ms.
-
Is there a hook to do something right after cloning a page ? I want the page to be saved right after cloning it either from the button in the tree or from a lister, because saving the page triggers several calculations that are not triggered by just cloning the page. Thanks in advance !
-
Still no replacement possible ? Thinking this through it would be even greater if you could add custom sanitizer as modules. Maybe like : $sanitize->call($value, 'moduleName', $arguments);
-
I really would like to see a sanitzer that uses a regex!! $sanitize->regex($value, $regex); Simply return empty if the value doesn't match. It would be even better if we got an extra option for replacements and or callback functions. If i have seen it right, there are even sanitizer that use HTMLpurifier so why is there no regex implemented as its one of PHP's most powerfull features ? Sanitizer since PW 2.6.14 integrates nicely whith $input and so on , so using a seperate preg_match()/preg_replace() isn't as elegant as using sanitizer.
-
1. There is a validation in place in the input field that throws a message when the pattern is not matching : (from inputfield_text.module) if($length > 0) { if($this->pattern) { $regex = '#' . str_replace('#', '\#', $this->pattern) . '#'; // add delimeters if(!preg_match($regex, $value)) $this->error($this->_('Does not match required pattern')); } if($minlength > 0 && $length < $minlength) { 2. The problem is that HTML5 pattern behaves different from preg_match() , it always behaves like the regex would start at the beginning of the line and stop with the end . if you use the pattern "^[a-z]$" in your pattern field you get correct results. HTML5 ignores "^" and "$" but always behaves like that and preg_match() is happy with those line start and line end signs. 3. So possibly it would be a good Idea adding them hardcoded: $regex = '#^' . str_replace('#', '\#', $this->pattern) . '$#'; // add delimeters
-
Here is the test case (all happens in BE): Create a text field. Add the HTML5 pattern for using only lower letters : [a-z]+ Add it to a template and page you like . Open that page for editing Writing "aafdfdf" to the field HTML5 will let you save the field . Writing "asdsdsA%&%" lets HTML5 stop you from sending the form . Now deactivate HTML5 validation. In firefox use this Plugin: https://addons.mozilla.org/de/firefox/addon/defyformvalidation/ Writing "aafdfdf" to the field PHP will let you save the field . Writing "asdsdsA%&%" lets PHP still save the form!!! I checked the module code but serverside validation seems to be in place. Comparing the two regex variants it seems like the HTML5 pattern allways behaves like it starts at the beginning of the line and ends at the end of the line. In PHP preg_match() a pattern that behaves like the HTML5 counterpart would look like this: ^[a-z]+$ Whats your experience whith this ? Wouldn't make it sense to add those "^...$" as hardcoded value in the inputfield module? There are lots of limitations in HTML5 patterns, wouldn't it be even better to add a second field for serverside regexes.? Especially the extremely limited utf-8 support leaves the pattern almost useless in international enviroments (eg. \w will only work for a-zA-Z). Wouldn' it be great to have selectable sanitation/ validation functions , like we allready have whith textformaters?
-
Field validators / validation framework
NorbertH replied to mindplay.dk's topic in Wishlist & Roadmap
Addition: I found that the Pattern field already states that it would do validation serverside too. I created a field PLZ which is german postal/zip code Added a pattern [0-9]+ Put it into an existing page/template and tried to enter letters in the backend , the HTML5 validation reacted as it should. I use firefox so i deactivated validation by using this plugin : https://addons.mozilla.org/en-US/firefox/addon/defyformvalidation/ Now i save the page and get a PLZ of 5666a for example. I already tested this quite a while ago and that was the reason while i wrote the above comment , sorry for not reading the field description closely , now i know that it should validate but still it does not do it. Another thing is about the error message the browser simply displays the default message like "Please match the requested format" this is very user unfriendly. Concerning https://stackoverflow.com/questions/10361460/how-can-i-change-or-remove-html5-form-validation-default-error-messages It should be possible to implement custom messages in HTML5, btw. that would be great in serverside validation too. I mainly use PW for building small DB applications so userfriendlyness in BE is very important for me. If You use it mainly for Websites its not that important , but still i would find it confortable to have an error message available from my field settings when building frontend templates. It would be even better , if the field would be multilanguage ? Another issue whith BE forms and HTML5 validation is that the error messages only appear one after another. So user corrects one field, presses send and gets the next error presented , if you got 10 errors that takes a while .... The Problem is very good described in this article plus they offer a solution: https://www.tjvantoll.com/2012/08/05/html5-form-validation-showing-all-error-messages/ @admins If you think this post belongs into a new thread, feel free to move it, i am uncertain. -
Field validators / validation framework
NorbertH replied to mindplay.dk's topic in Wishlist & Roadmap
Wouldn't it be a good step in the right direction to validate the HTML5 patterns via PHP too. They are valid regex and it should be not too hard to process them via preg_match (). Selecting sanitation and validation modules like the textformatters would be really cool too. And it wouldn't be too hard to put together a collection of both. You could even use textformatters for that(at least for sanitation). This would be even helpful for other fields like certain currencies and date formats, where you could correct some bad formatted input. Building tons of fields seems not really comfortable to me though it is an option. Just using the HTML5 patterns would relieve us from a lot of work and even when its not a perfect solution it would help a lot. Having an easy and quick way to do some simple custom validations/sanitations in text fields is one of the last few things i really miss in PW. -
Hi again, problem solved(hopefully) using bd($textformatter, $field->name); I found that always after the second field the last element of $textformatters contained a NULL Element. Checking the name of the textformater i found that this always hapened to this formatter "TextformatterOnly0To9" After taking a really close look i found that the classname differed from the filename: "TextformatterOnly0To9" "TextformatterOnly0to9" Its only a upper/lower case difference and PHP (as far as i know) normally does not care about that in classnames. Changing this back lets me reproduce the issue. Still one thing i don't understand is the fact that exporting one field works perfect, i can't get the point why only fetching $textformatters a second time leads to this issue. Btw. i did not experience any other issues whith that wrong named classname the textformater did what he was expected to do....
-
In the DB there seem to be no invalid entry. All Textformater entries look ok , and there are no invalid entries in the whole modules table.
-
-
Sorry i am really new to tracy , what exactly you need ?
-
FeildtypeText.module line 161 ff if($this->allowTextFormatters()) { $textformatters = $this->modules->find("className^=Textformatter"); if(count($textformatters)) { $f = $this->modules->get('InputfieldAsmSelect'); $f->setAttribute('name', 'textformatters'); $f->label = $this->_('Text Formatters'); foreach($textformatters as $textformatter) { bd($textformatter); $info = $textformatter->getModuleInfo(); $f->addOption($textformatter->className(), "$info[title]"); } $f->setAttribute('value', is_array($field->textformatters) ? $field->textformatters : array()); $f->description = $this->_('If you want to apply any automatic formatting to the field when it is prepared for output, select one or more text formatters above. If you select more than one, drag them into the order they should be applied.'); $f->notes = $this->_('For plain text fields that will not contain HTML or markup, we recommend selecting the **HTML Entity Encoder** option above.'); $inputfields->append($f); } } As far as i understand this he fetches all existing textformater modules for each field and as you can see in the screenshot , the last one is NULL as you can see in the screenshot.
-
there is none missing in the fields ... is there a way to print out the full stacktrace ? OR does i need to go for a very big screenshot ?
-
I have trouble exporting fields via the buildin export. For example when i export a single field i get: { "bestellung_status_name": { "id": 194, "type": "FieldtypeText", "flags": 0, "name": "bestellung_status_name", "label": "Status Intern", "textformatters": [ "TextformatterEntities" ], "collapsed": 0, "minlength": 0, "maxlength": 100, "showCount": 0, "size": 0, "pattern": "[a-z\\A-Z\\(\\)]+", "showIf": "", "themeInputSize": "", "themeInputWidth": "", "themeOffset": "", "themeBorder": "", "themeColor": "", "themeBlank": "", "columnWidth": 100, "required": "", "requiredAttr": "", "requiredIf": "", "stripTags": "", "placeholder": "" } } exporting a secon single field i get : { "bestellung_status_name_ext": { "id": 195, "type": "FieldtypeText", "flags": 0, "name": "bestellung_status_name_ext", "label": "Status Extern", "textformatters": [ "TextformatterEntities" ], "collapsed": 0, "minlength": 0, "maxlength": 100, "showCount": 0, "size": 0, "pattern": "[a-z\\A-Z\\(\\)]+", "showIf": "", "themeInputSize": "", "themeInputWidth": "", "themeOffset": "", "themeBorder": "", "themeColor": "", "themeBlank": "", "columnWidth": 100, "required": "", "requiredAttr": "", "requiredIf": "", "stripTags": "", "placeholder": "" } } So far everything works fine . When i try to export both fields together i get only an error message : Call to a member function getModuleInfo() on null File: .../wire/modules/Fieldtype/FieldtypeText.module:171 I added " bd($textformatter);" on line 170 to see whats wrong. so have a look at the screenshot i apended to this post. Its perfectly possible that one textformater module got removed by accident while experimenting whith some textformaters but my question is how to fix this maybe somewhere in the DB and possibly what went wrong? ProcessWire 3.0.120 © 2019 Apache/2.4.25 (FreeBSD) OpenSSL/1.0.2k mod_fcgid/2.3.9 PHP 7.1.2 Edit: After adding if ($textformatter ===NULL) continue; I can export my fields , as there arent any Textformater missing in the fields , i get a perfect result. but still there is one textformater whith a NULL value.
-
Another issue i have is that when i edit the comments from the page they belong to the headlines say nothing about the content ? Say absolute nothing ... So if you look for a certain Comment you have to open all comment lines manually. How about something like : Or maybe : In addition to that a search field would be genious!!
-
When you for example use this on a webshop to allow comments on products , one thing you really miss is the name/title/otherfield of the page where the comment belongs to. Going through all Product pages to look for a new comment is really painfull. Is there a way to display the page name, id or whatsoever in the overview. Maybe even 1-3 configurable fields , or a link to edit the relevant page ? That also would be helpfull if you have a spontaneous diskussion in your blog comment, that goes in a wrong direction. Just hop to the page and follow it whithout other posts and spam between the messages. Awesome module, thanks for coding it!
-
I have an issue while processing a form in PW // Variant 1 html <button tabindex="-1" id="reset-button" name="reset-button" value="reset" class="btn btn-info" type="send">Form Reset</button> // Variant 1 php if ( !empty ($input->post->reset-button)) .... // Variant 2 html <button tabindex="-1" id="reset-button" name="reset_button" value="reset" class="btn btn-info" type="send">Form Reset</button> // Variant 2 php if ( !empty ($input->post->reset_button)) .... When using a hyphen ( Variant 1) i get an notice : Assuming a constant whith value "button" then results in several follow up errors, but thats not relevant. When using the underline, everything is ok , when using $_POST['reset-button'] directly i encounter no issues. I am absolutely confused by this. Any ideas whats going wrong here ?
-
I have an order form where the customer service selects the customer and then fills out the order form. Its almost like a very simple webshop. When you select the customer you get the order history and the form to place new orders all generated dynamically on one page. Now i am looking for a way to store comments about those users and their transactions and thought about using the comments module for this. The problem is that the page always uses the same page id as the content is generated dynamically, so the comments field always displays all comments for all customers. So my question is if there is a way to seperate the customers in the field call from whithin the template, for example by giving it a fake page id or maybe linking it to the page id of the user and not to the actual page calling it. Maybe like this : <?php echo $page->comments->render(array('page_id' => $page_id); ?> <?php echo $page->comments->renderForm(array('page_id' => $page_id); ?> Thanks in advance !
-
How can i convert a float field to decimal , decimal does not show up in select list for change fieldtype ?
-
How about posting this version here ?
-
I am looking for a way to add a full pagetree to select the path to redirect users to. It would enable us to redirect to FE pages too , and possibly to the profile page.... Does anybody know how to replace the standard selector whith a full pagetree to select a page in that module ?
-
Whats your PHP version ?