Question Fancy Gendex - autocreate by cronjob?
- HonkXL
- Topic Author
- Offline
- Junior Member
Less
More
7 years 10 months ago #1
by HonkXL
My homepage: genealogie-weiland.de
My webtrees: wt.genealogie-weiland.de
Fancy Gendex - autocreate by cronjob? was created by HonkXL
Hi,
at moment I try to get everything I do manually at moment get done by cronjobs.
Is there a way to generate the output file using Fancy Gendex by an cronjob, instead of clicking the button manually?
at moment I try to get everything I do manually at moment get done by cronjobs.
Is there a way to generate the output file using Fancy Gendex by an cronjob, instead of clicking the button manually?
My homepage: genealogie-weiland.de
My webtrees: wt.genealogie-weiland.de
Please Log in or Create an account to join the conversation.
- JustCarmen
- Offline
- Elite Member
7 years 10 months ago #2
by JustCarmen
Carmen
Designer of the JustLight theme (comes with a light and dark color palette), Fancy Imagebar, Fancy Research Links and Fancy Treeview for webtrees 2
Check my website at www.justcarmen.nl
Replied by JustCarmen on topic Fancy Gendex - autocreate by cronjob?
I am not familiar enough with cronjobs to guide you through, but you should be able to find a way to submit the form automatically.
This is the piece of code that is activated after you hit the submit button
It will run the function createGendex(), which can be found in the FancyGendexClass.
This is the piece of code that is activated after you hit the submit button
Code:
if (Filter::post('action') == 'save' && Filter::checkCsrf()) {
foreach (Tree::getAll() as $tree) {
$tree->setPreference('FANCY_GENDEX', Filter::postBool('FG' . $tree->getTreeId()));
}
$this->module()->createGendex();
}
It will run the function createGendex(), which can be found in the FancyGendexClass.
Carmen
Designer of the JustLight theme (comes with a light and dark color palette), Fancy Imagebar, Fancy Research Links and Fancy Treeview for webtrees 2
Check my website at www.justcarmen.nl
Please Log in or Create an account to join the conversation.
- HonkXL
- Topic Author
- Offline
- Junior Member
7 years 9 months ago #3
by HonkXL
My homepage: genealogie-weiland.de
My webtrees: wt.genealogie-weiland.de
Replied by HonkXL on topic Fancy Gendex - autocreate by cronjob?
Hi,
thank you for your answer.
At moment I have this part of code running. Every day a cron job executes it and it puts all my trees to my data-directory. The code is executed using wget, so it's just calling the php-file in the browser. Nothing special.
I tried to put your code inside the foreach, but it is not really working.
I think there are some dependencies in your code, but I don't know much enough about php to get this running.
thank you for your answer.
At moment I have this part of code running. Every day a cron job executes it and it puts all my trees to my data-directory. The code is executed using wget, so it's just calling the php-file in the browser. Nothing special.
I tried to put your code inside the foreach, but it is not really working.
Code:
<?php
define('WT_SCRIPT_NAME', 'autoexport.php');
// Pretend to be USER #1, with a real browser
$_SESSION['wt_user'] = 1;
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0';
require 'includes/session.php';
foreach (\Fisharebest\webtrees\Tree::getAll() as $tree) {
$stream = fopen($tree->getName() . '.ged', 'w');
$tree->exportGedcom($stream);
fclose($stream);
}
foreach (glob("*.ged") as $filename) {
rename("$filename", "./data/"."$filename");
}
?>
I think there are some dependencies in your code, but I don't know much enough about php to get this running.
My homepage: genealogie-weiland.de
My webtrees: wt.genealogie-weiland.de
Please Log in or Create an account to join the conversation.