Page 1 of 1
[RESOLVED] Include plugin library
Posted: 16 Oct 2012, 16:55
by Lisandro1987
I need to create a cronjob that execute a PHP file. But I have a problem when when I try to run the file by console typing:
If I run in the console:
Code: Select all
[USER]@[HOSTNAME]:~$ php [PUBLIC_HTML]/plugins/TestPlugin/pages/index.php
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
<p style="color:red">APPLICATION WARNING #100: Configuration option "plugin__test" not found.</p>
I think that the problem happen when I call 'plugin_config_get'. How can I to include this library? I try:
Code: Select all
[PUBLIC_HTML]/plugins/TestPlugin/pages/index.php
<?php
require_once(dirname(__FILE__)."/../../../core.php");
$g_test = plugin_config_get('test');
echo $g_test;
?>
But do not work. If I run in browser works perfectly! What can I do?
Re: Include plugin library
Posted: 17 Oct 2012, 07:12
by Lapinkiller
hello,
do a require_once on file {mantisroot}/core.php
Re: Include plugin library
Posted: 17 Oct 2012, 19:02
by Lisandro1987
Thanks so much for your answer, but that don't work:
[PUBLIC_HTML]/plugins/TestPlugin/pages/index.php
Code: Select all
<?php
require_once(dirname(__FILE__)."/../../../config_inc.php");
require_once(dirname(__FILE__)."/../../../core.php");
$connection = mysql_connect($g_hostname, $g_db_username, $g_db_password);
mysql_select_db($g_database_name, $connection);
$g_test = plugin_config_get('t_test');
echo $g_test;
?>
If i run that in console, the next error appear:
Code: Select all
[USER]@[HOSTNAME]:~$ php [PUBLIC_HTML]/plugins/TestPlugin/pages/index.php
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
<html><head><title>APPLICATION ERROR #400</title></head><body><br /><div align="center"><table class="width50" cellspacing="1"><tr><td class="form-title">APPLICATION ERROR #400</td></tr><tr><td><p class="center" style="color:red">Database connection failed. Error received from database was #1045: Access denied for user 'root'@'localhost' (using password: NO).</p></td></tr><tr><td><p class="center">Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.</p></td></tr></table></div><p>Previous non-fatal errors occurred. Page contents follow.</p><div style="border: solid 1px black;padding: 4px"><p style="color:red">SYSTEM WARNING: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO)</p></div></body></html>
Re: Include plugin library
Posted: 18 Oct 2012, 07:13
by Lapinkiller
the inclusion works..
the problem is with your code, you don't have to do the db connetion, use database api which is loaded by core.php
Re: Include plugin library
Posted: 18 Oct 2012, 14:34
by Lisandro1987
Thanks for your answer. But if I don't include the connection to the database it is still not working:
Code: Select all
[PUBLIC_HTML]/plugins/TestPlugin/pages/index.php
<?php
require_once(dirname(__FILE__)."/../../../core.php");
$g_test = plugin_config_get('test');
echo $g_test;
?>
If I run in the console:
Code: Select all
[USER]@[HOSTNAME]:~$ php [PUBLIC_HTML]/plugins/TestPlugin/pages/index.php
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
<p style="color:red">APPLICATION WARNING #100: Configuration option "plugin__test" not found.</p>
If I run in browser works perfectly!
Re: Include plugin library
Posted: 23 Oct 2012, 14:29
by Lisandro1987
Can anyone help me?

Re: Include plugin library
Posted: 08 Nov 2012, 17:23
by Lisandro1987
I resolved this using command 'lynk'. Thanks!