OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Plugin settings and schema

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Plugin settings and schema

Postby nasosi » Fri May 11, 2012 6:15 am

Dear all,
Since I am new to OJS and php I hope that you forgive my incidental ignorance on certain matters.

I am trying to develop a fairly simple plugin, that requires a table ( database entries) and some default plugin settings separate from that table to start with. I have followed the guidelines on the example plugin in the documentation ( Link) and have looked in the source code of various plugins to figure out how to accomplish it, but I don't seem to be able to set it up correctly.

Specifically, when I install my .tar.gz from the web interface, everything uploads correctly, the plugin appears in the generic plugins, it can be enabled and its settings can be accessed manipulated and saved. The problems I have though are:

    1. The default settings appearing in the settings.xml do not make it in the settings form.
    2. The schema.xml definition doesn't make it into the database (I cannot see the table I defined using phpmyadmin).

Looking at the apache error log I only see the following wanring:
[Fri May 11 08:33:07 2012] [error] [client xxx.xxx.xxx.xxx] ojs2 has produced an error\n Message: WARNING: Missing argument 1 for PaymentManager::PaymentManager(), called in /var/www/ojs_exp/classes/payment/ojs/OJSPaymentManager.inc.php on line 35 and defined\n In file: /var/www/ojs_exp/lib/pkp/classes/payment/PaymentManager.inc.php\n At line: 22\n Stacktrace: \n Server info:\n OS: Linux\n PHP Version: 5.3.10-1ubuntu3.1\n Apache Version: Apache/2.2.22 (Ubuntu)\n DB Driver: mysql\n DB server version: 5.5.22-0ubuntu1, referer: http://xxx.xxx.xxx/ojs_exp/index.php/AC ... ns/install

that doesn't to be related to the problems I have since when I alter the definition of the constructor in PaymentManager.inc.php, the warning disappears, but the settings.xml and schema.xml still don't make it in OJS (after removal and re-installation to a newer version of the plugin).

Attached please find a cut down version that demonstates what I have built up to now. I am using ojs 2.3.7 on an ubuntu 12.04 server.

Looking forward for any help.

Best regards,
Nasos
Attachments
examplePlugin.tar.gz
Cut down version of a sample plugin
(2.34 KiB) Downloaded 15 times
nasosi
 
Posts: 2
Joined: Fri May 11, 2012 5:24 am

Re: Plugin settings and schema

Postby ramon » Sun May 13, 2012 8:51 pm

Hello Nasos,

I believe that for plugins that require installing database tables, you need to execute (via command-line) php tools/upgrade.php upgrade
This will cause your XML file to be executed, installing the data structure, but I may be wrong.
Please, test this first before running on a production environment, and ALWAYS make a full backup prior to this.

_______________________________
Ramón Martins Sodoma da Fonseca
Analista em C&T
Coordenação de Tecnologias de Informação
Instituto Brasileiro de Informação em Ciência e Tecnologia - IBICT
Ministério da Ciência e Tecnologia - MCT
ramon
 
Posts: 931
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Plugin settings and schema

Postby JasonNugent » Mon May 14, 2012 3:02 am

Hi nasosi,

Plugins that require database tables should include a schema.xml file that describes the required schema changes. This file is loaded automatically when either the upgrade.php script is run (as Ramon mentioned), or when the plugin is installed via the web interface. For an example of such a plugin, have a look at the externalFeed plugin, located in the plugins/generic/ directory.

(and yes, it's always a good idea to have a recent backup when doing things that modify the database).

Regards,
Jason

PS: Also, you can ignore the PaymentManager() warnings. It's an argument mismatch in the constructor, and is purely cosmetic.
JasonNugent
Site Admin
 
Posts: 893
Joined: Tue Jan 10, 2006 6:20 am

Re: Plugin settings and schema

Postby nasosi » Mon May 14, 2012 12:43 pm

Hi again,
Thank you very much for your answers. I tried the suggestion but unfortunately it did not work.

After a lot of search it turns out that the schema.xml is not what the installer expects. According to this discussion (Link) there should be an intermediate file (install.xml) that references schema.xml. I tested those suggestions and they work. Nevertheless It seems that the issues raised in this report are not fully dealt with, or It has turned out really hard for me to find any proper documentation on-line that suggests otherwise.

I am still struggling with the settings.xml :(

Best,
Nasos
nasosi
 
Posts: 2
Joined: Fri May 11, 2012 5:24 am


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 2 guests