diff options
author | Aryeh Gregor <ayg@aryeh.name> | 2019-10-23 16:34:53 +0300 |
---|---|---|
committer | daniel <dkinzler@wikimedia.org> | 2019-11-04 15:17:56 +0100 |
commit | 84cf385db01cbf13ff189199ee543acbf9898de7 (patch) | |
tree | a8c06c28ea42d480db0654e8a8b249f578f5900c /includes/libs/filebackend/filejournal | |
parent | b19bbb5e5f2f60159a1781ccfd42b8cc8292cd98 (diff) | |
download | mediawikicore-84cf385db01cbf13ff189199ee543acbf9898de7.tar.gz mediawikicore-84cf385db01cbf13ff189199ee543acbf9898de7.zip |
Deprecate FileJournal::factory
Instead, the constructors for FileJournal and NullFileJournal should be
treated as stable. I would have added @stable, but our linting doesn't
recognize it yet and doesn't let.
Bug: T235066
Change-Id: I7741055b4f00197d1346ebbfebc14f20238a06f3
Diffstat (limited to 'includes/libs/filebackend/filejournal')
-rw-r--r-- | includes/libs/filebackend/filejournal/FileJournal.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/includes/libs/filebackend/filejournal/FileJournal.php b/includes/libs/filebackend/filejournal/FileJournal.php index 460be0f212b5..937f57e79a1b 100644 --- a/includes/libs/filebackend/filejournal/FileJournal.php +++ b/includes/libs/filebackend/filejournal/FileJournal.php @@ -44,29 +44,33 @@ abstract class FileJournal { protected $ttlDays; /** - * Construct a new instance from configuration. Do not call this directly, use factory(). + * Construct a new instance from configuration. * * @param array $config Includes: - * 'ttlDays' : days to keep log entries around (false means "forever") + * - 'backend': The name of a registered file backend + * - 'ttlDays': Days to keep log entries around (false means "forever") */ public function __construct( array $config ) { + $this->backend = $config['backend']; $this->ttlDays = $config['ttlDays'] ?? false; } /** * Create an appropriate FileJournal object from config * + * @deprecated since 1.35, only FileBackendGroup should need to create FileJournals * @param array $config * @param string $backend A registered file backend name * @throws Exception * @return FileJournal */ final public static function factory( array $config, $backend ) { + wfDeprecated( __METHOD__, '1.35' ); + $jrn = ObjectFactory::getObjectFromSpec( - $config, + [ 'backend' => $backend ] + $config, [ 'specIsArg' => true, 'assertClass' => __CLASS__ ] ); - $jrn->backend = $backend; return $jrn; } |