original_string: public function getKeyUses($tablename, $keyname) {
  
          $uses = array();
  
          // Check if some foreign key in the whole structure is using it
          // (by comparing the reftable and reffields with the fields in the key)
          $mytable = $this->getTable($tablename);
          $mykey = $mytable->getKey($keyname);
          if ($this->tables && $mykey) {
              foreach ($this->tables as $table) {
                  $allkeys = $table->getKeys();
                  if ($allkeys) {
                      foreach ($allkeys as $key) {
                          if ($key->getType() != XMLDB_KEY_FOREIGN) {
                              continue;
                          }
                          if ($key->getRefTable() == $tablename &&
                              implode(',', $key->getRefFields()) == implode(',', $mykey->getFields())) {
                                  $uses[] = 'table ' . $table->getName() . ' key ' . $key->getName();
                          }
                      }
                  }
              }
          }
  
          // Return result
          if (!empty($uses)) {
              return $uses;
          } else {
              return false;
          }
      }
code: public function getKeyUses($tablename, $keyname) {
  
          $uses = array();
  
          // Check if some foreign key in the whole structure is using it
          // (by comparing the reftable and reffields with the fields in the key)
          $mytable = $this->getTable($tablename);
          $mykey = $mytable->getKey($keyname);
          if ($this->tables && $mykey) {
              foreach ($this->tables as $table) {
                  $allkeys = $table->getKeys();
                  if ($allkeys) {
                      foreach ($allkeys as $key) {
                          if ($key->getType() != XMLDB_KEY_FOREIGN) {
                              continue;
                          }
                          if ($key->getRefTable() == $tablename &&
                              implode(',', $key->getRefFields()) == implode(',', $mykey->getFields())) {
                                  $uses[] = 'table ' . $table->getName() . ' key ' . $key->getName();
                          }
                      }
                  }
              }
          }
  
          // Return result
          if (!empty($uses)) {
              return $uses;
          } else {
              return false;
          }
      }
code_tokens: public function getKeyUses ( $ tablename , $ keyname ) { $ uses = array ( ) ; // Check if some foreign key in the whole structure is using it // (by comparing the reftable and reffields with the fields in the key) $ mytable = $ this -> getTable ( $ tablename ) ; $ mykey = $ mytable -> getKey ( $ keyname ) ; if ( $ this -> tables && $ mykey ) { foreach ( $ this -> tables as $ table ) { $ allkeys = $ table -> getKeys ( ) ; if ( $ allkeys ) { foreach ( $ allkeys as $ key ) { if ( $ key -> getType ( ) != XMLDB_KEY_FOREIGN ) { continue ; } if ( $ key -> getRefTable ( ) == $ tablename && implode ( ',' , $ key -> getRefFields ( ) ) == implode ( ',' , $ mykey -> getFields ( ) ) ) { $ uses [ ] = 'table ' . $ table -> getName ( ) . ' key ' . $ key -> getName ( ) ; } } } } } // Return result if ( ! empty ( $ uses ) ) { return $ uses ; } else { return false ; } }
docstring: This function returns the number of uses of one key inside
  a whole xmldb_structure. Useful to detect if the key must be
  locked. Return false if no uses are found.
  @param string $tablename
  @param string $keyname
  @return mixed
docstring_tokens: This function returns the number of uses of one key inside a whole xmldb_structure . Useful to detect if the key must be locked . Return false if no uses are found .