1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

Fixes #849 and corrects a table-name issue with plugin upgrades.

This commit is contained in:
Cameron
2015-02-01 02:07:56 -08:00
parent 0e56c66810
commit 2a4caa6cb7
3 changed files with 129 additions and 26 deletions

View File

@@ -2098,7 +2098,7 @@ class pluginBuilder
foreach($plugFolders as $dir)
{
$lanDir[$dir] = $dir;
if(file_exists(e_PLUGIN.$dir."/admin_config.php"))
if(E107_DEBUG_LEVEL == 0 && file_exists(e_PLUGIN.$dir."/admin_config.php"))
{
continue;
}
@@ -2122,7 +2122,7 @@ class pluginBuilder
</colgroup>
<tr>
<td>Build an admin-area and xml file for: </td>
<td><div class='input-append'>".$frm->open('createPlugin','get').$frm->select("newplugin",$newDir).$frm->admin_button('step', 2,'other','Go')."</div> ".$frm->checkbox('createFiles',1,1,'Create Files').$frm->close()."</td>
<td><div class='input-append'>".$frm->open('createPlugin','get',e_SELF."?mode=create").$frm->select("newplugin",$newDir).$frm->admin_button('step', 2,'other','Go')."</div> ".$frm->checkbox('createFiles',1,1,'Create Files').$frm->close()."</td>
</tr>
<tr>
@@ -2663,7 +2663,7 @@ TEMPLATE;
{
$frm = e107::getForm();
$modes = array("main"=>"Main Area","cat"=>"Categories","other1"=>"Other 1","other2"=>"Other 2");
$modes = array("main"=>"Main Area","cat"=>"Categories","other1"=>"Other 1","other2"=>"Other 2","other3"=>"Other 3","other4"=>"Other 4");
// echo "TABLE COUNT= ".$this->tableCount ;

View File

@@ -70,12 +70,12 @@ class e107plugin
protected $core_plugins = array(
"_blank","admin_menu","alt_auth","banner","blogcalendar_menu",
"calendar_menu","chatbox_menu", "clock_menu","comment_menu",
"chatbox_menu", "clock_menu","comment_menu",
"contact", "download","faqs", "featurebox", "forum","gallery",
"gsitemap","import", "linkwords", "list_new", "log", "login_menu",
"metaweblog", "newforumposts_main", "news", "newsfeed",
"newsletter","online", "page", "pdf", "pm", "pm","poll",
"rss_menu","search_menu","siteinfo", "social", "tagwords", "tinymce",
"newsletter","online", "page", "pm","poll",
"rss_menu","search_menu","siteinfo", "social", "tagwords", "tinymce4",
"trackback","tree_menu","user"
);
@@ -1404,7 +1404,7 @@ class e107plugin
if (!file_exists($path.'plugin.xml') || $function == '')
{
$error[] = EPL_ADLAN_77;
$canContinue = FALSE;
$canContinue = false;
}
if ($canContinue && $this->parse_plugin_xml($plug['plugin_path']))
@@ -1426,24 +1426,24 @@ class e107plugin
$canContinue = $this->XmlDependencies($plug_vars['dependencies']);
}
if (!$canContinue)
if ($canContinue === false)
{
return FALSE;
return false;
}
// All the dependencies are OK - can start the install now
if ($canContinue) // Run custom {plugin}_setup install/upgrade etc. for INSERT, ALTER etc. etc. etc.
{
// Run custom {plugin}_setup install/upgrade etc. for INSERT, ALTER etc. etc. etc.
$ret = $this->execute_function($plug['plugin_path'], $function, 'pre');
if (!is_bool($ret))
{
$txt .= $ret;
}
// Handle tables
if ($canContinue && count($sql_list)) // TODO - move to it's own function. XmlTables().
$this->XmlTables($function, $plug);
if ($canContinue && count($sql_list)) // TODO - move more of it to $this->XmlTables().
{
require_once(e_HANDLER.'db_table_admin_class.php');
@@ -1468,6 +1468,10 @@ class e107plugin
$status = $this->manage_tables('add', array($sqlTable)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; // Pass the statement to create the table
$mes->add($txt, $status);
break;
/* Has Bugs.. - @See replacement: $this->XmlTables()
case 'upgrade':
$tmp = $dbHandler->update_table_structure($ct, FALSE, TRUE, $pref['multilanguage']);
@@ -1480,11 +1484,14 @@ class e107plugin
$error[] = $tmp;
}
break;
*/
case 'refresh': // Leave things alone
case 'upgrade':
break;
case 'uninstall':
if (vartrue($options['delete_tables'], FALSE))
{
@@ -1619,9 +1626,33 @@ class e107plugin
}
// Placeholder.
function XmlTables($data)
function XmlTables($function, $plug)
{
$sqlFile = e_PLUGIN.$plug['plugin_path'].'/'.$plug['plugin_path']."_sql.php";
if(!is_readable($sqlFile))
{
return;
}
require_once(e_HANDLER."db_verify_class.php");
$dbv = new db_verify;
if($function == 'upgrade')
{
$dbv->errors = array();
$dbv->compare($plug['plugin_path']);
if($dbv->errors())
{
$dbv->compileResults();
$dbv->runFix();
}
}
}
@@ -2145,6 +2176,7 @@ class e107plugin
}
}
/**
* Process XML tags <mainPrefs> and <pluginPrefs>
* @param object $mode 'core' or the folder name of the plugin.

View File

@@ -0,0 +1,71 @@
<?php
/*
* e107 website system
*
* Copyright (c) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Custom TinyMce4 install/uninstall/update routines
**
*/
if (!defined('e107_INIT')) { exit; }
class tinymce4_setup
{
function upgrade_required()
{
$list = e107::getConfig()->get('e_meta_list');
if(in_array('tinymce4',$list))
{
return true;
}
if(file_exists(e_PLUGIN."tinymce4/e_meta.php")) // Outdated file.
{
e107::getMessage()->addInfo("Please delete the outdated file <b>".e_PLUGIN."tinymce4/e_meta.php</b> and then run the updating process.");
// print_a(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,8));
return true;
}
return false;
}
/*
function install_pre($var)
{
}
function install_post($var)
{
}
function uninstall_options()
{
}
function uninstall_post($var)
{
}
function upgrade_pre($var)
{
}
function upgrade_post($var)
{
}
*/
}