mirror of
https://github.com/e107inc/e107.git
synced 2025-07-25 17:01:43 +02:00
Fixed e107 v1 to v2 forum migration adding check for deprecated files. Fixed breadcrumb subforum visibility and URL when SEFURL is disabled.
This commit is contained in:
@@ -2351,10 +2351,11 @@ class e107forum
|
|||||||
$replace = array($tp->toHTML($forumInfo['parent_name']), e107::url('forum','index')."#".$frm->name2id($forumInfo['parent_name']));
|
$replace = array($tp->toHTML($forumInfo['parent_name']), e107::url('forum','index')."#".$frm->name2id($forumInfo['parent_name']));
|
||||||
$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
|
$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
|
||||||
|
|
||||||
|
|
||||||
if($forumInfo['forum_sub'])
|
if($forumInfo['forum_sub'])
|
||||||
{
|
{
|
||||||
$search = array('{SUBPARENT_TITLE}', '{SUBPARENT_HREF}');
|
$search = array('{SUBPARENT_TITLE}', '{SUBPARENT_HREF}');
|
||||||
$replace = array(ltrim($forumInfo['sub_parent'], '*'), e107::url('forum', 'forum', array('forum_id'=>$forumInfo['parent_id'],'forum_sef'=>$forumInfo['parent_sef'])));
|
$replace = array(ltrim($forumInfo['sub_parent'], '*'), e107::url('forum', 'forum', array('forum_id'=>$forumInfo['forum_sub'],'forum_sef'=>$forumInfo['parent_sef'])));
|
||||||
$FORUM_CRUMB['subparent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['subparent']['value']);
|
$FORUM_CRUMB['subparent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['subparent']['value']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1314,6 +1314,9 @@ class forumUpgrade
|
|||||||
public $updateInfo = array();
|
public $updateInfo = array();
|
||||||
private $attachmentData;
|
private $attachmentData;
|
||||||
private $logf;
|
private $logf;
|
||||||
|
private $deprecated = array(
|
||||||
|
'e_latest.php','e_status.php', 'forum_post_shortcodes.php','forum_shortcodes.php',
|
||||||
|
'forum_update_check.php', 'newforumposts_menu_config.php');
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -1322,6 +1325,34 @@ class forumUpgrade
|
|||||||
$this->attachmentData = array();
|
$this->attachmentData = array();
|
||||||
$this->logf = e_LOG . 'forum_upgrade.log';
|
$this->logf = e_LOG . 'forum_upgrade.log';
|
||||||
$this->getUpdateInfo();
|
$this->getUpdateInfo();
|
||||||
|
|
||||||
|
if(empty($updateInfo))
|
||||||
|
{
|
||||||
|
$this->removeDeprecatedFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function removeDeprecatedFiles()
|
||||||
|
{
|
||||||
|
foreach($this->deprecated as $file)
|
||||||
|
{
|
||||||
|
$path = e_PLUGIN."forum/".$file;
|
||||||
|
if(file_exists($path))
|
||||||
|
{
|
||||||
|
if(unlink($path))
|
||||||
|
{
|
||||||
|
e107::getMessage()->addDebug("Deprecated file deleted: <b>".$path."</b>");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e107::getMessage()->addWarning("Was unable to delete the following deprecated file: <b>".$path."</b> (please remove manually)");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function log($msg, $append = true)
|
public function log($msg, $append = true)
|
||||||
@@ -1511,24 +1542,29 @@ class forumUpgrade
|
|||||||
$thread['thread_user'] = $userInfo['user_id'];
|
$thread['thread_user'] = $userInfo['user_id'];
|
||||||
$thread['thread_user_anon'] = $userInfo['anon_name'];
|
$thread['thread_user_anon'] = $userInfo['anon_name'];
|
||||||
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
// If thread marked as 'tracked by starter', we must convert to using
|
// If thread marked as 'tracked by starter', we must convert to using
|
||||||
// forum_track table
|
// forum_track table
|
||||||
if($thread['thread_active'] == 99 && $thread['thread_user'] > 0)
|
if($thread['thread_active'] == 99 && $thread['thread_user'] > 0)
|
||||||
{
|
{
|
||||||
$forum->track('add', $thread['thread_user'], $thread['thread_id'], true);
|
if(!$forum->track('add', $thread['thread_user'], $thread['thread_id'], true))
|
||||||
|
{
|
||||||
|
$this->log(__METHOD__." (track): ".$sql->getLastErrorText(), true);
|
||||||
|
}
|
||||||
$thread['thread_active'] = 1;
|
$thread['thread_active'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $thread['_FIELD_TYPES'] = $forum->fieldTypes['forum_thread'];
|
// $thread['_FIELD_TYPES'] = $forum->fieldTypes['forum_thread'];
|
||||||
// $thread['_FIELD_TYPES']['thread_name'] = 'escape'; //use escape to prevent
|
// $thread['_FIELD_TYPES']['thread_name'] = 'escape'; //use escape to prevent
|
||||||
// double entities
|
// double entities
|
||||||
$sql = e107::getDb();
|
|
||||||
|
|
||||||
$result = $sql->insert('forum_thread', $thread);
|
$result = $sql->insert('forum_thread', $thread);
|
||||||
|
|
||||||
if($result === false)
|
if($result === false)
|
||||||
{
|
{
|
||||||
$this->log($sql->getLastErrorText(), true);
|
$this->log(__METHOD__.": ".$sql->getLastErrorText(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -1584,7 +1620,7 @@ class forumUpgrade
|
|||||||
|
|
||||||
if($result === false)
|
if($result === false)
|
||||||
{
|
{
|
||||||
$this->log($sql->getLastErrorText(), true);
|
$this->log(__METHOD__.": ".$sql->getLastErrorText(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@@ -67,7 +67,7 @@ function init()
|
|||||||
// todo - remove all these globals.
|
// todo - remove all these globals.
|
||||||
global $FORUM_VIEW_START, $urlparms, $doNothing;
|
global $FORUM_VIEW_START, $urlparms, $doNothing;
|
||||||
global $sc, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE;
|
global $sc, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE;
|
||||||
global $forum_info, $FORUM_CRUMB;
|
global $forum_info, $FORUM_CRUMB, $forumInfo;
|
||||||
global $forum;
|
global $forum;
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
Reference in New Issue
Block a user