Refer to the plugins compatibility table and increment the versions of your plugins (take the most recent 4.1-compatible version for each plugin ): Plugins
Database
The structure of the SQL Authentication_Token table has changed. Delete it so that it can be recreated correctly, or modify the table to add the Creation_Date (DATETIME) column.
MySQL
Oops!
Copy to clipboard failed. Open the code and copy it manually.
ALTER TABLE Authentication_Token ADD creation_date datetime;
ALTER TABLE Authentication_Token ADD last_update_date datetime;
ALTER TABLE Authentication_Token ADD creation_date datetime;
ALTER TABLE Authentication_Token ADD last_update_date datetime;
ALTER TABLE Authentication_Token ADD creation_date datetime;
ALTER TABLE Authentication_Token ADD last_update_date datetime;
The rights identifier linked to the reference tables has been modified. Run the following script on the rights DB:
Update rights identifier
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#Si besoin il faut passer en safe updates
#SET SQL_SAFE_UPDATES = 0;
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables' Where Right_Id='CMS_Rights_SimpleContents';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Create' Where Right_Id='CMS_Rights_SimpleContents_Create';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Delete' Where Right_Id='CMS_Rights_SimpleContents_Delete';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Import' Where Right_Id='CMS_Rights_SimpleContents_Import';
#SET SQL_SAFE_UPDATES = 1;
#Si besoin il faut passer en safe updates
#SET SQL_SAFE_UPDATES = 0;
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables' Where Right_Id='CMS_Rights_SimpleContents';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Create' Where Right_Id='CMS_Rights_SimpleContents_Create';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Delete' Where Right_Id='CMS_Rights_SimpleContents_Delete';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Import' Where Right_Id='CMS_Rights_SimpleContents_Import';
#SET SQL_SAFE_UPDATES = 1;
#Si besoin il faut passer en safe updates
#SET SQL_SAFE_UPDATES = 0;
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables' Where Right_Id='CMS_Rights_SimpleContents';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Create' Where Right_Id='CMS_Rights_SimpleContents_Create';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Delete' Where Right_Id='CMS_Rights_SimpleContents_Delete';
update Rights_ProfileRights set Right_Id='CMS_Rights_ReferenceTables_Import' Where Right_Id='CMS_Rights_SimpleContents_Import';
#SET SQL_SAFE_UPDATES = 1;
The assignment of rights to reference tables is stored in the database under the "/reference-tables" context, formerly "/simple-contents".
You must either manually reassign your rights to these content types, or update the database using the following scripts:
MySQL
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#Si besoin il faut passer en safe updates
#SET SQL_SAFE_UPDATES = 0;
update Rights_AllowedGroups set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedUsers set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedProfilesAnonym set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedProfilesAnyCon set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedGroups set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedUsers set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedProfilesAnonym set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedProfilesAnyCon set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
#SET SQL_SAFE_UPDATES = 1;
#Si besoin il faut passer en safe updates
#SET SQL_SAFE_UPDATES = 0;
update Rights_AllowedGroups set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedUsers set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedProfilesAnonym set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedProfilesAnyCon set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedGroups set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedUsers set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedProfilesAnonym set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedProfilesAnyCon set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
#SET SQL_SAFE_UPDATES = 1;
#Si besoin il faut passer en safe updates
#SET SQL_SAFE_UPDATES = 0;
update Rights_AllowedGroups set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedUsers set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedProfilesAnonym set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_AllowedProfilesAnyCon set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedGroups set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedUsers set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedProfilesAnonym set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
update Rights_DeniedProfilesAnyCon set Context = CONCAT('/reference-tables', SUBSTR(context, 17, LENGTH(context))) Where Context like '/simple-contents%';
#SET SQL_SAFE_UPDATES = 1;
Derby
Oops!
Copy to clipboard failed. Open the code and copy it manually.
update rights_allowedusers set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedgroups set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedprofilesanonym set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedprofilesanycon set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedgroups set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedusers set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedprofilesanonym set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedprofilesanycon set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedusers set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedgroups set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedprofilesanonym set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedprofilesanycon set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedgroups set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedusers set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedprofilesanonym set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedprofilesanycon set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedusers set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedgroups set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedprofilesanonym set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_allowedprofilesanycon set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedgroups set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedusers set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedprofilesanonym set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
update rights_deniedprofilesanycon set Context = '/reference-tables' || SUBSTR(context, 17, LENGTH(context)) Where Context like '/simple-contents%';
New configuration parameters
When you restart the application, you will be prompted for two new configuration parameters:
Search and Index > Server Solr > Solr IP address (cms.solr.core.allowedips) Enter server IP address Solr or leave blank if you don't want to protect Solr -> requests. CMS
Websites > Front-offices > Empty full cache on startup (web.invalidate.focache.scheduler.enabled) Enables site cache to be emptied each time CMS is restarted. If the CMS and site applications are on the same server, you don't need to check this box.
Technical migration
Update runtime files.xml
In the file WEB-INF/param/runtime.xml of the applications CMS and site, replace :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
rename workflow-simple-content.xml to workflow-reference-table.xml
in the same file, replace: org.ametys.cms.workflow.CreateSimpleContentFunction with org.ametys.cms.workflow.CreateReferenceTableContentFunction
Dans le fichier workflows.xml, remplacer : <workflow name="simple-content" type="file" location="workflow-simple-content.xml"/> par <workflow name="reference-table" type="file" location="workflow-reference-table.xml"/>
Depublishing workflow
In your workflow files, look for the unpublish action (normally #10) and add the post-function org.ametys.cms.workflow.SetCurrentStepIdAndNotifyFunction The absence of this post-function was responsible for this outcome https://issues.ametys.org/browse/CMS -8648
Oops!
Copy to clipboard failed. Open the code and copy it manually.
If you use plugin ContentIO and its workflow file workflow-contentio.xml, synchronization actions 810, 820 and 830 have been combined into a single action 800 with conditional results.
Ajoutez l'action 800 suivante dans la section <common-actions>
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Puis supprimez les actions 810, 820, et 830 et les remplacer par la référence à l'action 800 : <common-action id="800" />. Attention, veiller à bien ordonner les action et common-action : d'abord lister les common-action ensuite les actions.
You can also retrieve the workflow-contentio.xml file from the demo template if you haven't made any customizations to this file.
This modification simplifies our workflow files, but the downside is that in the history of content previously synchronized with actions 810, 820 or 830 you'll see "Action unknown" on the few transitions.
Dependencies ivy
If you use project spaces (plugin workspaces), add this line toivy.xml for your site application only:
Oops!
Copy to clipboard failed. Open the code and copy it manually.
The additional "defaultLocale" argument resolves multilingual metadata to the correct locale. If your content is not multilingual content, or if you don't use multilingual metadata, you can set this argument to null .
If you use this helper in your application's java classes, make the necessary changes.
Reference table
Content types called "simple" become "reference table" content types. All "reference table" content types have their own search tool, accessible from the "Reference table" menu. The notion of simple content still exists, i.e. content types with only the metadata of simple types, with no composites or repeaters. A reference table is not necessarily a simple content type.
In all your content type definitions :
1) Find widget edition.select-simple-content and replace it with edition.select-referencetable-content
2) Remplacez le tag <cms:tag>simple</cms:tag> par <cms:tag>reference-table</cms:tag>
JS renderers and converters (for search engines)
These JS functions have been moved. If you're defining search patterns, then you're probably referencing some of them.
Search XML Ametys.cms.content.EditContentsGrid.render and replace with Ametys.plugins.cms.search.SearchGridHelper.render
Search the files XML Ametys.cms.content.EditContentsGrid.convert and replace with Ametys.plugins.cms.search.SearchGridHelper.convert
New icons and decorators
Dans le template, le fichier default-workflow/plugin.xml a été modifié par l'ajout de <icon-decorator-type> suivant les balises <icon-decorator>. Faire un diff avec le template par exemple pour ajouter ces nouvelles balises.
Authentication token
Tokens are now encoded in base 64, so the old ones are no longer valid.
No migration is planned for existing tokens, which must be revoked and recreated.
Graphics migration
Resized images
In all your XSL files, look for the use of the resolveBoundedImage method with 4 arguments resolveBoundedImage(String type, String uri, int maxHeight, int maxWidth)
In this method, height and width were inverted by mistake; now it's maxHeight then maxWidth. Check your calls to this method: make sure that the requested height is the 3rd argument, and the width is the 4th argument.
In addition, the following i18n keys must be modified ( WEB-INF catalog/i18n/application*.xml)
Oops!
Copy to clipboard failed. Open the code and copy it manually.
<!-- login.xsl -->
<message key="LOGIN_SCREEN_INTRO_AMETYS_TITLE">Essayez Ametys</message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_DESCRIPTION"></message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_AVAILABLE_IDENTIFIERS">Les identifiants suivants sont disponibles :</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_TITLE">Rejoignez la communauté Ametys</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DESCRIPTION">Les ressources suivantes vous permettront de trouver la documentation et le support dont vous pourriez avoir besoin.</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_WEBSITE">Site web www.ametys.org</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DOC">Documentation Wiki Ametys</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_FORUM">Forum de la communauté</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_ISSUES">Signalisation de bugs et demandes d'évolutions</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TITLE">Suivez-nous sur les réseaux :</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_FACEBOOK">Suivez-nous sur Facebook</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TWITTER">Suivez-nous sur Twitter</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_GOOGLE_PLUS">Suivez-nous sur Google+</message>
<!-- login.xsl -->
<message key="LOGIN_SCREEN_INTRO_AMETYS_TITLE">Try Ametys</message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_DESCRIPTION"></message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_AVAILABLE_IDENTIFIERS">The following identifiers are available:</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_TITLE">Join the Ametys community</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DESCRIPTION">The following resources will allow you to find the documentation and support you need:</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_WEBSITE">www.ametys.org website</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DOC">Ametys wiki documentation</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_FORUM">Community forum</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_ISSUES">Features and issues tracking</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TITLE">Follow us on social media</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_FACEBOOK">Follow us on Facebook</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TWITTER">Follow us on Twitter</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_GOOGLE_PLUS">Follow us on Google+</message
<!-- login.xsl -->
<message key="LOGIN_SCREEN_INTRO_AMETYS_TITLE">Essayez Ametys</message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_DESCRIPTION"></message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_AVAILABLE_IDENTIFIERS">Les identifiants suivants sont disponibles :</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_TITLE">Rejoignez la communauté Ametys</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DESCRIPTION">Les ressources suivantes vous permettront de trouver la documentation et le support dont vous pourriez avoir besoin.</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_WEBSITE">Site web www.ametys.org</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DOC">Documentation Wiki Ametys</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_FORUM">Forum de la communauté</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_ISSUES">Signalisation de bugs et demandes d'évolutions</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TITLE">Suivez-nous sur les réseaux :</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_FACEBOOK">Suivez-nous sur Facebook</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TWITTER">Suivez-nous sur Twitter</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_GOOGLE_PLUS">Suivez-nous sur Google+</message>
<!-- login.xsl -->
<message key="LOGIN_SCREEN_INTRO_AMETYS_TITLE">Try Ametys</message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_DESCRIPTION"></message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_AVAILABLE_IDENTIFIERS">The following identifiers are available:</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_TITLE">Join the Ametys community</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DESCRIPTION">The following resources will allow you to find the documentation and support you need:</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_WEBSITE">www.ametys.org website</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DOC">Ametys wiki documentation</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_FORUM">Community forum</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_ISSUES">Features and issues tracking</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TITLE">Follow us on social media</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_FACEBOOK">Follow us on Facebook</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TWITTER">Follow us on Twitter</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_GOOGLE_PLUS">Follow us on Google+</message
<!-- login.xsl -->
<message key="LOGIN_SCREEN_INTRO_AMETYS_TITLE">Essayez Ametys</message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_DESCRIPTION"></message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_AVAILABLE_IDENTIFIERS">Les identifiants suivants sont disponibles :</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_TITLE">Rejoignez la communauté Ametys</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DESCRIPTION">Les ressources suivantes vous permettront de trouver la documentation et le support dont vous pourriez avoir besoin.</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_WEBSITE">Site web www.ametys.org</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DOC">Documentation Wiki Ametys</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_FORUM">Forum de la communauté</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_ISSUES">Signalisation de bugs et demandes d'évolutions</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TITLE">Suivez-nous sur les réseaux :</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_FACEBOOK">Suivez-nous sur Facebook</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TWITTER">Suivez-nous sur Twitter</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_GOOGLE_PLUS">Suivez-nous sur Google+</message>
<!-- login.xsl -->
<message key="LOGIN_SCREEN_INTRO_AMETYS_TITLE">Try Ametys</message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_DESCRIPTION"></message>
<message key="LOGIN_SCREEN_INTRO_AMETYS_AVAILABLE_IDENTIFIERS">The following identifiers are available:</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_TITLE">Join the Ametys community</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DESCRIPTION">The following resources will allow you to find the documentation and support you need:</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_WEBSITE">www.ametys.org website</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_DOC">Ametys wiki documentation</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_FORUM">Community forum</message>
<message key="LOGIN_SCREEN_INTRO_RESOURCES_ISSUES">Features and issues tracking</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TITLE">Follow us on social media</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_FACEBOOK">Follow us on Facebook</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_TWITTER">Follow us on Twitter</message>
<message key="LOGIN_SCREEN_INTRO_NETWORKS_GOOGLE_PLUS">Follow us on Google+</message
HTML5 player for video and audio galleries
Version 2.1.0 of plugin multimedia replaces the Flash player with an HTML5 player: Plugin Multimedia v2.1.0 - What's new As a result, the FLV format is no longer supported, in favor of mp4, ogv, ogg and webm formats.
If you have video galleries that use FLV files, you will need to migrate them to the supported formats. If you have overloaded the gallery rendering, you will certainly need to repeat your overload: Plugin Multimedia - Graphics migration manual 2.0.0 to 2.1.0
In addition, to be able to view videos or audio files inserted into your content in "wrapped" mode (=off-page content), you need to add the CSS and JS provided by plugin "mediaelement" to XSL for rendering "wrapped" content. To do this, for all your graphic charters, modify the file skins/[SKIN_NAME ]/stylesheets/content/_wrapper/content.xsl, to add a call to the XSL templates"head-js-mediaelement" and"head-css -mediaelement".
Oops!
Copy to clipboard failed. Open the code and copy it manually.
The input data used is replaced by JS. We have to replace the existing one, and start the integration all over again, following the documentation common to all 3 plugins.
For Exchange and Zimbra
The import of XSL specific to exchange and zimbra must be replaced by that of Messaging connector (see common documentation):
If you have overloaded, replace it as soon as possible. xsl
<xsl:call-template name="exchange-event-date"/> par <xsl:call-template name="messaging-event-date"/>
<xsl:call-template name="exchange-event-subject"/> par <xsl:call-template name="messaging-event-subject"/>
<xsl:call-template name="exchange-event-location"/> par <xsl:call-template name="messaging-event-location"/>
<i18n:texti18n:key="PLUGINS_EXCHANGE_CARD_INFOUSER_EXCHANGE_RDV_WAITING" i18n:catalogue="plugin.exchange"/> par <i18n:texti18n:key="PLUGINS_MESSAGINGCONNECTOR_CARD_INFOUSER_MESSAGINGCONNECTOR_RDV_WAITING" i18n:catalogue="plugin.messaging-connector"/>
<i18n:texti18n:key="PLUGINS_EXCHANGE_CARD_INFOUSER_EXCHANGE_RDV_ERROR" i18n:catalogue="plugin.exchange"/> par <i18n:texti18n:key="PLUGINS_MESSAGINGCONNECTOR_CARD_INFOUSER_MESSAGINGCONNECTOR_RDV_ERROR" i18n:catalogue="plugin.messaging-connector"/>
<i18n:texti18n:key="PLUGINS_EXCHANGE_CARD_INFOUSER_EXCHANGE_RDV_NONE_PART1" i18n:catalogue="plugin.exchange"/> par <i18n:texti18n:key="PLUGINS_MESSAGINGCONNECTOR_CARD_INFOUSER_MESSAGINGCONNECTOR_RDV_NONE_PART1" i18n:catalogue="plugin.messaging-connector"/>
<i18n:texti18n:key="PLUGINS_EXCHANGE_CARD_INFOUSER_EXCHANGE_RDV_NONE_PART2" i18n:catalogue="plugin.exchange"/> par <i18n:texti18n:key="PLUGINS_MESSAGINGCONNECTOR_CARD_INFOUSER_MESSAGINGCONNECTOR_RDV_NONE_PART2" i18n:catalogue="plugin.messaging-connector"/>
<i18n:text i18n:key="PLUGINS_EXCHANGE_CARD_INFOUSER_EXCHANGE_RDV_NONE_PART3" i18n:catalogue="plugin.exchange"/> par <i18n:text i18n:key="PLUGINS_MESSAGINGCONNECTOR_CARD_INFOUSER_MESSAGINGCONNECTOR_RDV_NONE_PART3" i18n:catalogue="plugin.messaging-connector"/>
Si vous utilisez des clés i18 de l'ancien plugin, vous pouvez remplacer : <category i18n="true">plugin.exchange:PLUGINS_EXCHANGE_LOGIN_CATEGORY</category> par <category i18n="true">plugin.messaging-connector:PLUGINS_MESSAGINGCONNECTOR_CONFIG_CATEGORY</category>
If you have overloaded messages.xml from plugin (WEB-INF\i18n\plugins\exchange), rename the directory and then rename the i18 keys contained in the messages* files.xml
CSS classes are prefixed with "messaging" by default. To keep the "exchange" or "zimbra" prefix, use the script-js-messaging-connector and messaging-connector-card templates, adding the "css-class-prefix" parameter:
Supprimez le fichier custom_nodetypes.xml de votre repository (${AMETYS_HOME}/data/repository/repository/nodetypes/custom_nodetypes.xml) puis redémarrer le serveur avant d’exécuter les scripts suivant :
Service migration Site map
Oops!
Copy to clipboard failed. Open the code and copy it manually.
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.SitemapService']/ametys:service_parameters[@ametys:all='criteria-only']", javax.jcr.query.Query.XPATH);
it = query.execute().getNodes();
var count = 0;
while (it.hasNext())
{
var node = it.nextNode();
node.setProperty("ametys:all", "select-root");
node.save();
count++
}
print(count + " services have been updated");
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.SitemapService']/ametys:service_parameters[@ametys:all='criteria-only']", javax.jcr.query.Query.XPATH);
it = query.execute().getNodes();
var count = 0;
while (it.hasNext())
{
var node = it.nextNode();
node.setProperty("ametys:all", "select-root");
node.save();
count++
}
print(count + " services have been updated");
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.SitemapService']/ametys:service_parameters[@ametys:all='criteria-only']", javax.jcr.query.Query.XPATH);
it = query.execute().getNodes();
var count = 0;
while (it.hasNext())
{
var node = it.nextNode();
node.setProperty("ametys:all", "select-root");
node.save();
count++
}
print(count + " services have been updated");
Migration of content and page upload services
Oops!
Copy to clipboard failed. Open the code and copy it manually.
var ConsoleHelper = Java.type('org.ametys.workspaces.repository.ConsoleHelper');
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredContentsService']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasNode('ametys:search'))
{
var entryNodes = paramsNode.getNode('ametys:search').getNodes();
while (entryNodes.hasNext())
{
var entryNode = entryNodes.next();
if (entryNode.hasProperty('ametys:search-context'))
{
var searchCtx = entryNode.getProperty('ametys:search-context').getString();
if (searchCtx == 'CURRENT_SITE' || searchCtx == 'CHILD_PAGES' || searchCtx == 'DIRECT_CHILD_PAGES')
{
var s = '{"context":"' + searchCtx + '","page":null}';
entryNode.setProperty('ametys:search-context', new java.lang.String(s));
print('Migrate search context value ' + searchCtx + ' to : ' + s);
paramsNode.save();
count++
}
}
}
}
}
print(count + " content aggregation services have been migrated");
query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredPagesService']", javax.jcr.query.Query.XPATH);
nodes = query.execute().getNodes();
count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasProperty('ametys:search-context'))
{
var searchCtx = paramsNode.getProperty('ametys:search-context').getString();
if (searchCtx == 'CURRENT_SITE' || searchCtx == 'CHILD_PAGES' || searchCtx == 'DIRECT_CHILD_PAGES')
{
var s = '{"context":"' + searchCtx + '","page":null}';
paramsNode.setProperty('ametys:search-context', new java.lang.String(s));
print('Migrate search context value ' + searchCtx + ' to : ' + s);
paramsNode.save();
count++
}
}
}
print(count + " page aggregation services have been migrated");
var ConsoleHelper = Java.type('org.ametys.workspaces.repository.ConsoleHelper');
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredContentsService']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasNode('ametys:search'))
{
var entryNodes = paramsNode.getNode('ametys:search').getNodes();
while (entryNodes.hasNext())
{
var entryNode = entryNodes.next();
if (entryNode.hasProperty('ametys:search-context'))
{
var searchCtx = entryNode.getProperty('ametys:search-context').getString();
if (searchCtx == 'CURRENT_SITE' || searchCtx == 'CHILD_PAGES' || searchCtx == 'DIRECT_CHILD_PAGES')
{
var s = '{"context":"' + searchCtx + '","page":null}';
entryNode.setProperty('ametys:search-context', new java.lang.String(s));
print('Migrate search context value ' + searchCtx + ' to : ' + s);
paramsNode.save();
count++
}
}
}
}
}
print(count + " content aggregation services have been migrated");
query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredPagesService']", javax.jcr.query.Query.XPATH);
nodes = query.execute().getNodes();
count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasProperty('ametys:search-context'))
{
var searchCtx = paramsNode.getProperty('ametys:search-context').getString();
if (searchCtx == 'CURRENT_SITE' || searchCtx == 'CHILD_PAGES' || searchCtx == 'DIRECT_CHILD_PAGES')
{
var s = '{"context":"' + searchCtx + '","page":null}';
paramsNode.setProperty('ametys:search-context', new java.lang.String(s));
print('Migrate search context value ' + searchCtx + ' to : ' + s);
paramsNode.save();
count++
}
}
}
print(count + " page aggregation services have been migrated");
var ConsoleHelper = Java.type('org.ametys.workspaces.repository.ConsoleHelper');
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredContentsService']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasNode('ametys:search'))
{
var entryNodes = paramsNode.getNode('ametys:search').getNodes();
while (entryNodes.hasNext())
{
var entryNode = entryNodes.next();
if (entryNode.hasProperty('ametys:search-context'))
{
var searchCtx = entryNode.getProperty('ametys:search-context').getString();
if (searchCtx == 'CURRENT_SITE' || searchCtx == 'CHILD_PAGES' || searchCtx == 'DIRECT_CHILD_PAGES')
{
var s = '{"context":"' + searchCtx + '","page":null}';
entryNode.setProperty('ametys:search-context', new java.lang.String(s));
print('Migrate search context value ' + searchCtx + ' to : ' + s);
paramsNode.save();
count++
}
}
}
}
}
print(count + " content aggregation services have been migrated");
query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredPagesService']", javax.jcr.query.Query.XPATH);
nodes = query.execute().getNodes();
count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasProperty('ametys:search-context'))
{
var searchCtx = paramsNode.getProperty('ametys:search-context').getString();
if (searchCtx == 'CURRENT_SITE' || searchCtx == 'CHILD_PAGES' || searchCtx == 'DIRECT_CHILD_PAGES')
{
var s = '{"context":"' + searchCtx + '","page":null}';
paramsNode.setProperty('ametys:search-context', new java.lang.String(s));
print('Migrate search context value ' + searchCtx + ' to : ' + s);
paramsNode.save();
count++
}
}
}
print(count + " page aggregation services have been migrated");
Migration of content upload services (sortby parameter with most common values)
Oops!
Copy to clipboard failed. Open the code and copy it manually.
var ConsoleHelper = Java.type('org.ametys.workspaces.repository.ConsoleHelper');
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredContentsService']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasProperty("ametys:sortBy"))
{
if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#asc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"ASC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "end-date#desc,start-date#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"end-date\",\"sort\":\"DESC\"},{\"name\":\"start-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc,end-date#desc"
|| paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc,end-date#asc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"DESC\"},{\"name\":\"end-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "lastValidationDate#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"lastValidationDate\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString().indexOf("#") != -1)
{
print(paramsNode.getId() + " - " + paramsNode.getProperty("ametys:sortBy").getString())
}
}
}
print(count + " content aggregation services have been migrated");
var ConsoleHelper = Java.type('org.ametys.workspaces.repository.ConsoleHelper');
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredContentsService']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasProperty("ametys:sortBy"))
{
if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#asc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"ASC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "end-date#desc,start-date#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"end-date\",\"sort\":\"DESC\"},{\"name\":\"start-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc,end-date#desc"
|| paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc,end-date#asc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"DESC\"},{\"name\":\"end-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "lastValidationDate#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"lastValidationDate\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString().indexOf("#") != -1)
{
print(paramsNode.getId() + " - " + paramsNode.getProperty("ametys:sortBy").getString())
}
}
}
print(count + " content aggregation services have been migrated");
var ConsoleHelper = Java.type('org.ametys.workspaces.repository.ConsoleHelper');
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.web.service.FilteredContentsService']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramsNode = node.getNode('ametys:service_parameters');
if (paramsNode.hasProperty("ametys:sortBy"))
{
if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#asc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"ASC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "end-date#desc,start-date#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"end-date\",\"sort\":\"DESC\"},{\"name\":\"start-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc,end-date#desc"
|| paramsNode.getProperty("ametys:sortBy").getString() == "start-date#desc,end-date#asc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"start-date\",\"sort\":\"DESC\"},{\"name\":\"end-date\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString() == "lastValidationDate#desc")
{
paramsNode.setProperty("ametys:sortBy", "[{\"name\":\"lastValidationDate\",\"sort\":\"DESC\"}]");
session.save();
count++;
}
else if (paramsNode.getProperty("ametys:sortBy").getString().indexOf("#") != -1)
{
print(paramsNode.getId() + " - " + paramsNode.getProperty("ametys:sortBy").getString())
}
}
}
print(count + " content aggregation services have been migrated");
Color theme migration
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Copy to clipboard failed. Open the code and copy it manually.
function migrate()
{
var count = {
existing: 0,
done: 0
};
jcrXPathQuery("//element(*, ametys:content)").forEach(function(content) {
count.existing++;
migrateContent(content,
functionsToApply,
true /* old versions have to be marked incompatible */,
null /* tag new versions */,
false /* not verbose */);
count.done++;
});
print(count.done + " contents migrated on " + count.existing + " existing contents");
}
function _removeRefs(content)
{
_removeRefsRecursively(content.getNode());
}
function _removeRefsRecursively(node)
{
// Explore nodes recursively
var subNodes = node.getNodes();
while (subNodes.hasNext())
{
var subNode = subNodes.nextNode();
if (!subNode.getName().startsWith(internalPrefix))
{
_removeRefsRecursively(subNode);
}
}
// Remove reference properties
var properties = node.getProperties(jcrRefPattern);
while (properties.hasNext())
{
var prop = properties.nextProperty();
prop.remove();
}
}
var _extractOutgoingReferences = (function()
{
var proxy = serviceManager.lookup("org.ametys.cms.workflow.EditContentFunction");
var method = org.ametys.cms.workflow.EditContentFunction.class.getDeclaredMethod("_extractOutgoingReferences", org.ametys.cms.repository.ModifiableContent.class);
method.setAccessible(true);
return function(content)
{
if (!(content instanceof org.ametys.cms.repository.ModifiableContent))
{
print("passed arg content (" + (content == null ? "null" : content.getId()) + ") is not modifiable");
return;
}
var args = [content];
return java.lang.reflect.Proxy.getInvocationHandler(proxy).invoke(proxy, method, args);
}
})();
var internalPrefix = "ametys-internal:";
var jcrRefPattern = internalPrefix + "ref-*";
var functionsToApply = [];
functionsToApply.push(_removeRefs);
functionsToApply.push(_extractOutgoingReferences);
migrate();
print("Switching to archives");
var credentials = new javax.jcr.SimpleCredentials('ametys', []);
session = repository.login(credentials, 'archives');
migrate();
function migrate()
{
var count = {
existing: 0,
done: 0
};
jcrXPathQuery("//element(*, ametys:content)").forEach(function(content) {
count.existing++;
migrateContent(content,
functionsToApply,
true /* old versions have to be marked incompatible */,
null /* tag new versions */,
false /* not verbose */);
count.done++;
});
print(count.done + " contents migrated on " + count.existing + " existing contents");
}
function _removeRefs(content)
{
_removeRefsRecursively(content.getNode());
}
function _removeRefsRecursively(node)
{
// Explore nodes recursively
var subNodes = node.getNodes();
while (subNodes.hasNext())
{
var subNode = subNodes.nextNode();
if (!subNode.getName().startsWith(internalPrefix))
{
_removeRefsRecursively(subNode);
}
}
// Remove reference properties
var properties = node.getProperties(jcrRefPattern);
while (properties.hasNext())
{
var prop = properties.nextProperty();
prop.remove();
}
}
var _extractOutgoingReferences = (function()
{
var proxy = serviceManager.lookup("org.ametys.cms.workflow.EditContentFunction");
var method = org.ametys.cms.workflow.EditContentFunction.class.getDeclaredMethod("_extractOutgoingReferences", org.ametys.cms.repository.ModifiableContent.class);
method.setAccessible(true);
return function(content)
{
if (!(content instanceof org.ametys.cms.repository.ModifiableContent))
{
print("passed arg content (" + (content == null ? "null" : content.getId()) + ") is not modifiable");
return;
}
var args = [content];
return java.lang.reflect.Proxy.getInvocationHandler(proxy).invoke(proxy, method, args);
}
})();
var internalPrefix = "ametys-internal:";
var jcrRefPattern = internalPrefix + "ref-*";
var functionsToApply = [];
functionsToApply.push(_removeRefs);
functionsToApply.push(_extractOutgoingReferences);
migrate();
print("Switching to archives");
var credentials = new javax.jcr.SimpleCredentials('ametys', []);
session = repository.login(credentials, 'archives');
migrate();
function migrate()
{
var count = {
existing: 0,
done: 0
};
jcrXPathQuery("//element(*, ametys:content)").forEach(function(content) {
count.existing++;
migrateContent(content,
functionsToApply,
true /* old versions have to be marked incompatible */,
null /* tag new versions */,
false /* not verbose */);
count.done++;
});
print(count.done + " contents migrated on " + count.existing + " existing contents");
}
function _removeRefs(content)
{
_removeRefsRecursively(content.getNode());
}
function _removeRefsRecursively(node)
{
// Explore nodes recursively
var subNodes = node.getNodes();
while (subNodes.hasNext())
{
var subNode = subNodes.nextNode();
if (!subNode.getName().startsWith(internalPrefix))
{
_removeRefsRecursively(subNode);
}
}
// Remove reference properties
var properties = node.getProperties(jcrRefPattern);
while (properties.hasNext())
{
var prop = properties.nextProperty();
prop.remove();
}
}
var _extractOutgoingReferences = (function()
{
var proxy = serviceManager.lookup("org.ametys.cms.workflow.EditContentFunction");
var method = org.ametys.cms.workflow.EditContentFunction.class.getDeclaredMethod("_extractOutgoingReferences", org.ametys.cms.repository.ModifiableContent.class);
method.setAccessible(true);
return function(content)
{
if (!(content instanceof org.ametys.cms.repository.ModifiableContent))
{
print("passed arg content (" + (content == null ? "null" : content.getId()) + ") is not modifiable");
return;
}
var args = [content];
return java.lang.reflect.Proxy.getInvocationHandler(proxy).invoke(proxy, method, args);
}
})();
var internalPrefix = "ametys-internal:";
var jcrRefPattern = internalPrefix + "ref-*";
var functionsToApply = [];
functionsToApply.push(_removeRefs);
functionsToApply.push(_extractOutgoingReferences);
migrate();
print("Switching to archives");
var credentials = new javax.jcr.SimpleCredentials('ametys', []);
session = repository.login(credentials, 'archives');
migrate();
Reference table migration
Oops!
Copy to clipboard failed. Open the code and copy it manually.
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*)[@oswf:workflowName='simple-content']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var nodeCount = 0;
while (nodes.hasNext())
{
var node = nodes.next();
nodeCount++;
node.setProperty('oswf:workflowName','reference-table')
}
session.save();
print("* "+nodeCount+" simple-content modified to reference-table\n");
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*)[@oswf:workflowName='simple-content']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var nodeCount = 0;
while (nodes.hasNext())
{
var node = nodes.next();
nodeCount++;
node.setProperty('oswf:workflowName','reference-table')
}
session.save();
print("* "+nodeCount+" simple-content modified to reference-table\n");
var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*)[@oswf:workflowName='simple-content']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var nodeCount = 0;
while (nodes.hasNext())
{
var node = nodes.next();
nodeCount++;
node.setProperty('oswf:workflowName','reference-table')
}
session.save();
print("* "+nodeCount+" simple-content modified to reference-table\n");