updatecheck also for addons

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

updatecheck also for addons

Post by svasti » Sat May 30, 2015 10:28 pm

As the updatecheck has become a very important instrument to keep a site up-to-date, I'd propose to include addons also in the update check.

Addons usually consist of one or more functions in the userfuncs.php. To enable an update check, I propose to include in the phpdoc comment of the main addon-function the following 3 items

Code: Select all

/**
 * @name NAMEOFTHEADDON
 * @version VERSIONNR
 * @nfo http://URL-TO-REMOTE-NFO-FILE
 */ 
The updatechecker would have to search the userfuncs.php for all occurrences of * @name ??? and will report the found names as found addons, and if the other items are present, a normal update check can be made.
I think, these 3 items @name, @version, @nfo would be sufficient. I have omitted the "Readable Version", as I think, addons are usually so simple that just the version would do.
The rest of the information can be put into the .nfo-file, which should be a standard .nfo-file.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: updatecheck also for addons

Post by cmb » Sun May 31, 2015 1:38 pm

svasti wrote:As the updatecheck has become a very important instrument to keep a site up-to-date, I'd propose to include addons also in the update check.
Why not simply turn the addon into a plugin?
svasti wrote:The updatechecker would have to search the userfuncs.php for all occurrences of * @name ??? and will report the found names as found addons, and if the other items are present, a normal update check can be made.
The reflection API might come in handy here.
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: updatecheck also for addons

Post by svasti » Mon Jun 01, 2015 8:25 am

cmb wrote:Why not simply turn the addon into a plugin?
Addon are simpler and use less resources. This is the point of having an addon. Well, am I the only one offering addons for CMSimple_XH?
Another thing is, if an addon becomes a plugin, one could inform users this way.
cmb wrote: The reflection API might come in handy here
My suggestion is really aimed to Holger, since he is the developer of the updatecheck.
I really would like him to add this little check to the updatechecker. That would be great.

So this thread is really for Holger.

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: updatecheck also for addons

Post by svasti » Wed Jun 03, 2015 6:13 pm

Hi-updatecheck kann man leicht erweitern, so dass auch Addons einbezogen werden.
Ich habe es einmal gemacht.
Hier der Beweis:
(die beiden unteren Einträge sind Addons im der userfuncs.php-Datei)
[ external image ]

Die Codeänderung ist recht einfach. Es kostet also eigentlich nichts.
Ok, ich scheine wohl der einzige zu sein, der Addons anbietet. :roll:

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: updatecheck also for addons

Post by cmb » Wed Jun 03, 2015 7:02 pm

svasti wrote:
cmb wrote:Why not simply turn the addon into a plugin?
Addon are simpler and use less resources. This is the point of having an addon.
I agree: addons are simpler to develop and distribute, and as such use less developer resources.

If plugins really do use considerably more resources for runtime, in my opinion, this should be optimized, instead of making addons a real alternative to plugins.

Just my $0.02.
Christoph M. Becker – Plugins for CMSimple_XH

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: updatecheck also for addons

Post by Holger » Wed Jun 03, 2015 9:00 pm

svasti wrote:Hi-updatecheck kann man leicht erweitern, so dass auch Addons einbezogen werden.
Ich habe es einmal gemacht.
[...]
Die Codeänderung ist recht einfach. Es kostet also eigentlich nichts.
Ok, ich scheine wohl der einzige zu sein, der Addons anbietet. :roll:
Ich habe doch nichts dagegen. Ich konnte mich nur noch nicht um den Request kümmern.

Wenn Du die Sache schon fertig hast dann schick' mir doch die Änderungen, und ich baue es dann beim nächsten Update ein.

Trotzdem sehe ich nicht so recht den Vorteil eines "gepflegten" Addons. Viele User haben sicherlich Probleme mit dem Handling der userfuncs.php (falscher Zeichensatz, noch nicht da, mehr als ein Addon in der Datei). Die Idee hinter der userfuncs.php war damals die gleiche, wie bei der userprelude.php heute: die Möglichkeit mal schnell updatesichere Hacks zu ermöglichen um eine bestimmte Funktionalität zu ermöglichen.

Kostet es wirklich so viele Ressourcen es dem User in dem Fall etwas einfacher zu machen? Es muss doch lediglich der Code des Addons in eine index.php gespeichert werden und diese dann in einem eigenen Ordner nach /plugins geladen werden. Keine admin.php, kein Stylesheet, keine sonstigen Ordner. Das Addon ist dann automatisch verfügbar und wird auch nicht im Adminmenü angezeigt. Ein "Mini-Plugin" eben.

Für Dinge, für die Du Pflege (Updates etc.) anbietest, halte ich das "Mini-Plugin" für den User besser geeignet...
... und dann ginge auch eine "normale" .nfo ;)

LG
Holger

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: updatecheck also for addons

Post by svasti » Sun Jun 07, 2015 2:36 pm

Holger wrote:Für Dinge, für die Du Pflege (Updates etc.) anbietest, halte ich das "Mini-Plugin" für den User besser geeignet...
Ja, ich seh's ein, die Argumente überzeugen mich.

Dabei war es so cool, dass der Updatecheck plötzlich auch die Addons auflistete :geek:

In die Datei updatecheck.php hatte ich die kleine Funktion hi_updateCheckAddon() eingefügt, die die userfuncs.php nach @name, @version, @nfo durchsucht.
Diese Funktion gab dann entweder ein Array der Addon-Namen zurück, oder, wenn sie mit einem Addon-Namen als Parameter aufgerufen wurde, die zum Addon-Namen gehörende Version und die URL der herunterladbaren .nfo-Datei.

In die Funktion hi_updateInstalledScripts(), das die installierten Plugins zurück gibt, habe ich mit 2 Zeilen dann die neue Funktion aufgerufen, um die Addon-Namen zur Pluginliste hinzuzufügen.
Ebenso in der Funktion hi_updateCheck(), wo geguckt wird, ob Plugins eine version.nfo-Datei haben. Dort hat die neue Funktion bei allen Namen, die noch ohne version.nfo waren, nachgeschaut, ob's ein Addon war und dann die entsprechenden Daten generiert.

Post Reply