You are here

function webfm_dbupdate_attach in Web File Manager 5.2

Same name and namespace in other branches
  1. 5 webfm.module \webfm_dbupdate_attach()

webfm_dbupdate_attach - updates the files in the webfm_attach table IF the order

Parameters

int $nid:

array $fids - could be a comma seperated string - we need to work that out - works both ways now:

Return value

TRUE if records were updated - NULL if no changes were required.

1 call to webfm_dbupdate_attach()
webfm_nodeapi in ./webfm.module
Implementation of hook_nodeapi().

File

./webfm.module, line 2157

Code

function webfm_dbupdate_attach($nid, $fids) {
  $i = 0;
  if (!webfm_check_attach_order($nid, $fids)) {

    //the new fids are different from the old ones
    $query = "DELETE FROM {webfm_attach} WHERE nid = %d";
    if ($result = db_query($query, $nid)) {
      foreach ($fids as $fid) {
        if ($fid) {
          webfm_dbinsert_attach($nid, $fid, $i++);
        }
        $flag = TRUE;
      }
      if ($flag === TRUE) {
        return TRUE;
      }
    }
  }
}