Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/18/2022 in all areas

  1. thx! I'm thinking about it. But I think not to the current version. RockMigrations has evolved over the last years and it's time to refactor and clean up and that would be a good opportunity. What I'd like to know of you guys is why everybody seems to be so excited about YAML? Is it about the YAML thing or is it about the recorder? I'm asking because YAML would really be a drawback IMHO. What I think would be much better is to have a regular PHP file that returns a simple array. That's almost the same as a YAML file but you can do additional things if you want or need. See this example: <?php namespace ProcessWire; /** @var RockMigrations $rm */ return [ 'fields' => [ 'foo' => [ 'type' => $wire->languages ? 'textlanguage' : 'text', ], ], 'templates' => [ 'demo' => [ 'tags' => RockMails::tags, 'fields-' => [ 'title', 'foo', ], ], ], ]; That migration file would add a "foo" field and depending on the system make this field single or multi-language. That would be just one example which would not be possible using YAML syntax. Another thing is using class constants. Possible in PHP (see RockMails::tags in the example above), not possible in YAML. I'm really curious what it is really about, thx.
    4 points
  2. That's exactly what I always think. It already bugs me with Docker Compose and also with other tools. But your recorder looks really cool ?
    2 points
  3. Hi @Ivan Gretsky That's how it works for me. In your case, you can create a controller for 'b' template that extends your 'a' template, call the parent init method and then set template for the view class PostsController extends CategoryController { public function init() { parent::init(); $this->view->setTemplate('category'); } }
    2 points
  4. @ryan - I wonder if it would be possible to also get the template name in the returned array? I need this to be able to group results. I also need to the know the parent template name - could it be possible to have a sub array with details about the parent included for each result? The other thing that I am struggling with is sorting the results. Obviously there are PHP ways to do this, but it would be great if PW's sort method was available here as well. To give you a bigger picture, I am trying to convert: $references = $page->references('has_parent!=1051, sort=template'); $references->sort('template, -date, -start_date, -year, -year_rt, -parent.month, title'); to use findRaw() with the new references option. For this sort to work, I actually also need to be able to sort via the "month" field in the parent. I am guessing you'll say that this is beyond the scope of findRaw() which might be fair, but I thought I'd provide a real world use case where this takes the query time from: 1260.47 ms, 14.2 MB down to 297.23 ms, 854.6 KB so it's a huge performance gain if it can be made to work.
    2 points
  5. I'm guessing that is any file format that shows changes to the system that can be commited to another system. PW uses json for its template and field export import... so I'm guessing it really doesnt matter... but (kinda of my original point about this module) that migrations, in my mind, are about reflecting changes, where as RockMigration goes a step further and basically sticks all config in code. I would prefer using PW for config (opening the door to less technical admins for example), and have those changes migratable like templates and fields but in a way that is less cumbersome. The fact you can code up your cofig isnt really migration to me, the migration is because of changes, where ever the changes happen.
    1 point
  6. Good catch - thanks for noticing that - I'm not on it this morning apparently :) Well @Ivan Gretsky - at least using $config->paths->data should work for you. I'll still keep an eye on that $maxItems setting and implement when available and see if it handles that other situation.
    1 point
  7. Well that's two different dumps... one is dumping the array and one is dumping an object that has an array inside the data property! d($config->paths); d($config->paths->data); Personally I think that behaviour is good ?
    1 point
  8. @Ivan Gretsky - if you need this immediately, you can always edit this: https://github.com/adrianbj/TracyDebugger/blob/e6088e92ddb052382382edf290077d929832410f/tracy-2.9.x/src/Tracy/Dumper/Describer.php#L34
    1 point
  9. To clarify @bernhard depth is the number of levels in an array, vs the number of items in the array.
    1 point
  10. @Ivan Gretsky - there is already an issue about this on the core Tracy repo: https://github.com/nette/tracy/issues/531 Once this is made available, I'll support it in this module.
    1 point
  11. @bernhard The YAML recorder and migration of the project.yaml look awesome. Any plans to release these additions to RockMigrations? I think this is a good way to make fields and templates version controlled. Having a feature like the YAML config and recorder added to the core would be a very good thing IMHO. The not programmable definition of fields and templates and migrating contents and structure to a live server is cumbersome (without RockMigrations) and led me to try out alternatives to ProcessWire in the past. I used Statamic and Kirby which both have configuration files for fields/templates, which can be version controlled and I really like the way it's done.
    1 point
  12. Hello, @Frank Schneider! The code is: $content = str_replace('xName', 'something', $content); Have a nice day!
    1 point
  13. ok so i edited ImageType.php and added webp as a pageimage field then i was able to pick it up from the configuration, looks like it works
    1 point
  14. Welcome to PHP lol https://www.php.net/manual/function.preg-replace.php https://www.php.net/manual/function.str-ireplace.php https://www.php.net/manual/function.str-replace.php https://www.php.net/manual/function.mb-ereg-replace.php (just use this) https://www.php.net/manual/function.mb-eregi-replace.php (or this) https://www.php.net/manual/function.mb-ereg-replace-callback.php https://www.php.net/manual/function.substr-replace.php https://www.php.net/manual/function.preg-replace-callback.php https://www.php.net/manual/function.preg-replace-callback-array.php
    1 point
  15. I think that autoload order should be an extra setting instead of choosing between boolean|string|callable|int. Because of that you could choose to use a condition and also give it an order. For example, only execute the module in the backend or when a special user role is active, and then load it with high priority.
    1 point
  16. Too simple to be a module, consider a script like this: $array = $pages->find("template=basic-page")->explode(function($item){ return array( 'id'=> $item->id, 'title' => $item->title ); }); $fp = fopen('file.csv', 'w'); foreach ($array as $fields) fputcsv($fp, $fields); fclose($fp); Note, $pagearray->explode() used here is only available in 2.4 (2.3 dev) http://cheatsheet.processwire.com/pagearray-wirearray/getting-items/a-explode/ And the anonymous functions requires php >= 5.3 http://php.net/manual/de/functions.anonymous.php
    1 point
×
×
  • Create New...