Jump to content

bernhard

Members
  • Posts

    6,671
  • Joined

  • Last visited

  • Days Won

    366

Everything posted by bernhard

  1. thx @netcarver for your hints and your kind words ? btw thank you for taking care of the pw issues repository ?
  2. 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 ?
  3. 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.
  4. 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):
  5. Very nice, I really like the design!
  6. 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.
  7. 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?
  8. 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/
  9. Indeed I think that's a very special use case. Do you know FormBuilder?
  10. 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 ?
  11. 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.
  12. 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...
  13. similar here ? really old... but it works ^^
  14. 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!
  15. /* editor */ "editor.rulers": [80, 120], "editor.tabSize": 2, "editor.renderWhitespace": "boundary", "files.associations": { "*.module": "php", "*.inc": "php" }, "editor.renderIndentGuides": true, /* search */ "search.exclude": { "site/assets/cache/**": true, }, Sure, atm only these: Nothing special. I don't have any fance code completion yet, so I'd be happy to get recommendations ?
  16. Thx @gmclelland very helpful! I'm working on my git workflow and I just found the GitLens extension. I haven't tested it much but it looks quite amazing so far! https://gitlens.amod.io/ Also I've switched from the portable version back to a regularly installed version, because that has several benefits (for example having it in the context menu). I just moved my "data" folder to my OneDrive and placed a symlink to the installed VSCode folder: // make a backup of your data folder // open cmd (with admin privileges!) mklink /J "C:\Program Files\Microsoft VS Code\data" "D:\OneDrive\programme\portable\vscode\data"
  17. Where do I find this? ?
  18. Have you tried ?
  19. Thx ?? Still fighting with multiple forms on one page. Hope I can solve it soon... Also while implementing another form on a page I realized that the setup process is still a little bit tedious. But apart from that it worked well. I'd love to provide a better module with better UI one day. But I'm also not sure if I should really do that... we already have FormBuilder. We'll see...
  20. Thank you @hheyne and @jmartsch I've merged that fix ?
  21. You have a 512MB limit. I guess the error says that you already used eg 511,99 MB then allocating another 0,02MB would be too much. Please don't double post
  22. do you have a question? you can also try https://modules.processwire.com/modules/duplicator/ edit: could you please not double-post @sebastiaan ?
  23. hi sten, do you want to achieve something similar to this?
×
×
  • Create New...