Jump to content

Admin Actions


adrian

Recommended Posts

Try 1 or 2 GB, but do it in AdminActions.module so it's not affecting your site in general.

In reality I think that the backup method from the PW core (that AA uses) needs to be converted to use system tools like mysqldump so it is performant and won't hit these memory limits. I believe I have mentioned this to Ryan somewhere.

ProcessDuplicator has the option for this, but I'd rather see it implemented in the PW core.

Link to comment
Share on other sites

  • 4 weeks later...

Hi @adrian,

sometimes I have just stored some .csv-data in a normal processwire textarea field per copy-paste

Nothing more than for example:

id;name;age;
1;Joe;34
2;Jane;32

So far so good. 

Now I would like to do same thing (copy-paste these 3 lines of code into a textarea field) but this time these 3 lines should be "magicly" transformed into json and saved as json.

Could you may implement it as an admin action? If not could may just tell me how I could transform it to json via php or javascript but as an simple standalone script. It's not possible for me to use an online csv-to-json converter.

Hopefully my English was good enough

Stan Oliver

Link to comment
Share on other sites

@adrian thanks for your advice! I also read about FieldtypeJson but I was irritated by the warnings "Alpha state", "

To be fair, i've already set this module to be deleted 2 times, but somehow it won't delete.

Better to go for other options like Kongondo's matrix field or use the Profields.

There's big change that there will be Data loss when using this module as it relies heavily upon Javascript." and "Please us Matrix Fieldtype & Inputfield" from @kongondo. Do you guys @adrianand @kongondo think the following statement is right?

Inputfield json is for beginners and easy tasks (like I described above) faster/easyier and more comfortable to use than Matrix Fieldtype which is to be fair probably way more powerful?

 

Link to comment
Share on other sites

  • 2 weeks later...
On 12/8/2021 at 3:48 PM, adrian said:

I have used it in the past and it works really well.

Hi @adrian after reading the docs/the modules forum of Fieldtype Json I was pretty sure that module would be enough and installed without problems. If I am informed right then @Martijn Geerts stepped back from developing his module. I may ask you for help because you mentioned the module is working for you.

Problem: Installation of Fieltype Json works fine and the settings page for the module I also found. Most setting options clicked seem to save just fine but if I copy-paste  some csv-text-content into the textareafield (csv-field) under settings nothing happens (I can not even see that text was inserted) when I click on save. Can you may help me?

Alternative: which would help me too (in case you know a simple solution or some good links?

I have a standard fieldtype file in my template and uploaded a csv-file. How can I make the content data of the csv-file visible in a different textareafield? In the next step I would like that if I change content in the visible textareafield and save it everything gets synchronised with the original uploaded csv-file in the file field.

Idea: 2-way-synchronisation (maybe one way-sync could work too) between an pw file field/a single csv-file and a pw textarea field

HAPPY CHRISTMAS!

Link to comment
Share on other sites

  • 4 months later...

I’ve got a request. I love this module and use it a few times a week. The problem I just encountered is that fields that are Floats cannot be selected and updated via the “Field Set or Search and Replace” option. I’d love to see Floats added.

  • Like 1
Link to comment
Share on other sites

Hi @fuzenco - can you please do me a favor and try changing this line: https://github.com/adrianbj/ProcessAdminActions/blob/331e210404b7f883aec04c4342185c04be24d57d/actions/FieldSetOrSearchAndReplace.action.php#L23

to:

if (!$field->type instanceof FieldtypeText && !$field->type instanceof FieldtypeFloat) continue;

That should work, but please test and let me know and then I'll update the action.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

12 hours ago, adrian said:

Hi @fuzenco - can you please do me a favor and try changing this line: https://github.com/adrianbj/ProcessAdminActions/blob/331e210404b7f883aec04c4342185c04be24d57d/actions/FieldSetOrSearchAndReplace.action.php#L23

to:

if (!$field->type instanceof FieldtypeText && !$field->type instanceof FieldtypeFloat) continue;

That should work, but please test and let me know and then I'll update the action.

@adrian Amazing. That worked perfectly. The fields were selectable and I was able to update my entries as a result. Thanks much!

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

what's also weird is that now the actions are executable with no need to populate the options fields where I set 'required' => true. The actions run nonetheless and I get some Allowed memory size of 536870912 bytes exhausted Error. How can that be? It should not execute in that case. I have never changed that module and the page actions ever since it worked properly.

Link to comment
Share on other sites

  • 2 weeks later...

I'm trying to use the core admin action  Field Set or Search and Replace to set a value of a field inside a repeater field. That doesn't work, I tried with the option "Use Regex" ticked and unticked as well as the option "default" Language ticked and unticked. I guess repeater fields are more complex for this action to get the job right. Any suggestions?

Link to comment
Share on other sites

  • 4 months later...

Hi @adrian,

The "Delete Unused Templates" action is throwing an error for me in recent PW versions:

image.png.b24d0b951058dec74ee4a146cff9a282.png

Maybe related to this change mentioned in the 3.0.210 release blog post?

Quote

Updated the $templates->delete($template) method to also delete fieldgroup having the same name as the template (when that fieldgroup is not used elsewhere).

Update: adding an if($fieldgroup) test to the action seems to resolve it...

if($fieldgroup) $this->wire('fieldgroups')->delete($fieldgroup);

 

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

Hello

I maintain a website where we give access to employers from other companies to place orders. Therefore, every year we delete old users and register new ones. To do this, we have the ProcessAdminActions module installed to manipulate pages in bulk.

spacer.png

We add these selectors to the Page manipulator, so we filter the pages to only the users, with role employee. It says it will touch 10518 pages, that is the number of users we want to delete.

spacer.png

The past year we upgrade the Processwire to latest version after doing this process, and now, it tries to delete home page (/).

spacer.png

Any idea why this don't work anymore? Any other way to workaround to delete the 10k users?

Link to comment
Share on other sites

Hi @Laegnur - thanks for the report. I don't honestly know when this stopped working as expected, but I have added

array('allowCustom' => true)

to the "$pages->find" call that results from the selector you define and it works now in the latest version.

Let me know if you have any continuing issues.

Link to comment
Share on other sites

  • 2 months later...

Hi @adrian,

Is it possible for an action to return markup apart from the successMessage and failureMessage? I'd like to use MarkupAdminDataTable to show a table of results of the action.

Putting the markup in successMessage sort of works, except it has the green background so I figure it's intended for a simple sentence rather than longer markup like this.

If the module doesn't already have a solution for this that I've missed, what do you think about adding a new method similar to successMessage(), or maybe if the return value of executeAction() is a string rather than boolean the module could render that under the success/failure message?

Thanks for considering.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...