Merge pull request #509 from marc1706/ticket/508

[ticket/508] Only execute portal once when accessed via domain only
This commit is contained in:
Marc Alexander
2015-03-15 17:29:19 +01:00
3 changed files with 26 additions and 0 deletions

View File

@@ -83,6 +83,9 @@ class main
/** @var int Allowed columns */
protected $allowed_columns;
/** @var bool Portal active flag */
protected $portal_active = false;
/**
* Constructor
* NOTE: The parameters of this method must match in order and type with
@@ -133,8 +136,17 @@ class main
*/
public function handle($columns = array())
{
// Do not run portal if it's already active
if ($this->portal_active)
{
return;
}
$this->controller_helper->run_initial_tasks();
// Set portal active
$this->portal_active = true;
// Check if we should limit the columns to display
$this->set_allowed_columns($columns);

View File

@@ -58,4 +58,9 @@ class template
{
$this->test_case->assertSame($expected, $this->data[$row]);
}
public function delete_var($key)
{
unset($this->data[$key]);
}
}

View File

@@ -91,4 +91,13 @@ class main_test extends \board3\portal\tests\testframework\database_test_case
$this->assertNull($this->controller_main->handle(array('left' => 1)));
$this->template->assert_same(true, 'S_PORTAL_ALL');
}
public function test_display_all_pages_twice()
{
$this->assertNull($this->controller_main->handle(array('left' => 1)));
$this->template->assert_same(true, 'S_PORTAL_ALL');
$this->template->delete_var('S_PORTAL_ALL');
$this->assertNull($this->controller_main->handle(array('left' => 1)));
$this->template->assert_same(null, 'S_PORTAL_ALL');
}
}