how to install a local plugin without install.xml (2.3.2+)

how to install a local plugin without install.xml (2.3.2+)

by tim st.clair -
Number of replies: 5
Immàgine de Plugin developers

I'm trying to build a local plugin called "wscompletion". It doesn't add any new TABLES to the databse, however it does add some other things. According to http://docs.moodle.org/dev/Upgrade_API install.php is executed after install.xml - but I do not have an install.xml at all. So when I try an install I see this:

and it doesn't run my install.php. I tried adding an empty-ish install.xml (e.g. one that has the xml headers but doesn't do anything) but that didn't work either.

<?xml version="1.0" encoding="UTF-8" ?>

<XMLDB PATH="local/wscompletion/db" VERSION="20070613" COMMENT="XMLDB file for Moodle local/wscompletion"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"

>

</XMLDB>

Also, my plugin is called "wscompletion", the plugin language is called wscompletion.php and contains a $string['pluginname'] = 'ws completion'; but that doesn't show up on this screen either, it thinks it is called "local_wscompletion", which it isn't and no part of my code refers to that name. Is this just some undocumented thing I have to conform to when creating local plugins? 

Average of ratings: -
In reply to tim st.clair

Re: how to install a local plugin without install.xml (2.3.2+)

by Davo Smith -
Immàgine de Core developers Immàgine de Particularly helpful Moodlers Immàgine de Peer reviewers Immàgine de Plugin developers

If it isn't picking up the language string in /local/wscompletion/lang/en/local_wscompletion.php and it isn't picking up the install code in /local/wscompletion/db/install.php then the most usual explanation (in my experience) is a permissions problem on the subfolders on the server. Most times I've encountered an issue like this, checking that the server has read/execute permissions on the folders has fixed the problem (but it may be a different issue in this case ...).

In reply to Davo Smith

Re: how to install a local plugin without install.xml (2.3.2+)

by tim st.clair -
Immàgine de Plugin developers

permission did seem to be an issue with the install and upgrade.php files. So I've set them so they can execute - not a problem. the system will now detect and run the plugin, however it now gets stuck on the blank installation screen without any explanation (e.g. nothing in my php error log, nothing being added to my sql server other than the moodle install in progress mention):

and here's what goes into the config_plugin table relating to my plugin:

If I bump the version number and force it to run upgrade instead of install then it still hangs at the same screen - no errors.

In reply to tim st.clair

Re: how to install a local plugin without install.xml (2.3.2+)

by tim st.clair -
Immàgine de Plugin developers

Never mind, I found my answer by reading other people's source code and it triggered something in my memory: that the file names for local plugins are called things like "install.php" and so on, but the internal function names are called local_function, as in the case of the language. So for installing you have to name the function xmldb_local_pluginname_install and such; unfortunately the documentation does not mention this nor give any clear examples (if there are examples, I couldn't find them, therefore that's not "clear").

Anyway, all good now, my question is answered. Cheers all!

In reply to tim st.clair

Re: how to install a local plugin without install.xml (2.3.2+)

by Hubert Chathi -

Do you have a version.php file in your plugin?

And the language file should be called "local_wscompletion.php", not "wscompletion.php".