Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
Convert
Wordpress to Elxis
with
Elxis importer
!
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
How to know the version of the upgrade
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to know the version of the upgrade (Read 5046 times)
acampball
Full Member
Posts: 162
How to know the version of the upgrade
«
on:
May 05, 2014, 20:04:39 »
I need to upgrade components to determine which version was previously installed in the class "..._installer" to update() method to perform the desired scripts.
Logged
datahell
Elxis Team
Hero Member
Posts: 10358
Re: How to know the version of the upgrade
«
Reply #1 on:
May 06, 2014, 09:20:29 »
We are aware of this issue.
In Elxis 4.2 we will provide an input variable in method "update" that will be the old version of the extension we are going to update.
public function update(
$oldversion=''
) {
}
But this is not yet (Elxis 4.1) available.
Tip for Elxis 4.0 and 4.1
As the filesystem is being updated by Elxis automatically what you really need to do in the
update
method is some custom file actions and update of the database. By checking the status of these things you can determine the old version. In some other cases you already know the old version. For example if you update to version 1.1 you know 100% that the previous version was 1.0 because there is no other previous version. If you upgrade to version 1.2 to determine which was the previous version, 1.0 or 1.1, you can check if something you implemented in 1.1 exist. If yes then the old version is 1.1 else it is version 1.0. This has meaning only for database columns and tables. So check if a database column exist or if a db table exist.
SQL query to get database table columns
SHOW COLUMNS FROM table_name;
SQL query to get list of database tables
SHOW TABLES FROM db_name;
Full example
$elxis = eFactory::getElxis();
$db = eFactory::getDB();
$mytable = $elxis->getConfig('DB_PREFIX').'something';
//db table to look if exists
$sql = "SHOW TABLES FROM ".$db->quoteId($elxis->getConfig('DB_NAME'));
$stmt = $db->prepare($sql);
$stmt->execute();
$tables = $stmt->fetchCol();
if (!in_array($mytable, $tables)) {
//table does not exist --> create it!
}
If the above didn't gave you a solution please specify the problem to propose you something else.
Note for Elxis 4.2
Elxis 4.2 will have an
automatic update functionality
for all installed third party extensions as well as Elxis core. With a single click new versions of installed extensions will be downloaded and
updated automatically
. We work on this at this momment.
«
Last Edit: May 06, 2014, 09:35:59 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
acampball
Full Member
Posts: 162
Re: How to know the version of the upgrade
«
Reply #2 on:
May 06, 2014, 09:54:34 »
Thanks for the complete answer!
Logged
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
How to know the version of the upgrade