You are here

function zoomapi_update_7208 in Zoom API 7.2

Fix recording tracker double serialization.

File

./zoomapi.install, line 241
Install, update, and uninstall hooks for the Zoom API module.

Code

function zoomapi_update_7208() {
  $sql = "\n    SELECT\n      meeting_uuid,\n      data\n    FROM {zoomapi_recordings_download_tracker}\n    WHERE data LIKE 's:%'\n  ";
  $results = db_query($sql)
    ->fetchAllKeyed(0, 1);
  foreach ($results as $meeting_uuid => $data) {
    $limit = 10;
    while (is_string($data) && $limit) {
      $data = unserialize($data);
      $limit--;
    }
    if (is_array($data)) {
      db_update('zoomapi_recordings_download_tracker')
        ->fields([
        'data' => serialize($data),
      ])
        ->condition('meeting_uuid', $meeting_uuid)
        ->execute();
    }
  }
}