mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Moved Controller::init() to top of file
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64403 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
252f739919
commit
e820c88be0
@ -69,6 +69,30 @@ class Controller extends RequestHandlingData {
|
||||
'handleIndex',
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialisation function that is run before any action on the controller is called.
|
||||
*
|
||||
* @uses BasicAuth::requireLogin()
|
||||
*/
|
||||
function init() {
|
||||
// Test and development sites should be secured, via basic-auth
|
||||
if(ClassInfo::hasTable("Group") && ClassInfo::hasTable("Member") && Director::isTest() && $this->basicAuthEnabled) {
|
||||
BasicAuth::requireLogin("SilverStripe test website. Use your CMS login", "ADMIN");
|
||||
}
|
||||
|
||||
//
|
||||
Cookie::set("PastVisitor", true);
|
||||
|
||||
// ClassInfo::hasTable() called to ensure that we're not in a very-first-setup stage
|
||||
if(ClassInfo::hasTable("Group") && ClassInfo::hasTable("Member") && ($member = Member::currentUser())) {
|
||||
Cookie::set("PastMember", true);
|
||||
DB::query("UPDATE Member SET LastVisited = NOW() WHERE ID = $member->ID", null);
|
||||
}
|
||||
|
||||
// This is used to test that subordinate controllers are actually calling parent::init() - a common bug
|
||||
$this->baseInitCalled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles HTTP requests.
|
||||
*
|
||||
@ -311,30 +335,6 @@ class Controller extends RequestHandlingData {
|
||||
function disableBasicAuth() {
|
||||
$this->basicAuthEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisation function that is run before any action on the controller is called.
|
||||
*
|
||||
* @uses BasicAuth::requireLogin()
|
||||
*/
|
||||
function init() {
|
||||
// Test and development sites should be secured, via basic-auth
|
||||
if(ClassInfo::hasTable("Group") && ClassInfo::hasTable("Member") && Director::isTest() && $this->basicAuthEnabled) {
|
||||
BasicAuth::requireLogin("SilverStripe test website. Use your CMS login", "ADMIN");
|
||||
}
|
||||
|
||||
//
|
||||
Cookie::set("PastVisitor", true);
|
||||
|
||||
// ClassInfo::hasTable() called to ensure that we're not in a very-first-setup stage
|
||||
if(ClassInfo::hasTable("Group") && ClassInfo::hasTable("Member") && ($member = Member::currentUser())) {
|
||||
Cookie::set("PastMember", true);
|
||||
DB::query("UPDATE Member SET LastVisited = NOW() WHERE ID = $member->ID", null);
|
||||
}
|
||||
|
||||
// This is used to test that subordinate controllers are actually calling parent::init() - a common bug
|
||||
$this->baseInitCalled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current controller
|
||||
|
Loading…
Reference in New Issue
Block a user