Description of issue or problem I’m having:
I have a generic plugin with a series of custom template files, handled by a page handler that checks the URL and assigns the appropriate .tpl file for the page. When I visit any of the URLs on my localhost dev server it works fine every time.
When I upload the plugin to my online dev’ server and attempt to view the page(s), the server returns a 404 and there is no supporting information in the logs other than the 404 itself.
I’m struggling to find out why it’s not working online and was hoping someone could give me some advice.
Steps I took leading up to the issue:
The setPageHandler function is as follows:
public function setPageHandler($hookName, $params) {
$page = $params[0];
if ($page === 'clinical-queries') {
$this->import('RCVSKClinicalQueriesPluginHandler');
define('HANDLER_CLASS', 'RCVSKClinicalQueriesPluginHandler');
return true;
}
if ($page === 'clinical-queries-submit') {
$this->import('RCVSKClinicalQueriesSubmitPluginHandler');
define('HANDLER_CLASS', 'RCVSKClinicalQueriesSubmitPluginHandler');
return true;
}
return false;
}
The plugin handler class is as follows:
import('classes.handler.Handler');
class RCVSKClinicalQueriesPluginHandler extends Handler {
public function index(array $args, Request $request):string {
$plugin = PluginRegistry::getPlugin('generic', 'rcvskclinicalqueriesplugin');
$templateMgr = TemplateManager::getManager($request);
return $templateMgr->display($plugin->getTemplateResource('frontend/pages/clinicalqueries.tpl'));
}
public function view($args, $request):string {
$plugin = PluginRegistry::getPlugin('generic', 'rcvskclinicalqueriesplugin');
$templateMgr = TemplateManager::getManager($request);
return $templateMgr->display($plugin->getTemplateResource('frontend/pages/clinicalqueries.tpl'));
}
}
and the other handler is:
import('classes.handler.Handler');
class RCVSKClinicalQueriesSubmitPluginHandler extends Handler {
public function index(array $args, Request $request): string {
// print_r($_POST);
$plugin = PluginRegistry::getPlugin('generic', 'rcvskclinicalqueriesplugin');
$templateMgr = TemplateManager::getManager($request);
return $templateMgr->display($plugin->getTemplateResource('frontend/pages/clinicalqueriessubmit.tpl'));
}
public function view($args, $request) {
$plugin = PluginRegistry::getPlugin('generic', 'rcvskclinicalqueriesplugin');
$templateMgr = TemplateManager::getManager($request);
return $templateMgr->display($plugin->getTemplateResource('frontend/pages/clinicalqueriessubmit.tpl'));
}
}
What I tried to resolve the issue:
I have been checking my code and looking through the forums but can’t really see why it works locally but not online.
Application Version - e.g., OJS 3.1.2:
OJS 3.3.0.10 (the online server has just been updated to 3.3.0.11, everything else works. Note that this issue existed before the upgrade too.)
Additional information, such as screenshots and error log messages if applicable:
I checked the “versions” table in the database and there exists an entry on both the localhost and online databases for the plugin.
The 404 page itself is not what I would call a typical OJS 404 page. There is no stack trace, just the 404 itself, and in the error logs :-
[Tue Jun 14 10:04:27.663977 2022] [php7:notice] [pid 62215] [client 92.13.214.246:63857] ojs2: 404 Not Found
Does anyone have any ideas why it’s not working?