Skip to content

Commit

Permalink
MDL-31863 Web Service : get_files() optional $modified timestamp retu…
Browse files Browse the repository at this point in the history
…rns files changed after given time.
  • Loading branch information
Aparup Banerjee authored and mouneyrac committed Jun 11, 2012
1 parent 8f30395 commit fef6b15
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions files/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public static function get_files_parameters() {
'itemid' => new external_value(PARAM_INT, 'associated id'),
'filepath' => new external_value(PARAM_PATH, 'file path'),
'filename' => new external_value(PARAM_FILE, 'file name'),
'modified' => new external_value(PARAM_INT, 'timestamp, return files which the last ' .
'timemodified time is the same or later than the specified time', VALUE_DEFAULT, null)
'modified' => new external_value(PARAM_INT, 'timestamp to return files changed after this time.', VALUE_DEFAULT, null)
)
);
}
Expand All @@ -68,8 +67,7 @@ public static function get_files_parameters() {
* @param int $itemid item id
* @param string $filepath file path
* @param string $filename file name
* @param int $modified, timestamp, timestamp,
* return files which the last timemodified time is the same or later than the specified time
* @param int $modified timestamp to return files changed after this time.
* @return array
* @since Moodle 2.2
*/
Expand Down Expand Up @@ -123,7 +121,7 @@ public static function get_files($contextid, $component, $filearea, $itemid, $fi
$timemodified = $child->get_timemodified();

if ($child->is_directory()) {
if ((is_null($modified)) or ($modified <= $timemodified)) {
if ((is_null($modified)) or ($modified < $timemodified)) {
$node = array(
'contextid' => $params['contextid'],
'component' => $params['component'],
Expand All @@ -138,7 +136,7 @@ public static function get_files($contextid, $component, $filearea, $itemid, $fi
$list[] = $node;
}
} else {
if ((is_null($modified)) or ($modified <= $timemodified)) {
if ((is_null($modified)) or ($modified < $timemodified)) {
$node = array(
'contextid' => $params['contextid'],
'component' => $params['component'],
Expand Down

0 comments on commit fef6b15

Please sign in to comment.