hook_views_query_alter all condition
Altering a query like this is really not recommended.

First of all, you should use SelectQuery methods provided by "$query" variable.
You can get an array of query conditions by using "SelectQuery::conditions()" method.

Be careful, if you want to alter this array get the array like the following snippet :

$conditions =&amp; $query-&gt;conditions();
//Now you can use and alter your query conditions.


Some others tips related to your code :

1) You can tag your query in Views UI

Add a tag to your Views Query :


With this trick you can define a special hook for altering all query who use this tag. This hook is "hook_query_TAG_alter"

Now you can use this code :

function YOUR_MODULE_query_my_tag_alter($query) {
  $conditions =&amp; $query-&gt;conditions();
  //This condition is useless now
  //if ($view-&gt;vid == 7) {
  //Check conditions and do your updates

  //}
}


2) Careful to the module weight

When you alter something, other modules can do it too...
This order is determined by the module weight saved in the "system" table.

By using your own tags on your query, other modules should not know about this tag and should not alter your query.

You can change your module weight but this is not the thread of this post

Links

SelectQuery Api

SelectQuery::conditions() method

Query Alteration recommandations by Drupal

hook_query_TAG_alter

Change Module Weight