Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Update SQL query in filescan task #36

@aruethe2

Description

@aruethe2

The timemodified field in the files table does not get updated when a file is copied to a new course. Use the id field in the files table to sort instead. Ideally, we want a specific number of unique contenthashes that reflect the most recently used files. The largest files.id value should be the most recently updated file.

FROM:
$query = 'SELECT distinct f.contenthash, f.timemodified FROM {files} f, {context} c WHERE c.id = f.contextid AND c.contextlevel = 70 AND f.filesize <> 0 AND f.mimetype = "application/pdf" AND f.component != "assignfeedback_editpdf" AND f.filearea != "stamps" AND f.contenthash NOT IN (SELECT contenthash FROM {block_filescan_files} where checked=True or (checked=False and status="error" and statuscode >=' . $max_retries . ')) ORDER BY f.timemodified DESC LIMIT ' . $max_files_to_check;

To: (maybe)
$query = 'SELECT f.contenthash, f.id FROM {files} f, {context} c WHERE c.id = f.contextid AND c.contextlevel = 70 AND f.filesize <> 0 AND f.mimetype = "application/pdf" AND f.component != "assignfeedback_editpdf" AND f.filearea != "stamps" AND f.contenthash NOT IN (SELECT contenthash FROM {block_filescan_files} where checked=True or (checked=False and status="error" and statuscode >=' . $max_retries . ')) ORDER BY f.id DESC LIMIT ' . $max_files_to_check;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions