Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -1812,6 +1812,7 @@ class _Records extends \IPS\Content\Item implements
|
||||
$class = '\IPS\cms\Categories' . static::$customDatabaseId;
|
||||
$category = $class::load( $this->category_id );
|
||||
$category->setLastComment();
|
||||
$category->setLastReview();
|
||||
$category->save();
|
||||
}
|
||||
}
|
||||
@@ -2256,7 +2257,11 @@ class _Records extends \IPS\Content\Item implements
|
||||
|
||||
if ( $topic === NULL )
|
||||
{
|
||||
$this->syncTopic();
|
||||
try
|
||||
{
|
||||
$this->syncTopic();
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
|
||||
/* Try again */
|
||||
$topic = $this->topic( FALSE );
|
||||
@@ -2323,7 +2328,11 @@ class _Records extends \IPS\Content\Item implements
|
||||
}
|
||||
else if ( $this->_forum_forum )
|
||||
{
|
||||
$this->syncTopic();
|
||||
try
|
||||
{
|
||||
$this->syncTopic();
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2368,7 +2377,11 @@ class _Records extends \IPS\Content\Item implements
|
||||
}
|
||||
elseif ( $this->_forum_forum and ! $this->isFutureDate() )
|
||||
{
|
||||
$this->syncTopic();
|
||||
try
|
||||
{
|
||||
$this->syncTopic();
|
||||
}
|
||||
catch( \Exception $ex ) { };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2443,6 +2456,35 @@ class _Records extends \IPS\Content\Item implements
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this topic linked to a record?
|
||||
*
|
||||
* @param \IPS\forums\Topic $topic Forums topic
|
||||
* @return \IPS\cms\Records|NULL
|
||||
*/
|
||||
public static function getLinkedRecord( $topic )
|
||||
{
|
||||
foreach( \IPS\cms\Databases::databases() as $database )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( $database->forum_record and $database->forum_forum == $topic->container()->_id )
|
||||
{
|
||||
$class = '\IPS\cms\Records' . $database->id;
|
||||
$record = $class::load( $topic->tid, 'record_topicid' );
|
||||
|
||||
if ( $record->_forum_record )
|
||||
{
|
||||
return $record;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ) { }
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Topic (checks member's permissions)
|
||||
*
|
||||
@@ -2465,10 +2507,10 @@ class _Records extends \IPS\Content\Item implements
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Post this record as a forum topic
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function syncTopic()
|
||||
@@ -2488,6 +2530,19 @@ class _Records extends \IPS\Content\Item implements
|
||||
throw new \UnexpectedValueException('content_record_bad_forum_for_topic');
|
||||
}
|
||||
|
||||
/* Run a test for the record url, this call will throw an LogicException if the database isn't associated to a page */
|
||||
try
|
||||
{
|
||||
$this->url();
|
||||
}
|
||||
catch ( \LogicException $e )
|
||||
{
|
||||
$idColumn = static::$databaseColumnId;
|
||||
|
||||
\IPS\Log::log( sprintf( "Record %s in database %s tried to sync the topic, but failed because it has no valid url", $this->$idColumn , static::$customDatabaseId), 'cms_topicsync' );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Existing topic */
|
||||
if ( $this->record_topicid )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user