Skip to content

Commit

Permalink
Plugins lib: fix errors when plugin not installed in plugins dir (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenzap authored Feb 12, 2022
1 parent 1fe3f3e commit 1b134df
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions application/libraries/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,31 @@ public function include_plugins()
foreach (self::$plugins_active as $name => $value)
{
// The plugin information being added to the database
$data = array(
"plugin_system_name" => $name,
"plugin_name" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_name']),
"plugin_uri" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_uri']),
"plugin_version" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_version']),
"plugin_description" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_description']),
"plugin_author" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_author']),
"plugin_author_uri" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_author_uri'])
);
if( ! empty(self::$plugins_pool))
{
$data = array(
"plugin_system_name" => $name,
"plugin_name" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_name']),
"plugin_uri" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_uri']),
"plugin_version" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_version']),
"plugin_description" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_description']),
"plugin_author" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_author']),
"plugin_author_uri" => trim(self::$plugins_pool[$name]['plugin_info']['plugin_author_uri'])
);
}
else
{
$data = array(
"plugin_system_name" => $name,
);
}
$this->_ci->db->where('plugin_system_name', $name)->update('plugins', $data);

// If the file was included
include_once $this->plugins_dir.$name."/".$name.".php";
if (file_exists($this->plugins_dir.$name."/".$name.".php"))
{
include_once $this->plugins_dir.$name."/".$name.".php";
}

// Trigger an install event
$this->trigger_install_plugin($name);
Expand Down

0 comments on commit 1b134df

Please sign in to comment.