예제 #1
0
 /**
  * update database with the new owners
  *
  * @param array $owners
  * @throws \Exception
  */
 private function updateOwners($owners)
 {
     $this->connection->beginTransaction();
     try {
         foreach ($owners as $id => $owner) {
             $query = $this->connection->getQueryBuilder();
             $query->update($this->table)->set('parent', $query->createNamedParameter(null))->set('uid_owner', $query->createNamedParameter($owner['owner']))->set('uid_initiator', $query->createNamedParameter($owner['initiator']))->where($query->expr()->eq('id', $query->createNamedParameter($id)))->execute();
         }
         $this->connection->commit();
     } catch (\Exception $e) {
         $this->connection->rollBack();
         throw $e;
     }
 }
예제 #2
0
 private function migrate(LegacyStoragesService $legacyService, StoragesService $storageService)
 {
     $existingStorage = $legacyService->getAllStorages();
     $this->connection->beginTransaction();
     try {
         foreach ($existingStorage as $storage) {
             $storageService->addStorage($storage);
         }
         $this->connection->commit();
     } catch (\Exception $e) {
         $this->logger->logException($e);
         $this->connection->rollBack();
     }
 }
예제 #3
0
 private function migrate(LegacyStoragesService $legacyService, StoragesService $storageService)
 {
     $existingStorage = $legacyService->getAllStorages();
     $this->connection->beginTransaction();
     try {
         foreach ($existingStorage as $storage) {
             $mountOptions = $storage->getMountOptions();
             if (!empty($mountOptions) && !isset($mountOptions['enable_sharing'])) {
                 // existing mounts must have sharing enabled by default to avoid surprises
                 $mountOptions['enable_sharing'] = true;
                 $storage->setMountOptions($mountOptions);
             }
             $storageService->addStorage($storage);
         }
         $this->connection->commit();
     } catch (\Exception $e) {
         $this->logger->logException($e);
         $this->connection->rollBack();
     }
 }
예제 #4
0
파일: db.php 프로젝트: farukuzun/core-1
 /**
  * Rollback the database changes done during a transaction that is in progress
  */
 public function rollBack()
 {
     $this->connection->rollBack();
 }