Jump to content

thetuningspoon

Members
  • Posts

    691
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by thetuningspoon

  1. Hi @mel47, I just pushed out a release that I believe fixes this. Can you confirm? It looks like there was a small issue with @kixe's pull request a while back that I didn't catch.
  2. There is a workaround if you're willing to edit the core: https://github.com/processwire/processwire-requests/issues/239
  3. I'm getting the following error after upgrading: Fatal Error: Uncaught Error: Class 'FieldtypeFile' not found in wire/core/Modules.php:700 #0 wire/core/Modules.php (1478): Modules->newModule('\Fie...') #1 wire/core/Fieldtypes.php (199): Modules->getModule('FieldtypeFile') #2 wire/core/Fields.php (203): Fieldtypes->get('FieldtypeFile') #3 wire/core/WireSaveableItems.php (260): Fields->makeItem(Array) #4 wire/core/Fields.php (255): WireSaveableItems->initItem(Array, Object(FieldsArray)) #5 wire/core/WireSaveableItems.php (953): Fields->initItem(Array) #6 wire/core/WireSaveableItems.php (469): WireSaveableItems->getLazy(434) #7 wire/core/Fieldgroup.php (127): WireSaveableItems->get('434') #8 wire/core/Fieldgroup.php (380): Fieldgroup->add('434') #9 wire/core/WireSaveableItemsLookup.php (135): Fieldgroup->addLookupItem('434', Array) #10 wire/core/WireSaveableItems.php (953): WireSaveableItemsLookup->initItem(Array) #11 wire/core/WireSaveableItems.php (469): WireSaveableItems->getLazy(3) #12 wire/core/Template.php (796): WireSaveableItems->get(3) #13 wire/core/Templates.php (132): Template->setRaw('fieldgroups_id', 3) #14 wire/core/WireSaveableItems.php (260): Templates->makeItem(Array) #15 wire/core/WireSaveableItems.php (953): WireSaveableItems->initItem(Array) #16 wire/core/WireSaveableItems.php (469): WireSaveableItems->getLazy(3) #17 wire/core/Templates.php (252): WireSaveableItems->get(3) #18 wire/core/PagesLoader.php (1241): Templates->get(3) #19 wire/core/Pages.php (217): PagesLoader->getById(Array) #20 wire/core/ProcessWire.php (625): Pages->init() #21 wire/core/ProcessWire.php (582): ProcessWire->initVar('pages', Object(Pages)) #22 wire/core/ProcessWire.php (315): ProcessWire->load(Object(Config)) #23 index.php (52): ProcessWire->__construct(Object(Config)) #24 {main} thrown (line 700 of wire/core/Modules.php) I tried emptying the cache folder. FieldtypeFile definitely exists in the wire folder. I also tried programmatically reloading the modules in ProcessWire.php right before Pages->init() where it fails by calling $wire->modules->reload(). This was the error I got: Error: Exception: Unable to create path: /reload/ (in wire/core/CacheFile.php line 64) #0 wire/modules/Markup/MarkupCache.module (103): CacheFile->__construct('/', 'reload', 3600) #1 wire/core/WireArray.php (2263): MarkupCache->get('reload') #2 wire/core/WireArray.php (2445): WireArray->explode('reload') #3 wire/core/Wire.php (419): WireArray->___callUnknown('reload', Array) #4 wire/core/WireHooks.php (952): Wire->_callMethod('___callUnknown', Array) #5 wire/core/Wire.php (484): WireHooks->runHooks(Object(Modules), 'callUnknown', Array) #6 wire/core/Wire.php (487): Wire->__call('callUnknown', Array) #7 wire/core/ProcessWire.php (582): Wire->__call('reload', Array) #8 wire/core/ProcessWire.php (315): ProcessWire->load(Object(Config)) #9 index.php (52): ProcessWire->__construct(Object(Config)) #10 {main} Very strange.
  4. Just released v1.1.0 with support for automatically switching to the tab that contains the first error. This way editors won’t be confused if the error is on a different tab from the one they’re currently on.
  5. @bernhard This looks very cool. How does it know to only register the hook once when you're working with multiple pages of the same class?
  6. I've taken to just creating a separate file called PageClassNameHooks.php for each PageClassName.php that needs hooks and then including it in init.php. Keeps things organized at least, and you can be sure they won't be initialized more than once.
  7. @DV-JF https://github.com/processwire/processwire-requests/issues/239
  8. @bernhard Thanks for the clarifications. I think we are on the same page now. Regarding the order agnostic application of migrations, I had assumed that it was not order agnostic because of something you said to me in the RockMigrations thread about defining dependencies after creating fields/templates. does this also work when you have migrations spread across multiple files? I guess I am also a bit confused about the difference between using the migrate() function and using the createField() and createTemplate() functions. Is it just a matter of preference or are there differences in how these are processed (i.e. do you need to put everything in a single migrate() in order for it to be order agnostic)? I didn't see anything about the difference between these functions in your documentation and it took me a while to figure out that I should use the migrate function when copying and pasting the data from the field/template back end editor.
  9. Sorry, I didn't see this comment before my previous post. I know that RockMigrations does not remove fields and templates unless you explicitly request it to. Does RockMigrations support the additional features I mentioned? Automatic update of config files when changes are made in the admin (I know it offers the copy & paste feature, which is a great start and preferable when using multiple migration files) Order-agnostic migration Field/template cleanup function for those not defined in migration files Option to only apply changes manually via cli or button press in admin
  10. @bernhard I know you've put a lot of work into your module and I can see why my post pissed you off (to be honest, after I posted it I thought about removing it because I was worried this might happen). I did "test drive" RockMigrations last week. Unfortunately, my test drive started with me trying to create and migrate a ProField for a project I'm working on, and the result was that my new field's settings were wiped out each time the migration ran. Then I read a post you wrote that made it sound like you didn't plan on supporting ProFields and didn't understand why anybody would have need for them since you don't use them yourself. All of our projects use ProFields, so it's a showstopper for us if these aren't going to be supported. And I don't feel like I should really have to justify that need and I'm not interested in arguing about it. That's why the system that I have in mind would use the existing JSON export/import mechanism from the core, which already supports migrating ProFields, and presumably will continue to support any new 1st party field types that are built. It would just bolt onto it and make the export/import process more automated. And as I described in my last post, it would be agnostic about the order of the field and template definitions so the user wouldn't have to worry about dependencies with order of import. So I'm not really sure what to say. There's no reason why we can't have more than one approach to this. You're saying that you're interested in feedback, but then it feels like you're mocking our ideas. If you think our ideas are stupid or too limiting or whatever, then at least let us have fun with them on our own :-) EDIT: I just looked over the processwire-requests thread on Github again and I see that some other people who have gotten deeper into this already have reported issues with the core JSON export/import module that would need resolving before certain fields could work. Other than the FieldtypeOptions I haven't had many issues lately in my experience. I also saw that you expressed interest in supporting the Combo field in that thread, so I apologize if I've misinterpreted. If RockMigrations can support my fields and desired workflow with just a bit of additional development (from either you, me, or someone else), then I would certainly prefer that to having to write a new module from scratch! Also, I have to say that your car analogy had me in stitches after reading it fully from start to finish. :D I agree in theory, but I would personally rather err on the side of caution. Neglecting to delete a field or template doesn't effect the operation of the system, but deleting one unintentionally (I'm picturing something like a merge conflict being resolved incorrectly) would require restoring from a backup. I see the list of deleted templates/fields as still declarative in the sense that it doesn't matter what order they're in or when they're added. It's just saying "these fields and templates should never exist". Anyway, I can see wanting it to work either way. So this could simply be a matter of a setting in the module.
  11. I've been thinking about this and I think any declarative configuration system should be extremely conservative about removing any data from the database. One way of handling this would be to have a separate location in the config for listing out the names of templates and fields that you explicitly want to remove. If an install contains a field or template not in the configuration or in the removal list, it would simply ignore it. Another approach would be to ignore any field or template not in the config, and provide a separate "cleanup" function that could be triggered with a button in the admin or a cli command. This would go through and remove any fields or templates that are not listed in the config. While the config files could be updated automatically as changes are made in the admin interface, I think that any outside changes to the config files should require a manual sync and not be applied automatically. A notice in the admin could alert the superuser that the config file contains unapplied changes and then they could click a button or use a cli command to apply the changes. The algorithm for adding new fields and templates should first check for the existence of each field and template by name. If one is missing, it should proceed to create the field or template and with its name and type (but no other settings). After that it can go back and apply the settings for everything, at which point dependencies between fields and templates should resolve without issue (family settings, page fields that reference templates in their settings, etc.). I've been tempted to try working on a module for this for a while now and was close to having a project that required it at work that would allow me to invest the time into it. That project is currently stalled but may still come about at some point at which point I could try working on this if someone else hasn't already gotten to it.
  12. Github: https://github.com/thetuningspoon/AdminPreSaveValidation This module prevents admin editors from saving changes to a page that has one or more invalid fields. It uses an ajax call to check for errors and javascript to populate the page edit form with any error messages that were returned. This way the user can correct the issues and resubmit the form without invalid data getting saved to the database or the editor losing changes. I've wanted a way to implement this common workflow in ProcessWire for some time now and this relatively simple ajax-based approach makes it possible without getting too much in the way of how ProcessWire normally works. For example, all of the post-save actions (Save + Exit, Save + View, etc.) still work as usual. The only downside is that a successful save will take a bit longer as it involves two sequential http requests (the initial ajax request that checks for errors and the normal page submit after no errors are returned). This module has also been tested successfully with repeaters and other nested inputs. By hooking after Inputfield::processInput, you can add your own custom validations to inputfields and this module will pick up on and display them as well. /* * Example of hook that adds an error to an inputfield. This will add an error to every input. */ $this->wire()->addHookAfter("Inputfield::processInput", function(HookEvent $event) { $event->object->error('Invalid input!'); }); I hope others will find this module useful!
  13. @bernhard Great video! The thing that I was confused about with RockMigrations (and the video doesn't address directly but I think I'm finally understanding anyway) is that it is about declarative template/field configurations that can be modified at any time rather than a series of instructions for updating PW. (When I think of the word "migrations", it makes me think more of files or snippets of code that apply a certain sequential set of changes for a specific feature.) So I my question now is, can I just have a single migrate.php file that has ALL of the fields and templates defined in it? Or maybe a separate file for fields and one for templates? What's the advantage of tying the migration with the page class like you did in the video vs. doing it that way? (I can see how if you built a feature you wanted to use on multiple sites (like a shopping cart) that having a separate migrate function would be better for that). My other question is what is triggering the migration to run in your video? Does the default migrate.php file just run on every page load, or just in the page editor? I would probably only want it to run via CLI. Thanks!
  14. Very cool. I developed something like this for Solution Innovators, along with a front end for our customers to view their invoices and pay off their total balance. I like how you modified the page editor here. I used separate pages for the invoice items and payments instead of repeaters because I found repeaters difficult to work with when summing and reporting data, and also mapping them to models required some hacking (or did at the time - https://github.com/processwire/processwire-requests/issues/239). How are you handling this? (or is that beyond the feature set of this project?) We also built our whole time tracking software on ProcessWire :)
  15. The way around this should be to use a selector array instead of a selector string. However, I've been having problems using selector arrays to match titles that have characters like dash (-) and pound (#). Not sure what's happening there.
  16. We had an incident where we tried to upgrade one of our sites to 3.0.200 and needed to roll back (we had only intended to upgrade the staging site but some configuration confusion led to the live database also being affected!) The site was previously on 3.0.165. When we tried to roll back the files, we were unable to because it resulted in numerous errors about missing module classes being triggered inside of other modules. Here are some examples: Uncaught Error: Class 'ProcessWire\InputfieldText' not found in /var/www/live/wire/modules/Inputfield/InputfieldEmail.module:16 Uncaught Error: Class 'ProcessWire\InputfieldCheckbox' not found in /var/www/live/site/modules/InputfieldSlideToggle/InputfieldSlideToggle.module:3 Uncaught TypeError: Argument 1 passed to ProcessWire\Pagefile::__construct() must be an instance of ProcessWire\Pagefiles, null given, called in /var/www/live/site/templates/model/TransmissionProcessor.php on line 598 and defined in /var/www/live/wire/core/Pagefile.php:131 Exception: Method Languages::hasPageNames does not exist or is not callable in this context (in wire/core/Wire.php line 564) Fatal Error: Uncaught Error: Class 'Fieldtype' not found in site/modules/FieldtypeDecimal/FieldtypeDecimal.module:13 This persisted even after clearing compiled files and triggering a module refresh. Can anyone think of what database changes might have been triggered by the upgrade from 3.0.165 to 3.0.200 that would result in these sorts of errors? I have occasionally "downgraded" ProcessWire before without having this kind of issue, or at least it wouldn't persist after refreshing modules and clearing compiled files.
  17. Sorry for the delay. At this point we're really looking for someone who is in the South Windsor, CT area or who could relocate for this full-time position. We currently work in the office 2 days a week and work from home the other three. But my boss (the owner of the company) says he is also interested in making connections as there is the possibility of contract work on an individual project basis or perhaps full time remote work at a later date.
  18. Sorry about that. I'll try to update with some more information asap.
  19. The company I work for in central Connecticut, Solution Innovators, is looking to hire a programmer with ProcessWire experience to join our small but growing team. We've been working with PW since 2012 and have numerous marketing sites and web applications built on it. Strong PHP skills are a must, with experience building object oriented systems and organizing and documenting code in a clean, maintainable and reusable fashion (like the ProcessWire core). Skills in Vue.js, javascript, jQuery, html, and css are a plus. DM me for more information!
  20. Great. I forgot (or maybe never knew?) that boot.php existed!
  21. We've built an intranet for one of clients in ProcessWire before and it worked out nicely. Be sure to test all your roles and permissions carefully by creating test users for each. You might need to do some hooks or use some modules to get the level of control you need for your users.
  22. Have you tried adding the namespace to the autoloader inside site/init.php instead of site/ready.php? wire('classLoader')->addNamespace('ProcessWire', wire('config')->paths->templates . "traits/"); If you have usePageClasses set to true in the config.php and are using the /site/classes/ folder then I would think this wouldn't even be necessary since that should already be included in the places for the autoloader to look. I haven't come across the need for traits yet, although I keep forgetting that they exist in php now. When I think of composition I usually think of moving certain functionality out into a separate class that would then be instantiated somewhere inside the other class. You can create classes that don't extend Page (perhaps that that extend Wire or WireData if you want easy API access) and then use those in your Page derived class. Your example is probably intentionally oversimplified, but sometimes I find that sometimes a bit of duplicated functionality is really just incidental and doesn't actually justify creating a new layer of inheritance or a separate class at all, especially as you might later discover that the two functions actually serve slightly different purposes and at that point are tied together and difficult to pull apart. You could also use a PW hook to add this function to both classes, although it wouldn't be as elegant.
  23. If I get some time I would love to work on building a module that would deliver a Craft CMS style solution for this, since I think that would work best for our projects. Just not sure whether I’ll get that chance or not.
  24. Thanks @bernhard, that's helpful. I'm still not sure how the typical workflow would look, though. Would you create a new file for each set of changes that you make to your site? Or do you just keep updating that one array that defines all of the templates and fields for the whole site (like a declarative configuration file)?
  25. I looked into it a while back but wasn't sure how to use it. I think I need a little tutorial that walks though a particular use case.
×
×
  • Create New...