How to separate different plugins with the same name

I’m writing the installation code of my modular web application and I stumbled on writing the update code for the plugins.

The problem I am having is: how do you know if the plugin is already installed? Developers can give their plugin a very basic name like: “News”. There will probably be more plugins with that name and now the system think it’s the same plugin and will overwrite it.

What can I provide to the plugin to make it unique when installing and knowing it’s an update when a user provides a new installation package?

The idea is that there is only an installation service, not an install and update.
The system should be able to know if it’s a new installation or a update.

You’ve correctly noticed that a package has a name, an author, and a version. These three uniquely identify a package. If you need to map this to a file system, you could choose a structure such as

./plugins/author-id/package-id/version/

This allows two authors to offer different packages under the same name, and multiple versions of one package to be installed at once. If no support for multiple versions is needed, you can drop the version level.

The question is how to assign author IDs. Java uses the nice trick of simply using domain names, since they should be unique anyway. This works well if every developer can be expected to own a domain (this would seem to be the case in web application development). However, Java reverses the order of subdomains so that the hierarchically most important information is at the front of the name. The domain dev.example.com is mapped to the prefix com.example.dev.

It is useful to have a file in each package that describes metadata. This file could declare information about dependencies, a summary of what this package does, an a version number.

With this structure, installing or upgrading a package would work like this:

  • The new package is unpacked into a temp directory, and the metadata is read.
  • The directory of installed modules is searched for a package of same name from the same author. If no match is found, this package is installed.
  • If a match was found and the version number is higher, then the old package is removed and the new package installed.
  • Before installation, the presence of dependencies is verified.

There are tons of package managers which you can steal ideas from. Take a look at CPAN (Perl), pip (Python), gem (Ruby), npm (Node.js). Each of these have some strengths and some weaknesses.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật