When I use update command in OSGi, the framework (Equinox) uses the file in update location in order to update the bundle. No matter if the bundle in the location has a higher version or not. for example the framework updated version 1.2.0 with 1.0.0.
is there anyway to limit the version of the file that is going to be used as the updated file? I mean something like what we can do in import bundles.
No, the framework won't do this kind of checking for you. If you don't want to update the bundle from that location, just don't call update.
Note that it is possible to update a bundle from a different location than it was originally installed from, using the version of the update method that takes an InputStream, e.g.:
File newLocation = new File("...");
bundle.update(new FileInputStream(newLocation));
Related
when deploy my Joomla Component I put in an Update File for the Database. Even if there are no changes for the Database. Is this neccessary?
AND: What are the contents? Do I have to put only these SQL-Statements for the Changes from Version 3 to Version 4 or must there be also the changes from Version 1 and Version 2?
Best Regards
DreiBaer
I've done some tests and it doesn't look like you need a SQL update file for a version of your component which doesn't need to make any database changes. However, this may not have always been the case in older Joomla version, see below.
When you install your component for on a Joomla site which doesn't already have a version of your component, the only sql file which is run is the one referenced in the install node of your manifest file. The file may be something like sql/install.mysql.utf8.sql.
So long as the site doesn't have any version of your component, then even if you are installing a later version eg, 2.3.1, and this later version does have some SQL update files, those files will not be executed, only the install file for this version (2.3.1). However in such a situation, whist the SQL update files are not executed, their version numbers are parsed and the greatest version number is stored against the component in Joomla's schemas table. If for example version 2.3.1 of your component contained the SQL update files 0.0.1.sql, 1.0.1.sql, 1.2.1.sql and 2.0.4.sql, then on first installation of this component, the schemas table will have a version_id of 2.0.4.
When updating a component the install SQL file is not executed. Joomla checks the schema version of the installed component and then executes, in order, each SQL update file which has a schema version number greater than the installed schema version number. For example if you have your component installed and it has a schema version of 1.5.2 and you're update contains the SQL update files 1.4.1, 1.5.0, 1.5.2, 1.5.19 and 1.6.0, then only SQL scripts 1.5.19 and 1.6.0 are executed and in that order.
If you install a component for the first time and it has no update file, then the schema table contains a record with a blank version_id field. If you then update that component with a version which does contain SQL update files, then the original schema version is calculated as zero and all update files are executed.
Together what this means, is that for each version of your component, the SQL install file must have all the necessary SQL statements to get the database into the correct state for your component version. On installation, even installation of a later version of your component, no updates will run, so the only SQL you can use to manipulate the database is the SQL in the install file.
So that you component can be upgraded correctly, you must have SQL update files which can take whatever the installed version is up to the version you are trying to update to. If for example an administrator has fallen behind in updating your component, and they have version 1.0.0 installed and want to update directly to your latest version, say 4.0.0, then version 4.0.0 needs to contain the updates from 1 to 2, 2 to 3, 3 to 4 and any subversions between.
There is this old article from Joomla's documentation which discusses exactly the questions you're asking, however its outdated (for version 2.5) and I think the information isn't accurate any longer.
This article says that it is necessary to have blank SQL update files for versions which don't have any SQL updates, otherwise subsequent updates with SQL update files will not be executed, however I've tested this and it doesn't seem to be a problem. This may have been true in older versions of Joomla, but is not true as of the version I tested on (3.5.7).
Its probably best practice to stick to the convention described in the documentation - including the empty SQL update files as it can't hurt, and as the behavior I found in testing is undocumented it could change without warning in the future.
The documentation also says that component version needs to match the update SQL file version, but again I found that this is no longer correct. You can use a SQL schema versioning which is totally independent from the component versioning without any problems. However, again its probably a good idea to keep schema and component version in step with each other - I can't think of a good reason why you wouldn't do this.
I want to update a module on my running WildFly10.0.0.CR4 Server with the help of a cli file on Windows.
For example I would need this to update the Infinispan plugin from version 8.0.1.Final to version 8.0.2
According to a book I am referrencing to, this could be something like
jboss-cli.bat --file=myupdate.cli
where the myupdate.cli file contains the code telling the server what to do (In this case, update Infinispan). I just need to know what to enter into that file - Best would be an example with Infinispan and a documentation on how to write such a file for other plugins by myself.
Thank you in advance!
EDIT:
It may also just delete the old version and install a completely new one, if this is easier.
You don't really want to just update random libraries/modules. Some of them, such as Infinispan, are tightly coupled to the server.
For final releases you can use patching to update an existing server. You just need to download the patch for the container you want to update.
Whenever I try to add a new package using composer like
"composer require packagename/package" or use "composer.phar update", I am getting all the installed packages updated. Is there any option in composer to exclude some package that I don't need to get updated?
run this command and see what is your package version:
composer show -i
go to composer.json and edit which package you want never change by composer update and write version correctly for that :
"jacopo/laravel-authentication-acl": "1.3.*",
change to :
"jacopo/laravel-authentication-acl": "1.3.11",
Done! now if you run composer update this package not update.
From my experience, the best way to exclude 1 or some packages is to use --interactive in composer update.
$ composer update --interactive
When you do this you can select which package you want to update and skip the package that you don't want to update.
You can supply the name(s) of a one or more packages to update:
composer update vendor1/package1 vendor1/package2 vendor2/*
and this will only update those packages.
This isn't specifically excluding, it's including, but it certainly makes updating specific packages much faster.
To avoid the update on using the require command, you'd could hand-craft the composer.json, (which isn't so hard) then run the above targetted update on the package you just added.
Also use --no-dev to exclude development packages (if you are not developing the packages you are depending on e.g. in production). This also speeds up the dependency analysis.
If you feel the need to exclude some of your packages from being updated, I'd consider this the beginning of getting into a dependency mess. You should clean up your dependencies now before it gets worse.
From my experience, the topmost reason not wanting to update a dependency is when you used a branch of a package instead of a released version. You should try to fix this as thoroughly as possible:
If you are using your own packages, tag a release version for the commits you want to use. Then switch your software to either use that exact version, or use a wildcard version requirement like 1.0.*, ~1.2 or ^1.3.4.
If you are using external code that you cannot influence directly, try to contact the developers of that code and ask them to tag a version. Tagging versions is important to maintain a sane dependency tree.
If you cannot make the external developers tag a version, find a way to tag it yourself:
Clone their repository on Github, tag a version, and include your copy of the repository instead of going to packagist.org.
Create the necessary metadata in a "type=package" repository entry in your composer.json file.
Or at the very least, when depending on the branch, assign it a version alias to allow for a smoother transition later when the external project starts tagging their versions. Note that this will not fix your current problems at all, but it may make things better in the future.
If all else fails, you might point to a certain commit id in your composer.json. This will
In general, you should always be able to run composer update unconditionally. If not, this is a warning sign for dependencies not properly declared in your own composer.json file.
The second reason for not wanting to update is incompatible changes in a package that were tagged as a bug fix instead of a major version increase. The solution for this would be simple:
First you'd have to investigate the reason for such an error: Was it really an incompatible API change? If yes, raise an issue with the developers of that package. They should create a new bug fix version with that incompatible update rolled back or fixed, and if they want to keep their change, they should tag it with a minor or major version increment, depending on what they changed.
If however you incorrectly used their code, somehow not using the public API, a bug fix is unlikely. You should try fixing your code by not using stuff that is not supposed to be the public API. For example, in recent versions of Symfony, the public API is explicitly tagged in the code and documentation - using something else will break at some point, even when doing "compatible" version updates like from 2.6.x to 2.7.x.
Another way to fix it would be to exclude the newer version inside the composer.json file: Instead of "external/package":"~1.2" you'd put "external/package":"~1.2,!1.2.5" if you find that version 1.2.5 broke your software. Or maybe you are afraid of further updates also breaking your software, you'd put in "external/package":"~1.2,!>=1.2.5".
One more thing to add: If you run composer require, you won't get updates for packages that are already installed. They are fixed. The required package will be selected based on all the installed versions, and it will only be installed if there is a version available that is compatible with all the versions already installed. Note that this will not work correctly if there are dependencies on branches of packages in both your own composer.json and the new package. The reason is that the branch name will be the same, but you'll never know which commit was being used. Maybe the new package uses a very recent commit of dev-master of a third package, and your own software a very old one, and there have been incompatible changes in between - this will break things without Composer being able to detect it.
Using composer require packagename/package, you require a new package and you get a partial update for just packagename/package and its dependencies.
composer update packagename/package can be used to trigger the same partial update, but then in case you already have packagename/package in your composer.json.
One workaround is to use replace property, however there isn't dedicated command for that, so you can run composer require foo/bar as usual (which will create composer.json), then add a new replace section for the package to ignore.
Or create composer.json file on your own. Here is the example:
{
"require": {
"radic/tmp-underscore-php": "1.2.0"
},
"replace": {
"patchwork/utf8": "*"
}
}
Once you run composer install, the required package patchwork/utf8 won't be downloaded.
I am running a module that was written by someone else. Inside the sql folder, I saw
mysql4-install-0.1.0.php
mysql4-upgrade-0.1.0-0.1.1.php
mysql4-upgrade-0.1.1-0.1.2.php
mysql4-upgrade-0.1.2-0.1.3.php
mysql4-upgrade-0.1.3-0.1.4.php
and the <version> inside config.xml is 0.1.4. Do run the correct upgrade script, do I need to make the <version> value start at 0.1.0, run the app, then move the version to 0.1.1, and run the app again .. so on. Or can I just run the app at version '0.1.4', and Magento will understand that it need to run all other previous upgrade script?
Thank you very much
You can just leave the version to 0.1.4.
Here is how it works.
When installing a module, magento looks for the install script with the biggest version that is lower or equal to the version of the module and executes it. Read this for more details.
Then it looks for all the upgrade scripts with versions between the install script determined above and the version you declared in config.xml.
So, in your case it will run all the scripts in the exact order you listed them in the question if you leave the version to 0.1.4.
The version is checked with the "core_resource" table in the database, and if the version is old then, magento searches for the necessary sql scripts to upgrade the module. To verify which version you are currently using, go to the core_resource table and check the version number for the module. Like wise if you remove the column associated with the module, then the next time any part of your magento installation is accessed, magento searches for the module, and gradually upgrades each one one by one.
I want to know if there's any way to update from all versions (Example: 1.7.1, 1.7.2...) to version 1.8.0 using a single file (Example: mysql4-upgrade-1.7.0-1.8.0) from my own module.
there is a delimiter for that?
Thanks
It's not possible to do this in the same file.
When Magento upgrades from one version to another, it will also upgrade all versions in between provided you have the files set up.
So if someone has 1.7.0, and wants to go to 1.8.0, Magento will upgrade from 1.7.0-1.7.1, then 1.7.1-1.7.2 and then from 1.7.0-1.8.0 - providing you include all the files.
Read some more on upgrade paths here:
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-6-magento-setup-resources