'TempFSFile' => 'includes/filerepo/file/TempFSFile.php',
# includes/filerepo/backend
+ 'ContainerShardListIterator' => 'includes/filerepo/backend/FileBackend.php',
'FileBackendGroup' => 'includes/filerepo/backend/FileBackendGroup.php',
'FileBackendBase' => 'includes/filerepo/backend/FileBackend.php',
'FileBackend' => 'includes/filerepo/backend/FileBackend.php',
/**
* Check if a file exists at a storage path in the backend.
+ * This returns false if only a directory exists at the path.
*
* $params include:
* src : source storage path
/**
* Base class for all single-write backends.
* This class defines the methods as abstract that subclasses must implement.
+ * Callers outside of FileBackend and its helper classes, such as FileOp,
+ * should only call functions that are present in FileBackendBase.
+ *
+ * The FileBackendBase operations are implemented using primitive functions
+ * such as storeInternal(), copyInternal(), deleteInternal() and the like.
+ * This class is also responsible for path resolution and sanitization.
*
* @ingroup FileBackend
* @since 1.19
}
function buildOldImage() {
- $this->buildTable( 'oldimage', 'oi_archive_name',
- array( $this, 'oldimageCallback' ) );
+ $this->buildTable( 'oldimage', 'oi_archive_name', array( $this, 'oldimageCallback' ) );
}
function oldimageCallback( $row, $copy ) {
}
function crawlMissing() {
- $repo = RepoGroup::singleton()->getLocalRepo();
- $repo->enumFilesInFS( array( $this, 'checkMissingImage' ) );
+ $this->getRepo()->enumFiles( array( $this, 'checkMissingImage' ) );
}
function checkMissingImage( $fullpath ) {
$filename = wfBaseName( $fullpath );
- if ( is_dir( $fullpath ) ) {
- return;
- }
- if ( is_link( $fullpath ) ) {
- $this->output( "skipping symlink at $fullpath\n" );
- return;
- }
$row = $this->dbw->selectRow( 'image',
array( 'img_name' ),
array( 'img_name' => $filename ),
__METHOD__ );
- if ( $row ) {
- // already known, move on
- return;
- } else {
+ if ( !$row ) { // file not registered
$this->addMissingImage( $filename, $fullpath );
}
}
function addMissingImage( $filename, $fullpath ) {
- $timestamp = $this->dbw->timestamp( filemtime( $fullpath ) );
-
global $wgContLang;
+
+ $timestamp = $this->dbw->timestamp( $this->getRepo()->getFileTimestamp( $fullpath ) );
+
$altname = $wgContLang->checkTitleEncoding( $filename );
if ( $altname != $filename ) {
if ( $this->dryrun ) {
$filename = $altname;
$this->output( "Estimating transcoding... $altname\n" );
} else {
+ # @FIXME: create renameFile()
$filename = $this->renameFile( $filename );
}
}