You are here

function slack_get_files_list in Slack 7

Deletes file from slack.

Parameters

array $query: Array with query params.

1 call to slack_get_files_list()
slack_cron in ./slack.module
Implements hook_cron().

File

./slack.module, line 149
Main module file, only hooks are allowed here.

Code

function slack_get_files_list(array $query) {
  $files = slack_send_request('files.list', $query);
  if ($files['ok'] == TRUE) {

    // If more than 1 page, append to original call.
    if ($files['paging']['pages'] > 1) {
      for ($i = 2; $i <= $files['paging']['pages']; $i++) {
        $query['page'] = $i;
        $files_next_page = slack_send_request('files.list', $query);
        if ($files_next_page['ok'] == TRUE) {
          $files['paging']['count'] = $files['paging']['count'] + $files_next_page['paging']['count'];
          $files['files'] = array_merge($files['files'], $files_next_page['files']);
        }
        else {
          watchdog('Slack', '@page page error', array(
            '@page' => $query['page'],
          ));
        }
      }
      $files['paging']['pages'] = 1;
    }
    return $files;
  }
  else {
    watchdog('Slack', '@page page error', array(
      '@page' => $query['page'],
    ));
  }
  return FALSE;
}