<commit_before><?php

class Lock extends BaseLock {

  protected static function getInstance() {
    $lock = acCouchdbManager::getClient()->find('Lock');
    if ($lock) {
      return $lock;
    }
    $lock = new Lock();
    $lock->_id = 'Lock';
    $lock->type = 'Lock';
    return $lock;
  }

  public static function runLock($ilockobject, $args =  null) {
    for($i = 0 ; $i < 10 ; $i++) {
      try {
        $lock = Lock::getInstance();
        $res = $ilockobject->executeLock($args);
        if (!isset($res['key'])) {

          throw new sfException('executeLock needs to return a hashtable with an element "key"');
        }
        if (!isset($res['value'])) {

          throw new sfException('executeLock needs to return a hashtable with an element "value"');
        }
        if($lock->exist($res['key']) && $lock->get($res['key']) == $res['value']) {
          $docid = preg_replace('/^.*:/', '', $lock->get($res['value']));
          if(acCouchdbManager::getClient()->find($docid, acCouchdbClient::HYDRATE_JSON)) {
            throw new sfException('the archive value need to be different from the lock one');
          }
        }
        $lock->add($res['key'], $res['value'].':'.$res['docid']); 
        $lock->save();
        break;
      }catch(sfException $e) {
      }
      sleep(1);
    }
    if ($i >= 10) {

      throw new sfException("Could not acquire the archive lock, il faut s'assurer que le numéro d'archive de lock est égal au plus élévé de celui des vues");<commit_msg>Lock catch sfException au lieu de Exception<commit_after><?php

class Lock extends BaseLock {

  protected static function getInstance() {
    $lock = acCouchdbManager::getClient()->find('Lock');
    if ($lock) {
      return $lock;
    }
    $lock = new Lock();
    $lock->_id = 'Lock';
    $lock->type = 'Lock';
    return $lock;
  }

  public static function runLock($ilockobject, $args =  null) {
    for($i = 0 ; $i < 10 ; $i++) {
      try {
        $lock = Lock::getInstance();
        $res = $ilockobject->executeLock($args);
        if (!isset($res['key'])) {

          throw new sfException('executeLock needs to return a hashtable with an element "key"');
        }
        if (!isset($res['value'])) {

          throw new sfException('executeLock needs to return a hashtable with an element "value"');
        }
        if($lock->exist($res['key']) && $lock->get($res['key']) == $res['value']) {
          $docid = preg_replace('/^.*:/', '', $lock->get($res['value']));
          if(acCouchdbManager::getClient()->find($docid, acCouchdbClient::HYDRATE_JSON)) {
            throw new sfException('the archive value need to be different from the lock one');
          }
        }
        $lock->add($res['key'], $res['value'].':'.$res['docid']); 
        $lock->save();
        break;
      }catch(Exception $e) {
      }
      sleep(1);
    }
    if ($i >= 10) {

      throw new sfException("Could not acquire the archive lock, il faut s'assurer que le numéro d'archive de lock est égal au plus élévé de celui des vues");
{'fraction_non_alphanumeric': 0.17357001972386588, 'fraction_numerical': 0.0039447731755424065, 'mean_word_length': 2.6356033452807646, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5181276', 'n_tokens_mistral': 941, 'n_tokens_neox': 916, 'n_words': 255}