Jump to content

bernhard

Members
  • Posts

    6,629
  • Joined

  • Last visited

  • Days Won

    358

Everything posted by bernhard

  1. not sure how that should look like exactly but it sounds good to me ?
  2. Thank you. Actually I came up with a somewhat different idea. I had to debug something yesterday and needed ['debugInfo' => false] several times. In fact I need it that often that I can even remember it by heart ? My Idea: What if we had a bdv() method instead of bdb, meaning barDumpVerbose() that has a limit of 9999 AND debuginfo set to false?
  3. thanks - already using it and i like it! ?
  4. why not learn from existing solution? ? https://modules.processwire.com/modules/inputfield-urlchecker/
  5. found another strange behaviour while testing my new RandomPageName module: The string should actually have a length of 4 (not 5), the "minDigits" setting of 2 would also be true for "8y4k" so the final "x" is unnecessary (wrong) imho...
  6. glad you find it useful. please use caution until this issue is solved (maybe you find some time to help me debugging/testing?):
  7. EDIT: See this blog-post for new PW core features for pagenames: https://processwire.com/blog/posts/pw-3.0.111/ This autoload module adds two new methods to the $page object: $page->getRandomPageName() $page->setRandomPageName() You can define options for the random string via an array (see /core/Password.php for all options): $page->setRandomPageName([ 'minLength' => 5, 'maxLength' => 5, ]); You can also define the subset of pages where the new pagename should be unique: $page->setRandomPageName("has_parent={$page->parent}", [ 'minLength' => 3, 'maxLength' => 3, ]); https://gitlab.com/baumrock/RandomPageName (see readme for examples) Do you think this is useful? Any feedback or suggestions of a better approach are welcome.
  8. As far as I understand this does only mean that if you had a setting 'minUppercase' => 2 and your initial random string would be aaa it would add 2 uppercase characters and result in aaaBB exceeding the maxLength setting. But if I don't have any conflicting additional settings (which I think I do not have) it should always return a 3 digit string in my opinion.
  9. Most of the time I'm getting a 3 digit password, but sometimes it is longer like here: To copy&paste: $pw = new Password(); d($pw->randomPass([ 'minLength' => 3, 'maxLength' => 3, 'minLower' => 0, 'minUpper' => 0, 'minDigits' => 0, 'minSymbols' => 0, 'maxSymbols' => -1, ])); From core/Password.php: * @param array $options Specify any of the following options (all optional): * - `minLength` (int): Minimum lenth of returned value (default=7). * - `maxLength` (int): Maximum lenth of returned value, will be exceeded if needed to meet other options (default=15). * - `minLower` (int): Minimum number of lowercase characters required (default=1). * - `minUpper` (int): Minimum number of uppercase characters required (default=1). * - `maxUpper` (int): Maximum number of uppercase characters allowed (0=any, -1=none, default=3). * - `minDigits` (int): Minimum number of digits required (default=1). * - `maxDigits` (int): Maximum number of digits allowed (0=any, -1=none, default=0). * - `minSymbols` (int): Minimum number of non-alpha, non-digit symbols required (default=0). * - `maxSymbols` (int): Maximum number of non-alpha, non-digit symbols to allow (0=any, -1=none, default=3). * - `useSymbols` (array): Array of characters to use as "symbols" in returned value (see method for default). * - `disallow` (array): Disallowed characters that may be confused with others (default=O,0,I,1,l). Am I missing anything or shouldn't it always return a 3-digit password in this case?
  10. thx @netcarver for your hints and your kind words ? btw thank you for taking care of the pw issues repository ?
  11. Thx @Mackski I've done a slightly different approach: You now have the option between three methods: save() show() download() The save() method will return the resulting file urls and paths on success: @flydev thx I've added it to the modules directory ?
  12. Hi everybody! As we all know modules can have a version number. It is defined in the module's info array like this: $info = [ 'title' => 'mPDF Helper Module', 'version' => '1.0.0', 'summary' => 'A helper module for the mPDF library', 'singular' => false, 'autoload' => false, 'icon' => 'file-pdf-o', ]; or like this: $info = [ 'title' => 'mPDF Helper Module', 'version' => 100, 'summary' => 'A helper module for the mPDF library', 'singular' => false, 'autoload' => false, 'icon' => 'file-pdf-o', ]; As far as I understand both should be equivalent, but there is a problem when having a version number like this: 'version' => 1013, // result: 1.0.13, not 10.1.3 The solution to that problem could be to use a string: 'version' => '10.1.3', BUT: When using strings vor the version I cannot compare the currently installed version with the downloaded one. This is a problem for my upgrade module which handles db migrations similar (but a lot more minimalistic) to the migrations module: <?php namespace ProcessWire; /** * Bernhard Baumrock, baumrock.com * MIT * * test with tracy console: * $up = $modules->get('UpgradesDemo'); * $up->___upgrade(3,4); */ class UpgradesDemo extends WireData implements Module { private $from; private $to; /** * module info array * this is kept inside the module file to make sure the file changes even when * only the version number was changes. otherwise the module file does not change * and the system does not recognize the update */ public static function getModuleInfo() { return [ 'title' => 'UpgradesDemo', 'version' => 5, 'summary' => 'Module to handle upgrades', 'singular' => true, 'autoload' => 'template=admin', 'icon' => 'code-fork', ]; } /** * execute code on upgrade */ public function ___upgrade($from, $to) { $this->from = $from; $this->to = $to; $this->log("-- Starting upgrade from $from to $to --"); // option 1 // $this->execute(1, function() { // $this->log('execute upgrade 1'); // }); // option 2 // include(__DIR__ . '/upgrades/1.php'); $this->execute(4, function() { $this->log('execute upgrade 4: install rockfinder and rockgrid'); $this->wire->modules->get('RockFinder'); $this->wire->modules->get('FieldtypeRockGrid'); }); $this->execute(5, function() { $this->log('install AdminThemeUikit'); $this->wire->modules->get('AdminThemeUikit'); }); $this->log("-- Upgrade from $from to $to finished --"); } /** * execute the callback if the version matches */ private function execute($version, $callback) { // execute callback if version matches if($this->from < $version AND $this->to >= $version) { $callback->__invoke(); } } /** * logging shortcut */ private function log($str) { $this->log->save('upgrades', $str); } } So for example if I had version 3 of this module installed and I upgraded it to version 5 the code would run upgrade #4 and #5. How do you handle that? Thanks for your ideas ? Edit: It seems that the modules directory treats 100 as 100 - so there is a lot of inconsistency imho.
  13. Pushed a little Update for basic support of options fields (using the same sql queries as file fields). But I want to share something I needed today to keep my requests simple and my code clean: You can quite easily join two finders where manipulating the SQL would maybe quite complex: $this->rg->assets->add($this->config->paths->siteModules . 'FieldtypeRockGrid/lib/moment.min.js'); $this->rg->assets->add($this->config->paths->siteModules . 'FieldtypeRockGrid/lib/currency.min.js'); $efforts = new RockFinder('template=effort', [ 'title', // fields ]); $projects = new RockFinder('template=project', [ 'title', // fields ]); $sql = 'SELECT efforts.*, projects.id AS projectid, projects.title AS projectname, projects.project_status AS projectstatus FROM (' . $efforts->getSQL() . ') AS efforts LEFT JOIN field_project_efforts AS ef ON ef.data = efforts.id LEFT JOIN (' . $projects->getSQL() . ') AS projects ON projects.id = ef.pages_id /* projectid */ '; $this->setData($sql); Result (with RockGrid and some JavaScript, of course):
  14. Very nice, I really like the design!
  15. hey adrian would you mind changing 999 to 9999 ? 999 is too low here for debugging my sql queries and I wonder why we have such a low setting for the "big" dump. I think it's fine to have a low setting for bd() but one would use bdb() only for dumping big dumps so I think 999 can often be limiting and then the benefit of having bdb() compared to bd($var, [6,9999]) is lost.
  16. Thx for that insights @Soma I don't think that's a misconception. He has limited time so he does focus on topics that either he or the community needs - if he has no problems and the community doesn't report any why should he invest his time then?
  17. So I don't really get your question. For a customized input in general you need a customized field. You can tag them, then they are grouped in the fields list. You can also use https://processwire.com/api/modules/profields/textareas/ and you can read the blog post here: https://processwire.com/blog/posts/making-efficient-use-of-fields-in-processwire/
  18. Indeed I think that's a very special use case. Do you know FormBuilder?
  19. That one looks really nice! First I thought I don't think ProcessWire is the right tool for such click-click-marketing sites, because its strength comes from the freedom of fields and querying them with the strong API, like $pages->find('template=xy,fieldx>50,fieldy<10'. But then I thought maybe it would be nice to have both combined. A site with custom templates & fields where we need more control over our data and an "ORY-template" (similar to the basic-page template) where the user can build its own totally flexible page. This could be great for landingpages. So if anybody has the time to build it - go for it ?
  20. thx, that's a perfect solution i didn't know about ? Of course that would be the best option, but I don't think many people will need it anyway... I prefer the array syntax nowadays.
  21. I just pushed the update to support multiple forms on one page. Unfortunately it's not perfect, because Nette Forms have some issues here ? But at least it works for my scenario...
  22. similar here ? really old... but it works ^^
  23. would also love to get some words by @David Karich ProCache does also support HTML minification and ProCache is really an awesome module and worth every cent!
×
×
  • Create New...