外部ガジェットの URL を変更する方法

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

From Confluence 9.0, gadgets are no longer available.

See the Confluence 9.0 upgrade notes for more details.

症状

When you create External Gadgets in Confluence, there is no option to edit the existing gadget's URL, if needed. This might be extremely painful if you're using it across many pages.

例:

http://test.com:8080/rest/gadgets/1.0/g/com.atlassian.jira.gadgets:pie-chart-gadget/gadgets/piechart-gadget.xml

And I need to change it to:

http://newtest.com/jira/rest/gadgets/1.0/g/com.atlassian.jira.gadgets:pie-chart-gadget/gadgets/piechart-gadget.xml

回避策

Create a database backup before changing anything!

Additionally, any database modifications should be done while Confluence is shut down and not running.


Since changing the gadget's URL is not possible via Confluence interface, you will need to modify the URLs in the database.

  1.  Stop Confluence following your standard procedure.

  2. If Collaborative Editing is enabled, run the following SQL query to force Synchrony to retrieve draft content from the database.

    You may need to adjust the SQL statement to work with your specific database engine.

    update CONTENTPROPERTIES set STRINGVAL = 'synchrony-recovery' where PROPERTYID in (
        select cp.PROPERTYID
        from BODYCONTENT bc
        join CONTENTPROPERTIES cp on cp.CONTENTID=bc.CONTENTID
        where bc.BODY like '%http://test.com:8080%'
        and cp.PROPERTYNAME = 'sync-rev-source'
    )
    ;
  3. Run a SQL statement to update the body content. An example is shown below: 

    tip/resting Created with Sketch.

    You may need to adjust the SQL statement to work with your specific database engine.

    update BODYCONTENT
    set body = replace(body, 'http://test.com:8080', 'http://newtest.com/jira')
    where body like '%http://test.com:8080%';
    UPDATE BODYCONTENT
    SET BODY=REPLACE(cast(BODY as nvarchar(max)),'http://test.com:8080','http://newtest.com/jira')
    where BODY like '%http://test.com:8080%';
    update BODYCONTENT
    set body = replace(body, 'http://test.com:8080', 'http://newtest.com/jira')
    where body like '%http://test.com:8080%'; 
  4. Start Confluence following your standard procedure.
  5. After all the occurrences of gadgets are updated by the SQL above,  add the new base URL to the "External Gadgets" section in Confluence Admin.
  6. In case the application does not recognize the new links for the gadgets (pointing to previous URL still), go ahead and re-index your instance since these URLs may be cached somewhere.
     
最終更新日 2024 年 7 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.