wiki.techinc.nl/includes/filerepo
Amir Sarabadani 7432b21816 Migrate more calls of Database::select* to SelectQueryBuilder
Using a php parser written on top of ANTLR4, done semi-automatically.

I checked everything and made adjustments.

Bug: T311866
Change-Id: I6150c6909bce8f3dbd745a26380cc0af9d9c547f
2023-07-26 13:01:28 +02:00
..
file Migrate more calls of Database::select* to SelectQueryBuilder 2023-07-26 13:01:28 +02:00
Hook
FileBackendDBRepoWrapper.php Migrate more calls of Database::select* to SelectQueryBuilder 2023-07-26 13:01:28 +02:00
FileRepo.php Move array destructuring into foreach 2023-07-08 19:52:46 +00:00
ForeignAPIRepo.php Replace some more usages of deprecated MWException 2023-06-09 02:07:08 +02:00
ForeignDBRepo.php Create shared interface for foreign db repos 2023-06-13 22:38:34 +02:00
ForeignDBViaLBRepo.php Create shared interface for foreign db repos 2023-06-13 22:38:34 +02:00
IForeignRepoWithDB.php Create shared interface for foreign db repos 2023-06-13 22:38:34 +02:00
IForeignRepoWithMWApi.php
LocalRepo.php Migrate more calls of Database::select* to SelectQueryBuilder 2023-07-26 13:01:28 +02:00
NullRepo.php Fix even more PHPStorm inspections (#3) 2023-03-25 00:30:15 +00:00
README.md
RepoGroup.php Reorg: Namespace the Title class 2023-03-02 08:46:53 -05:00
TempFileRepo.php

FileRepo Architecture

Some quick notes on the file/repository architecture.

Functionality is, as always, driven by data model.

  • The repository object stores configuration information about a file storage method.

  • The file object is a process-local cache of information about a particular file.

Thus the file object is the primary public entry point for obtaining information about files, since access via the file object can be cached, whereas access via the repository should not be cached.

Functions which can act on any file specified in their parameters typically find their place either in the repository object, where reference to repository-specific configuration is needed, or in static members of File or FileRepo, where no such configuration is needed.

File objects are generated by a factory function from the repository. The repository thus has full control over the behavior of its subsidiary file class, since it can subclass the file class and override functionality at its whim. Thus there is no need for the File subclass to query its parent repository for information about repository-class-dependent behavior -- the file subclass is generally fully aware of the static preferences of its repository. Limited exceptions can be made to this rule to permit sharing of functions, or perhaps even entire classes, between repositories.

These rules alone still do lead to some ambiguity -- it may not be clear whether to implement some functionality in a repository function with a filename parameter, or in the file object itself.

So we introduce the following rule: the file subclass is smarter than the repository subclass. The repository should in general provide a minimal API needed to access the storage backend efficiently.

In particular, note that I have not implemented any database access in LocalRepo.php. LocalRepo provides only file access, and LocalFile provides database access and higher-level functions such as cache management.

Tim Starling, June 2007