Twitter service

The use of widget twitter is no longer supported. The corresponding site parameter can be removed. To do this, run the following script :

function deleteTwitterWidgetIDSiteParameter()                                      
{                                      
    var query = qm.createQuery("//element(*, ametys:site)", javax.jcr.query.Query.XPATH);                                      
    var nodes = query.execute().getNodes();                                      
    var widgetIdPropertyName = 'ametys:twitter-widget-id';                                      
    var count = 0;                                      
                                          
    var hasChanges = false;                                      
    while (nodes.hasNext())                                      
    {                                      
       var siteNode = nodes.nextNode();                                      
       if (siteNode.hasProperty(widgetIdPropertyName))                                      
       {                                      
         siteNode.getProperty(widgetIdPropertyName).remove();                                      
         count++;                                      
       }                                      
    }                                      
                                      
   if (count > 0)                                      
   {                                      
     session.save();                                      
     print(count + " sites have been migrated.");                                      
   }                                      
}                                      
                                      
var qm = session.getWorkspace().getQueryManager();                                      
deleteTwitterWidgetIDSiteParameter();                                      
                                      
print("End of migration, you can rebuild the Live workspace");                                     

 

Back to top

Social networking