Skip to content

Commit c20c342

Browse files
API Remove deprecated code (#48)
1 parent e5162c8 commit c20c342

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

code/AuditHook.php

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
namespace SilverStripe\Auditor;
44

5-
use SilverStripe\Dev\Deprecation;
65
use SilverStripe\Control\Email\Email;
76
use SilverStripe\Core\Injector\Injector;
8-
use SilverStripe\ORM\Connect\Database;
97
use SilverStripe\ORM\DataExtension;
108
use SilverStripe\ORM\DataObject;
119
use SilverStripe\ORM\DataObjectSchema;
@@ -31,56 +29,6 @@ protected function getAuditLogger()
3129
return Injector::inst()->get('AuditLogger');
3230
}
3331

34-
/**
35-
* This will bind a new class dynamically so we can hook into manipulation
36-
* and capture it. It creates a new PHP file in the temp folder, then
37-
* loads it and sets it as the active DB class.
38-
*
39-
* @deprecated 2.1.0 Use ProxyDBExtension with the tractorcow/silverstripe-proxy-db module instead
40-
*/
41-
public static function bind_manipulation_capture()
42-
{
43-
Deprecation::notice('2.1.0', 'Use ProxyDBExtension with the tractorcow/silverstripe-proxy-db module instead');
44-
$current = DB::get_conn();
45-
if (!$current || !$current->getConnector()->getSelectedDatabase() || @$current->isManipulationLoggingCapture) {
46-
return;
47-
} // If not yet set, or its already captured, just return
48-
49-
$type = get_class($current);
50-
$sanitisedType = str_replace('\\', '_', $type ?? '');
51-
$file = TEMP_FOLDER . "/.cache.CLC.$sanitisedType";
52-
$dbClass = 'AuditLoggerManipulateCapture_' . $sanitisedType;
53-
54-
if (!is_file($file ?? '')) {
55-
file_put_contents($file ?? '', "<?php
56-
class $dbClass extends $type
57-
{
58-
public \$isManipulationLoggingCapture = true;
59-
60-
public function manipulate(\$manipulation)
61-
{
62-
\SilverStripe\Auditor\AuditHook::handle_manipulation(\$manipulation);
63-
return parent::manipulate(\$manipulation);
64-
}
65-
}
66-
");
67-
}
68-
69-
require_once $file;
70-
71-
/** @var Database $captured */
72-
$captured = new $dbClass();
73-
74-
$captured->setConnector($current->getConnector());
75-
$captured->setQueryBuilder($current->getQueryBuilder());
76-
$captured->setSchemaManager($current->getSchemaManager());
77-
78-
// The connection might have had it's name changed (like if we're currently in a test)
79-
$captured->selectDatabase($current->getConnector()->getSelectedDatabase());
80-
81-
DB::set_conn($captured);
82-
}
83-
8432
public static function handle_manipulation($manipulation)
8533
{
8634
$auditLogger = Injector::inst()->get('AuditLogger');
@@ -394,17 +342,6 @@ public function authenticationFailed($data)
394342
$this->getAuditLogger()->info(sprintf('Failed login attempt using email "%s"', $login));
395343
}
396344

397-
/**
398-
* @deprecated 2.1.0 Use tractorcow/silverstripe-proxy-db instead
399-
*/
400-
public function onBeforeInit()
401-
{
402-
Deprecation::withNoReplacement(function () {
403-
Deprecation::notice('2.1.0', 'Use tractorcow/silverstripe-proxy-db instead');
404-
});
405-
// no-op
406-
}
407-
408345
/**
409346
* Log permission failures (where the status is set after init of page).
410347
*/

0 commit comments

Comments
 (0)