I'm starting work on a basic plugin. I have a version.xml file that looks like this:
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE version SYSTEM "../../../lib/pkp/dtd/pluginVersion.dtd">
<version>
<application>MEXMLGalley</application>
<type>plugins.generic</type>
<release>1.0.0.0</release>
<date>2011-09-11</date>
<lazy-load>1</lazy-load>
<class>MEXMLGalleyPlugin</class>
</version>
an index.php file that looks like this:
- Code: Select all
<?php
/**
* @defgroup plugins_generic_MExmlGalley
*/
/**
* @file plugins/generic/MExmlGalley/index.php
*
* Copyright (c) 2011 Martin Paul Eve
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @ingroup plugins_generic_MExmlGalley
* @brief Wrapper for MEXMLGalleyPlugin
*
*/
// $Id$
require_once('MEXMLGalleyPlugin.inc.php');
return new MEXMLGalleyPlugin();
?>
and finally, my MEXMLGalleyPlugin.inc.php:
- Code: Select all
<?php
/**
* @file MEXMLGalleyPlugin.inc.php
*
* Copyright (c) 2011 Martin Paul Eve
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class MEXMLGalleyPlugin
* @ingroup plugins_generic_MEXMLGalley
*
* @brief Martin Eve's modified XML Galley Plugin
*/
// $Id$
import('lib.pkp.classes.plugins.GenericPlugin');
// this plugin is symbiotic with xmlGalley; it can't function independently
//include_once('plugins/generic/xmlGalley/ArticleXMLGalleyDAO.inc.php');
class MEXMLGalleyPlugin extends GenericPlugin {
function register($category, $path) {
if (parent::register($category, $path)) {
if ($this->getEnabled()) {
error_log("Registered");
HookRegistry::register('ArticleGalleyDAO::insertNewGalley', array($this, 'insertXMLGalleys') );
}
return true;
}
return false;
}
function getDisplayName() {
return "Martin Eve's modified XML Galley Plugin";
}
function getDescription() {
return "Allows PDF galleys to be generated from XML";
}
function insertXMLGalleys($hookName, $args) {
error_log("Function called");
return false;
}
/**
* Set the enabled/disabled state of this plugin
*/
function setEnabled($enabled) {
error_log("Set to " . $enabled);
parent::setEnabled($enabled);
$journal =& Request::getJournal();
if ($journal) {
return true;
}
return false;
}
/*
* Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/
function manage($verb, $args, &$message) {
error_log("Verb " . $verb);
if (!parent::manage($verb, $args, $message)) { return false; } else { return true; }
}
}
?>
Now, after reading [url="http://pkp.sfu.ca/support/forum/viewtopic.php?f=9&t=7386"]this thread[/url] I realised that I have to run tools/upgrade.php upgrade in order to have the plugin's information written into the version table. When I do so, however, I receive:
- Code: Select all
[pre-install]
[load: upgrade.xml]
[version: 2.3.6.0]
[schema: lib/pkp/xml/schema/signoff.xml]
[schema: lib/pkp/xml/schema/common.xml]
[schema: lib/pkp/xml/schema/groups.xml]
[schema: lib/pkp/xml/schema/announcements.xml]
[schema: lib/pkp/xml/schema/scheduledTasks.xml]
[schema: lib/pkp/xml/schema/temporaryFiles.xml]
[schema: lib/pkp/xml/schema/metadata.xml]
[schema: lib/pkp/xml/schema/reviews.xml]
[schema: lib/pkp/xml/schema/reviewForms.xml]
[schema: lib/pkp/xml/schema/controlledVocab.xml]
[schema: lib/pkp/xml/schema/submissions.xml]
[schema: lib/pkp/xml/schema/comments.xml]
[schema: lib/pkp/xml/schema/notes.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[code: Installer Installer::addPluginVersions]
PHP Fatal error: Call to a member function getCurrent() on a non-object in /home/martinev/public_html/new_excursions/lib/pkp/classes/site/VersionDAO.inc.php on line 131
Any ideas what's going wrong, please?
