When I update an object with an Extbase repository (e.g. in a cronjob or in the frontend) like this...
$myRepository->update($myObject);
and afterwards I use button "Display change history / Un-do" for this record in TYPO3 BE, I don't see any history. I only see a history when editing the object in TYPO3 BE.
How can I enable the history?
Short version: you can't, because the history is for changes done in the backend interface only.
Longer version: you sort of, kind of can, but that would involve quite a bit of custom code in your repository which would do one of two things:
Override the update method on your repository and from it, fire DataHandler methods to update the record - then use the persistence session to mark your object as clean so Extbase doesn't try to persist it again. Updates via DataHandler will write the history.
Also override the update method but write the history records manually instead of allowing DataHandler to do it.
The first solution is very complex to handle. The second one means you have to implement a bit of (duplicated) code and likely won't cause all the usual hooks to trigger in TYPO3 (which is usually fine but does sometimes cause trouble with third party extensions). If you are forced to do this, I would choose the second solution. But I would first of all consider if perhaps the need to have BE-specific history for anonymous (no BE user) editing that's bordering on abuse of what that undo history was also intended for: tracing who made a change.
Related
General situation
We have a project on GitHub and in hosted.weblate in the libre plan.
The weblate project contains 3 components and a glossary.
Two languages are already completely translated and we use the continuous localization workflow.
There are some additional languages from the very kind community. However, these are not complete(d yet), so they cause problems in the front end (like showing no text or the plain string.variable.name).
What should be achieved?
We would like to have the incomplete languages only available after they are complete (at least have no empty strings). So they should be pushed only if either a manual flag is set/removed or at a certain completeness level. Is there a way or best practice on how to deal with that?
Ideas to achieve it (but no idea if this is possible)
An idea would be to only commit changes on languages, that have a certain overall completeness level. For the languages that are completed already we would ideally keep the continuous translation workflow. Also manual commits are problematic, since they would commit also the incomplete languages.
Is there a way to set a flag or achieve a .gitignore like behaviour for certain languages in weblate? When they are not empty anymore, we could of course manually activate the languages.
I've set up a translation project for Syncthing on Hosted Weblate, which was previously handled through Transifex. There was already some tooling in place which respects this completeness filter, and it was pretty easy to adapt to Weblate.
Basically we don't push Weblate changes back to the upstream repo, but pull them in through a regularly called script, together with some other housekeeping tasks like an authors list. The script checks the statistics on every available language and if the completion is above 95 percent, the language is added to a "valid" list, which the GUI uses to offer choices. Translations previously on that list drop off only if they fall below 75 percent completion.
In any case, the script downloads the most recent translation files and commits them to the upstream repo for archival reasons. When this happens, Weblate picks up the new commits and rebases its internal repo. That also allows integrating translation contributions from other sources easily.
It is currently not possible, but there is issue tracking this: https://github.com/WeblateOrg/weblate/issues/3745
When I update an object with an Extbase repository (e.g. in a cronjob or in the frontend) like this...
$myRepository->update($myObject);
and afterwards I use button "Display change history / Un-do" for this record in TYPO3 BE, I don't see any history. I only see a history when editing the object in TYPO3 BE.
How can I enable the history?
Short version: you can't, because the history is for changes done in the backend interface only.
Longer version: you sort of, kind of can, but that would involve quite a bit of custom code in your repository which would do one of two things:
Override the update method on your repository and from it, fire DataHandler methods to update the record - then use the persistence session to mark your object as clean so Extbase doesn't try to persist it again. Updates via DataHandler will write the history.
Also override the update method but write the history records manually instead of allowing DataHandler to do it.
The first solution is very complex to handle. The second one means you have to implement a bit of (duplicated) code and likely won't cause all the usual hooks to trigger in TYPO3 (which is usually fine but does sometimes cause trouble with third party extensions). If you are forced to do this, I would choose the second solution. But I would first of all consider if perhaps the need to have BE-specific history for anonymous (no BE user) editing that's bordering on abuse of what that undo history was also intended for: tracing who made a change.
Requirement
make history for web text/code source files.
login-worker is only me, i.e personal usage.
automatically save history for each updated files(no require at once but at least once per week)
It must be a simple way to start and work.
I have 3 work places so need to do async files.
(not must but hopefully for future working environment) Any other non-engineer can also understand the location of history file and can see it easily.
Current way:
I made history folder the day, download files in there for edit, copy files when I edit/creat new one.
Advantage of the current way:
Very quick and simple, no need to do additional task to make history
Disadvantage of the current way:
Messy. Whenever day I work, I create a new history folder to keep downloaded files, so that it is messy in Finder(or windows explore).
Also, I don't have a way to Doing Async files for sure with in other places.
I tested to use GIT before, I had Thought GIT automatically save files I edit and save with a editor, but that was not the case. Also GIT is too complicated to use/start. If you recommend GIT, you need to show me ways to deal with the problem I had, for instance, simple GIT GUI with limited options without merging/project/branch etc because of personal usage for maintaining just one website.
Do you know any way to do version control personally and simply?
Thanks.
Suppose you entered <form ...> in your HTML—without the closing tag—and saved the file; do you really think the commit created by our imaginary VCS picked up that file's update event would have any sense?
What I mean, is that as with writing programs¹,
the history of source code changes are there for humans to read,
and for that matter, a good history graph should really read like a prose:
each commit should be atomic in the sense it comprises one (small) but
internally integral feature or fixes a bug, and had to be properly annotated
so that the intent of the change captured by that commit is clear.
What you want instead is just some dumb stream of changes purely for backup purposes.
Well, if you're fully aware of the repercussions (the most glaring one is that the generated history is completely useless for doing development on
the project and can only be used for rollbacks in case of "oopsies"),
there are two ways to go:
Some IDEs (namely, Eclipse) save a backup copy of each file they manage
on each save—thus providing your with such a rollback functionality w/o
using any VCS.
Script around any VCS you like: say, on Linux,
you start something like inotifywait telling it to watch your
project's root directory, recurvively, for write events on files,
read whatever the tool prints to its stdout when these events happen,
and for each event, call to your VCS of choice to record a new commit
with these changes.
¹ «Programs must be written for people to read, and only incidentally for machines to execute.» — Abelson & Sussman, "Structure and Interpretation of Computer Programs", preface to the first edition.
I strongly suggest you to have a deeper look at git.
It may looks difficult at the beginning, but you should spend some time learning it, that's all. All the problems above could be easily solved if you spend some time to learn the basics. There is also a nice "tutorial" on github on how to use git, no need to install anything: https://try.github.io/levels/1/challenges/1.
I am working on a ModX website (mainly templates but also system settings, user management, etc) while a development website is already online with the customer starting to input the content.
I haven't found a practical solution to push my work online (layouts are stored in the database) without overriding the content input by the customer (in the database as well).
My present workflow consists of first replacing my local modx_site_content table with the one extracted from the online database, then push this hybrid database online. Not practicle, plus I am not sure user changes are confined to modx_site_content only.
There must be a better workflow though! How do you handle this?
I don't think it gets any easier than selecting the tables you need and exporting only those into the live environment. Assuming you only work on templating, the template, snippet & chunk tables are all you need to export.
We usually take a copy, develop, and merge only once when the new features are supposed to go live this minimizes this trouble. Also the client can continue normally until d-day.
If youre doing a lot of snippet work you could always just include an actual php file instead and work with your editor directly towards those files, connect them to git and what not.
If you project is not really big, you can store your chunks/resources, etc. in a separate files (there is and option called "Static Resource"), and then, manage your changes with git. Otherwise, you need to store user data in a separate table and deploy the whole database with Fabric, for example.
I am aware of Notify extension by Mercurial, but it always notify on any push action. What I want is that a notification only when a certain branch (say, "stable") is updated because I need others to take action when this happens.
What's the easiest way to achieve this functionality?
I think the simplest thing would be to extend the notify extension to do that (and add a new configuration choice). It should be quite simple (the hardest is to find the right ui so that we can add it upstream).
It's not a great workaround, but you could very easily write a hook that moves only changesets on stable over to a separate clone called (for example) email-trigger, and then have notify turned on there.
Or, have the emails go to an internal mailing list and set the spam filter on that list to throw away any emls without branch: stable in them, which will filter them away before the users see them.