Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
EDC:
Download extensions for Elxis 4.x/5.x
.
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
Elxis 5.2 feature requests
« previous
next »
Print
Pages:
1
2
[
3
]
Author
Topic: Elxis 5.2 feature requests (Read 2799 times)
seadhna
Sr. Member
Posts: 380
Re: Elxis 5.2 feature requests
«
Reply #30 on:
January 12, 2021, 19:12:38 »
Assuming these are not already possible (but maybe I am wrong):
1) Enable 2-step verification to login to the CMS - is that already possible? To receive a code to mobile phone for example? e.g. Google Authenticator tool?
2) Automate weekly or daily site backups - at present is this only possible manually?
Logged
seadhna
Sr. Member
Posts: 380
Re: Elxis 5.2 feature requests
«
Reply #31 on:
January 12, 2021, 19:17:12 »
datahell, i just found your previous replies about 2-factor authentication (I was searching for 2-step verification) so please disregard my request about that.
Logged
datahell
Elxis Team
Hero Member
Posts: 9992
Automatic database backup
«
Reply #32 on:
January 12, 2021, 19:54:28 »
Regarding automatic backups:
It is not enabled by default but Elxis provides you with ready to use tools to do it.
The backup functionality from Elxis administration is helpful to those want to take a backup immediately or for those they dont have backup functionality by their hosting provider/server. I think all of you can take automatic backups from your server so you dont actually need this Elxis feature.
Elxis has built-in
cronjobs
functionality which
supports user customization
(and much more). To make a script run periodically just put it inside folder
repository/cronjobs/
and
Elxis will execute it every 10 minutes
. Off course you can make the script run once per day or once per week by setting time checkers in this file.
Custom cronjob in Elxis CMS:
repository/cronjobs/anything.php
(
anything you put here will be executed every 10 minutes
)
Inside anything.php file:
The code to take a database backup is ridiculous easy:
$sql = eFactory::getDB()->backup();
After that you must save the contents of
$sql
variable to a file.
Example:
$repo_path = $elxis->getConfig('REPO_PATH');
if ($repo_path == '') { $repo_path = ELXIS_PATH.'/repository'; }
$archive = $repo_path.'/backup/db_'.date('YmdHis').'.zip';
$elxis->obj('zip')->zip($archive, null, array('mydb.sql'=> $sql));
Full example with backup once per day:
<?php
$elxis = eFactory::getElxis();
$repo_path = $elxis->getConfig('REPO_PATH');
if ($repo_path == '') { $repo_path = ELXIS_PATH.'/repository'; }
if (!file_exists($repo_path.'/backup/db_'.date('Ymd').'.zip')) {
$sql = eFactory::getDB()->backup();
$archive = $repo_path.'/backup/db_'.date('Ymd').'.zip';
$elxis->obj('zip')->zip($archive, null, array('mydb.sql'=> $sql));
}
?>
Full example with backup once per week (every Sunday):
<?php
if (date('w') == 0) {
$elxis = eFactory::getElxis();
$repo_path = $elxis->getConfig('REPO_PATH');
if ($repo_path == '') { $repo_path = ELXIS_PATH.'/repository'; }
if (!file_exists($repo_path.'/backup/db_'.date('Ymd').'.zip')) {
$sql = eFactory::getDB()->backup();
$archive = $repo_path.'/backup/db_'.date('Ymd').'.zip';
$elxis->obj('zip')->zip($archive, null, array('mydb.sql'=> $sql));
}
}
?>
Note 1: Be careful: Make sure that the database backup will be finished successfully. On large databases/slow servers the script might face timeout errors. In this case do not use automatic database backup.
Note 2: The above script is a sample and does not contain error checking.
Note 3: Cronjobs must be enabled in Elxis configuration (they are disabled by default)
«
Last Edit: January 13, 2021, 20:58:58 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Sr. Member
Posts: 380
Re: Elxis 5.2 feature requests
«
Reply #33 on:
January 12, 2021, 22:29:41 »
This is great! I assume I change 'repository' to the name of the repositry directory. Do I also need to change 'mydb.sql' to the name of the SQL database for the website?
Logged
datahell
Elxis Team
Hero Member
Posts: 9992
Re: Elxis 5.2 feature requests
«
Reply #34 on:
January 13, 2021, 18:39:20 »
No
, dont change the "repository" name in the above code. This is ready to use code. The path to repository is provided from this code:
$repo_path = $elxis->getConfig('REPO_PATH');
If this is empty then the repository has the default name. So, the code is correct for any case.
The name of the sql file is of no importance. You can name it whatever you want.
Note:
I added
$elxis
declaration in full examples above. (
$elxis = eFactory::getElxis();
)
«
Last Edit: January 13, 2021, 18:47:13 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
michalis1984
Sr. Member
Posts: 314
Re: Elxis 5.2 feature requests
«
Reply #35 on:
January 13, 2021, 20:12:06 »
Thanks for the tutorial about the cronjobs on Elxis, Datahell. I wasn't aware of this feature of Elxis. This was like an Elxis update for me. This is why Elxis is amazing. It can "update" even without update
Logged
datahell
Elxis Team
Hero Member
Posts: 9992
Cronjobs
«
Reply #36 on:
January 13, 2021, 20:53:12 »
Most of you you use Elxis only as a CMS, but Elxis is a framework too and has many-many tools for developers. For cronjobs I must write a tutorial to present you its full potentials. However this is why this forum exists. If you have a question just ask and you will get instructions.
A few more words regarding Cronjobs.
Elxis has 2 options: Elxis cronjobs and external cronjobs.
1. Elxis cronjobs
: Elxis is a web application. It runs when you request a page. So if no one asks for a page nothing will run and not even cronjobs will be executed. Although this might sounds like a problem it is not a problem on an online site as guests, web crawlers, etc, often visit all sites. However the cronjobs will not be absolutely accurate. For instance instead of 10 minutes the time interval between 2 successive cronjobs executions might be 12 minutes. Not a problem if you want the cronjobs to be executed once per day. The more clicks your site has the more accurate Elxis cronjobs will be. If you need absolute accuracy in cronjobs execution, or you need to be executed on a very specific time you can go to option 2.
2. External cronjobs.
Enable them in Elxis configuration, click apply, copy-paste the URL Elxis provides you. Go to your hosting control panel and set a cronjob to the URL Elxis gave you and set the execution time to whatever you want (eg at 03:15 every Saturday). This way you have absolutely accurate cronjobs for your Elxis without site visitors interference. Also note that in this case the "execution probability" setting has no affect. See attached screenshot.
«
Last Edit: January 13, 2021, 21:00:49 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Sr. Member
Posts: 380
Re: Elxis 5.2 feature requests
«
Reply #37 on:
January 14, 2021, 13:21:48 »
The backup script is working for me now. Thanks for this - really helpful datahell.
Logged
Print
Pages:
1
2
[
3
]
« previous
next »
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
Elxis 5.2 feature requests