2
2
3
3
namespace SilverStripe \Auditor ;
4
4
5
- use SilverStripe \Dev \Deprecation ;
6
5
use SilverStripe \Control \Email \Email ;
7
6
use SilverStripe \Core \Injector \Injector ;
8
- use SilverStripe \ORM \Connect \Database ;
9
7
use SilverStripe \ORM \DataExtension ;
10
8
use SilverStripe \ORM \DataObject ;
11
9
use SilverStripe \ORM \DataObjectSchema ;
@@ -31,56 +29,6 @@ protected function getAuditLogger()
31
29
return Injector::inst ()->get ('AuditLogger ' );
32
30
}
33
31
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
-
84
32
public static function handle_manipulation ($ manipulation )
85
33
{
86
34
$ auditLogger = Injector::inst ()->get ('AuditLogger ' );
@@ -394,17 +342,6 @@ public function authenticationFailed($data)
394
342
$ this ->getAuditLogger ()->info (sprintf ('Failed login attempt using email "%s" ' , $ login ));
395
343
}
396
344
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
-
408
345
/**
409
346
* Log permission failures (where the status is set after init of page).
410
347
*/
0 commit comments