TYPO3: Schedule SQL statement - typo3

Is there and easy way to schedule a SQL call in TYPO3?
A core function or extension to schedule a custom SQL call?
It is for old TYPO3 4.5.29.
If someone now same thing for TYPO3 6.1/6.2 then I would like to read about that too.

There is a Scheduler, that is supposed to be executed via cronjob. You can add your own tasks to the Scheduler from an extension and define how often it should be executed. The Scheduler comes with the core. You maybe have to install it.
Further Information about how to do it:
http://docs.typo3.org/typo3cms/extensions/scheduler/latest/DevelopersGuide/CreatingTasks/Index.html
http://www.typo3lexikon.de/typo3-tutorials/extensions/scheduler.html
http://docs.typo3.org/typo3cms/extensions/scheduler/latest/Index.html

Related

Creating a custom powershell module without exposing code

I want to create a custom powershell module that I can distribute without exposing the code. The script includes API calls with app specific private keys that I don't want to compromise. I've seen a lot of discussions about this over the years, but nothing that really solves my problem.
Is there a good way to create a custom powershell module without exposing the underlying code? I want to be able to distribute the powershell module, for others to import or install.
this may be what you are looking for : https://www.powershellgallery.com/packages/ps2exe/1.0.11
but be careful, the API key will still be in the compiled file at someplace. You can try and cipher it, but if it's needed for your script, it will be in your file no matter how you try to hide it. the question is why do you need to ship it inside your script in the first place ? I mean that any of your script's user will be using your private key which is likely not what you want to do

Only run my sails.js hook on `sails lift`, not `sails run`

I have a custom sails.js hook which implements a Websocket server (we can't use the built-in socket.js hook because we needed to match an old API).
I also have a custom sails run script that does background processing.
Right now, when the sails run -name-of-my-script command is run, it also runs my hook which makes extra listeners for all of the events used by this hook.
I would like to make it that the hook only starts on a main application startup (sails lift or the equivalent node app.js), not on sails run ....
I have looked through the code and the documentation, but I can't seem to see any official way to do this.
I can think of two options:
In the hook, check for whether a script is being run and don't initialize.
In the script, disable the hook.
Is there any way to do either of those things?
Right now, there is no built-in way to do this because Sails scripts have no way to modify configuration - they use the default sails instance with its default settings.
Here is the hack that I used to make it work:
Add a check for a configuration option in the hook's initialize method:
if (app.config.notifier.active === false) {
sails.log.verbose('Notifier disabled');
return cb();
}
// Continue with notifier hook setup here
Add setting an environment variable to the top of the script (before the module.exports:
process.env.sails_notifier__active = false;
(Note: Step 1 is based on this answer but the package linked there no longer uses this technique. That question and answer are also extremely old -- at least as Sails.js answers go -- from before sails run existed.)

Create new work item type using VSTS Extension

Based on the documentation https://learn.microsoft.com/en-us/vsts/extend/overview?view=vsts#what-makes-up-an-extension, a VSTS extension can be used to extend the work item form.
However, I would like my extension to automatically create a new work item type once it is installed. Is this something that is possible? I can't find any documentation online that suggests how to do it.
Theoretically this is possible, the extension has a "first load" call which you can use to use the rest api to create a custom process or update the existing custom process. The REST Api to change processes isn't public yet, so you'll have to work from using fiddler to watch how the web ui does it.
Due to the way processes are linked to projects, all projects with that process will get the new work item type.
I could not find a lot of documentation online for this, but the VSS web extensions SDK(https://www.npmjs.com/package/vss-web-extension-sdk) has a REST client called 'ProcessDefinitionsRestClient' declared in the typings/tfs.d.ts file. This client has a createWorkItemType method available that looks like this:
createWorkItemType(workItemType: ProcessDefinitionsContracts.WorkItemTypeModel, processId: string): IPromise<ProcessDefinitionsContracts.WorkItemTypeModel>;.
The 'ProcessRestClient' client has methods to create a new/inherited process to which the new WIT can be added.
I have not tried it out yet, and these APIs are still in preview, but maybe they can get you started on the right path.

How to trigger scheduler job immediately in liferay 6.1.1

for project needed, I need a button when I click it it will trigger a scheduler job immediately in liferay 6.1.1. I know before liferay 4.2 there is a API JobScheduler.triggerJob() to make it happen. but in the 6.1.1 this API is removed, is there any other way I can do this? Thanks a lot.
I guess better way is to execute your process service method on button click event rather than manually triggering a job. If you already have a job, it can call the same process service method.
However below information can be useful if you want to got with custom schedule a job.
SchedulerEngineHelperUtil.schedule menthod will accept custom trigger. Liferay allows to specify cron express as trigger. You can use below expression to trigger immediately.
* * * * * ? *
An example code custom scheduler can be found in LayoutServiceImpl.schedulePublishToLive method.
I believe you can do similar with above cron express to invoke a job immediately.
Trigger trigger = new CronTrigger(
jobName, groupName, schedulerStartDate, schedulerEndDate, cronText);
SchedulerEngineHelperUtil.schedule(
trigger, StorageType.PERSISTED, description,
DestinationNames.LAYOUTS_LOCAL_PUBLISHER, publisherRequest, 0);

php plugin or library to let users set cron?

i am making a CMS,
I need a premade solution that lets users set time for CRON ?
it'd be nice if stuff like ajax calendar was also included.
Here's a nice tutorial of how to make such thing: http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/
Also, you can try this:
http://greenservr.com/projects/crontab/crontab.phps
This worked for me because the rule for crontab at my hosting provider is that every 30 seconds some script looks for a file with rules for crontab in the main directory. It reads it and launches the jobs if necessary.