Skip to content

Cloudlog : external plugins : add fonctionnality

abarrau edited this page Nov 3, 2023 · 9 revisions

(Sorry, if my english is not well)

This project its for add fonctionnality of Cloudlog project : external plugins.
Each developers can creates plugins for Cloudlog and propose it to the communauty.

This fonctionnality can be use in cloud website or in standalone.
In mode cloud, each use can active the external plugins than it would.

How to install fonctionnality :

1/ add new files :

  • cloudlog/application/controllers/Pluginsext.php
  • cloudlog/application/controllers/Pluginsext_extands.php
  • cloudlog/application/language/english/pluginsext_lang.php
  • cloudlog/application/language/french/pluginsext_lang.php
  • cloudlog/application/models/Pluginsext_model.php
  • cloudlog/application/views/pluginsext/footer.php
  • cloudlog/application/views/pluginsext/edit.php
  • cloudlog/application/views/pluginsext/index.php
  • cloudlog/application/views/pluginsext/menu.php

2/ create 3 tables in database : (pluginsext, pluginsext_plugindata and pluginsext_users )

  • execute this sql script on your database :

CREATE TABLE `pluginsext` (
`pluginsext_id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`pluginsext_nameid` varchar(50) NOT NULL,
`pluginsext_name` varchar(250) NOT NULL,
`pluginsext_allow` int(3) unsigned NOT NULL,
`pluginsext_config` text DEFAULT NULL,
`pluginsext_info` text DEFAULT NULL,
`pluginsext_migration` int(5) unsigned NOT NULL,
PRIMARY KEY (`pluginsext_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `pluginsext_plugindata` (
`pluginsdata_id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`pluginsext_id` int(5) unsigned NOT NULL,
`pluginsext_user_id` int(5) unsigned NOT NULL,
`pluginsdata_data` longtext DEFAULT NULL,
PRIMARY KEY (`pluginsdata_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `pluginsext_users` (
`pluginsext_id` int(5) unsigned NOT NULL,
`pluginsext_user_id` int(5) unsigned NOT NULL,
`pluginsext_user_allow` int(3) unsigned NOT NULL,
`pluginsext_params` text DEFAULT NULL,
`pluginsext_values` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

3/ create folder for external plugin :

  • cloudlog/application/third_party_pluginsext

4/ modify 2 existing files :

a) add config information :

  • cloudlog/application/config/config.php
  • cloudlog/application/config/config.sample.php
  • cloudlog/install/config/config.php

You must add informations about this new fonctionnality, at the end of file :
/*
|--------------------------------------------------------------------------
| external plugin
|--------------------------------------------------------------------------
|
| You can active external plugin function
| You must define the plugin list installed
*/
$config['pluginsext_allow'] = true;
$config['pluginsext_path'] = 'third_party_pluginsext';

b) modify footer page :

  • cloudlog/application/views/interface_assets/footer.php

You must add a required file at the end of file (just before </body></html>) :
<?php require_once(APPPATH.'/views/pluginsext/footer.php'); ?>

Verify installation :

-- with check_install :

On your browser, type this URL : http://<YOUR_DOMAINE>/cloudlog/index.php/pluginsext/check_install
A script will verified your installation. The result is like this :
log result

-- The menu :

After added all this files, and create table in database, a new menu can be show in user menu; title is : "External plugin".

-- The list :

After open this menu, the external plugins list can be show :
The first time, only "exemplemod" exist.

-- Edit plugin params :

You can modify parameters of this plugin.