OsTicket插件不断崩溃我的osTicket

时间:2018-06-03 00:08:44

标签: php mysqli plugins osticket

我创建了一个osticket插件。我把它正确地放在了plugins文件夹中。

每当我尝试通过管理面板安装插件时,我的osTicket就开始了。我的意思是每个osTicket页面都停止工作,我得到空白页面。要恢复它,我转到phpMyAdmin,打开我的osTicket数据库并从插件表中删除该插件条目。

这是我的问题,我怎么知道这个插件有什么问题?我试图通过osTicket的错误日志捕获错误,但它对我没什么。 我试着放置这一行

error_log("function name got hit.\r\n",3,"error_log");

在每个文件和函数的开头。但是在启用插件后没有创建文件。

插件的plugin.php文件的代码是:

<?php
error_log("plugin.php got hit!\r\n",3,"error_log");
/** 
* Description of plugin *
* @author 
*/
set_include_path(get_include_path().PATH_SEPARATOR.dirname(__file__).'/include');
return array(
    'id' => 'pt:SMSAlertTool', # notrans 
    'version' => '0.1',
    'name' => 'SMS Alert Tool',
    'author' => 'Pak Thunders',
    'description' => 'This tool will allow you to integrate your SMS Provider API in osTicket.',
    'plugin' => 'main.php:SMSAlertTool'
);
?>

而main.php文件的代码是:

<!-- This line may be used to load Custom CSS -->
<!-- <link rel="stylesheet" href="../assets/default/css/theme_equipment.css" media="screen"> -->
<?php
 error_log("main.php got hit!\r\n",3,"error_log");
require_once(INCLUDE_DIR . 'class.plugin.php');
require_once(INCLUDE_DIR . 'class.signal.php');
//This class lets us create customized menu items in the Admin, Staff and User areas.
//require_once(INCLUDE_DIR . 'class.app.php');

require_once('config.php');
//This is where we define our custom paths and variables.

define('SMSAT_TABLE',TABLE_PREFIX.'SMSAlertLog');
define('PLUGINS_ROOT',INCLUDE_DIR.'plugins/');
define('SMSAT_PLUGIN_ROOT',PLUGINS_ROOT.'SMSAlertTool/');
define('SMSAT_INCLUDE_DIR',SMSAT_PLUGIN_ROOT.'include/');
require_once(SMSAT_INCLUDE_DIR . 'class.smsat_install.php');

class SMSAlertTool extends Plugin {

    var $config_class = 'SMSATConfig';

    function bootstrap() {
        error_log("main.php:bootstrap got hit!\r\n",3,"error_log");
        if ($this->firstRun()) {
            $this->configureFirstRun();
        }

        $config = $this->getConfig();
        $this->createAdminMenu();


          Signal::connect('model.updated', array('SMSAlertTool', 'callbackAlert'));
    }


    function createAdminMenu() {
        error_log("main.php:createAdminMenu got hit!\r\n",3,"error_log");
        Application::registerStaffApp('Sent Messages', 'showlog.php', array(iconclass => 'envelope'));

    }


    function firstRun() {
        error_log("main.php:firstRun got hit!\r\n",3,"error_log");
        $sql='SHOW TABLES LIKE \''.SMSAT_TABLE.'\'';
        $res=db_query($sql);
        return  (db_num_rows($res)==0);
    }


    function configureFirstRun() {
        error_log("main.php:configureFirstRun got hit!\r\n",3,"error_log");
       if(!$this->createDBTables())
       {
           echo "First run configuration error.  "
            . "Unable to create database tables!";
       }
    }


    function createDBTables() {
        error_log("main.php:createDBTables got hit!\r\n",3,"error_log");
       $installer = new \include\SMSATInstaller ();
       return $installer->install();

    }


    function pre_uninstall(&$errors) {
        error_log("main.php:pre_uninstall got hit!\r\n",3,"error_log");
       $installer = new \include\SMSATInstaller ();
       return $installer->remove();
    }
    static function callBackAlert($object, $data)
    {
        error_log("main.php:callBackAlert got hit!\r\n",3,"error_log");
        file_put_contents('ArrayAnalyzed.txt', print_r($b, true));
    }

}
?>

OsTicket ver 1.10.1

环境Linux

Webserver Apache

MySQL 5.6

PHP Version 7.0.19

Osticket是刚刚安装的,仅用于测试此插件。

0 个答案:

没有答案