Passed
Push — master ( cb2b38...37146c )
by Roeland
12:06 queued 11s
created
apps/files_external/lib/Command/Delete.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 		try {
69 69
 			$mount = $this->globalService->getStorage($mountId);
70 70
 		} catch (NotFoundException $e) {
71
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
71
+			$output->writeln('<error>Mount with id "'.$mountId.' not found, check "occ files_external:list" to get available mounts"</error>');
72 72
 			return 404;
73 73
 		}
74 74
 
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -37,76 +37,76 @@
 block discarded – undo
37 37
 use Symfony\Component\Console\Question\ConfirmationQuestion;
38 38
 
39 39
 class Delete extends Base {
40
-	/**
41
-	 * @var GlobalStoragesService
42
-	 */
43
-	protected $globalService;
40
+    /**
41
+     * @var GlobalStoragesService
42
+     */
43
+    protected $globalService;
44 44
 
45
-	/**
46
-	 * @var UserStoragesService
47
-	 */
48
-	protected $userService;
45
+    /**
46
+     * @var UserStoragesService
47
+     */
48
+    protected $userService;
49 49
 
50
-	/**
51
-	 * @var IUserSession
52
-	 */
53
-	protected $userSession;
50
+    /**
51
+     * @var IUserSession
52
+     */
53
+    protected $userSession;
54 54
 
55
-	/**
56
-	 * @var IUserManager
57
-	 */
58
-	protected $userManager;
55
+    /**
56
+     * @var IUserManager
57
+     */
58
+    protected $userManager;
59 59
 
60
-	function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
61
-		parent::__construct();
62
-		$this->globalService = $globalService;
63
-		$this->userService = $userService;
64
-		$this->userSession = $userSession;
65
-		$this->userManager = $userManager;
66
-	}
60
+    function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
61
+        parent::__construct();
62
+        $this->globalService = $globalService;
63
+        $this->userService = $userService;
64
+        $this->userSession = $userSession;
65
+        $this->userManager = $userManager;
66
+    }
67 67
 
68
-	protected function configure() {
69
-		$this
70
-			->setName('files_external:delete')
71
-			->setDescription('Delete an external mount')
72
-			->addArgument(
73
-				'mount_id',
74
-				InputArgument::REQUIRED,
75
-				'The id of the mount to edit'
76
-			)->addOption(
77
-				'yes',
78
-				'y',
79
-				InputOption::VALUE_NONE,
80
-				'Skip confirmation'
81
-			);
82
-		parent::configure();
83
-	}
68
+    protected function configure() {
69
+        $this
70
+            ->setName('files_external:delete')
71
+            ->setDescription('Delete an external mount')
72
+            ->addArgument(
73
+                'mount_id',
74
+                InputArgument::REQUIRED,
75
+                'The id of the mount to edit'
76
+            )->addOption(
77
+                'yes',
78
+                'y',
79
+                InputOption::VALUE_NONE,
80
+                'Skip confirmation'
81
+            );
82
+        parent::configure();
83
+    }
84 84
 
85
-	protected function execute(InputInterface $input, OutputInterface $output) {
86
-		$mountId = $input->getArgument('mount_id');
87
-		try {
88
-			$mount = $this->globalService->getStorage($mountId);
89
-		} catch (NotFoundException $e) {
90
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
91
-			return 404;
92
-		}
85
+    protected function execute(InputInterface $input, OutputInterface $output) {
86
+        $mountId = $input->getArgument('mount_id');
87
+        try {
88
+            $mount = $this->globalService->getStorage($mountId);
89
+        } catch (NotFoundException $e) {
90
+            $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
91
+            return 404;
92
+        }
93 93
 
94
-		$noConfirm = $input->getOption('yes');
94
+        $noConfirm = $input->getOption('yes');
95 95
 
96
-		if (!$noConfirm) {
97
-			$listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
98
-			$listInput = new ArrayInput([], $listCommand->getDefinition());
99
-			$listInput->setOption('output', $input->getOption('output'));
100
-			$listCommand->listMounts(null, [$mount], $listInput, $output);
96
+        if (!$noConfirm) {
97
+            $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
98
+            $listInput = new ArrayInput([], $listCommand->getDefinition());
99
+            $listInput->setOption('output', $input->getOption('output'));
100
+            $listCommand->listMounts(null, [$mount], $listInput, $output);
101 101
 
102
-			$questionHelper = $this->getHelper('question');
103
-			$question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
102
+            $questionHelper = $this->getHelper('question');
103
+            $question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
104 104
 
105
-			if (!$questionHelper->ask($input, $output, $question)) {
106
-				return null;
107
-			}
108
-		}
105
+            if (!$questionHelper->ask($input, $output, $question)) {
106
+                return null;
107
+            }
108
+        }
109 109
 
110
-		$this->globalService->removeStorage($mountId);
111
-	}
110
+        $this->globalService->removeStorage($mountId);
111
+    }
112 112
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
 		\OC_Util::setupFS($user);
118 118
 
119 119
 		// Check if this user has a trashbin directory
120
-		$view = new \OC\Files\View('/' . $user);
120
+		$view = new \OC\Files\View('/'.$user);
121 121
 		if (!$view->is_dir('/files_trashbin/files')) {
122 122
 			return false;
123 123
 		}
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -34,77 +34,77 @@
 block discarded – undo
34 34
 
35 35
 class ExpireTrash extends \OC\BackgroundJob\TimedJob {
36 36
 
37
-	/**
38
-	 * @var Expiration
39
-	 */
40
-	private $expiration;
37
+    /**
38
+     * @var Expiration
39
+     */
40
+    private $expiration;
41 41
 	
42
-	/**
43
-	 * @var IUserManager
44
-	 */
45
-	private $userManager;
42
+    /**
43
+     * @var IUserManager
44
+     */
45
+    private $userManager;
46 46
 
47
-	/**
48
-	 * @param IUserManager|null $userManager
49
-	 * @param Expiration|null $expiration
50
-	 */
51
-	public function __construct(IUserManager $userManager = null,
52
-								Expiration $expiration = null) {
53
-		// Run once per 30 minutes
54
-		$this->setInterval(60 * 30);
47
+    /**
48
+     * @param IUserManager|null $userManager
49
+     * @param Expiration|null $expiration
50
+     */
51
+    public function __construct(IUserManager $userManager = null,
52
+                                Expiration $expiration = null) {
53
+        // Run once per 30 minutes
54
+        $this->setInterval(60 * 30);
55 55
 
56
-		if (is_null($expiration) || is_null($userManager)) {
57
-			$this->fixDIForJobs();
58
-		} else {
59
-			$this->userManager = $userManager;
60
-			$this->expiration = $expiration;
61
-		}
62
-	}
56
+        if (is_null($expiration) || is_null($userManager)) {
57
+            $this->fixDIForJobs();
58
+        } else {
59
+            $this->userManager = $userManager;
60
+            $this->expiration = $expiration;
61
+        }
62
+    }
63 63
 
64
-	protected function fixDIForJobs() {
65
-		/** @var Application $application */
66
-		$application = \OC::$server->query(Application::class);
67
-		$this->userManager = \OC::$server->getUserManager();
68
-		$this->expiration = $application->getContainer()->query('Expiration');
69
-	}
64
+    protected function fixDIForJobs() {
65
+        /** @var Application $application */
66
+        $application = \OC::$server->query(Application::class);
67
+        $this->userManager = \OC::$server->getUserManager();
68
+        $this->expiration = $application->getContainer()->query('Expiration');
69
+    }
70 70
 
71
-	/**
72
-	 * @param $argument
73
-	 * @throws \Exception
74
-	 */
75
-	protected function run($argument) {
76
-		$maxAge = $this->expiration->getMaxAgeAsTimestamp();
77
-		if (!$maxAge) {
78
-			return;
79
-		}
71
+    /**
72
+     * @param $argument
73
+     * @throws \Exception
74
+     */
75
+    protected function run($argument) {
76
+        $maxAge = $this->expiration->getMaxAgeAsTimestamp();
77
+        if (!$maxAge) {
78
+            return;
79
+        }
80 80
 
81
-		$this->userManager->callForSeenUsers(function(IUser $user) {
82
-			$uid = $user->getUID();
83
-			if (!$this->setupFS($uid)) {
84
-				return;
85
-			}
86
-			$dirContent = Helper::getTrashFiles('/', $uid, 'mtime');
87
-			Trashbin::deleteExpiredFiles($dirContent, $uid);
88
-		});
81
+        $this->userManager->callForSeenUsers(function(IUser $user) {
82
+            $uid = $user->getUID();
83
+            if (!$this->setupFS($uid)) {
84
+                return;
85
+            }
86
+            $dirContent = Helper::getTrashFiles('/', $uid, 'mtime');
87
+            Trashbin::deleteExpiredFiles($dirContent, $uid);
88
+        });
89 89
 		
90
-		\OC_Util::tearDownFS();
91
-	}
90
+        \OC_Util::tearDownFS();
91
+    }
92 92
 
93
-	/**
94
-	 * Act on behalf on trash item owner
95
-	 * @param string $user
96
-	 * @return boolean
97
-	 */
98
-	protected function setupFS($user) {
99
-		\OC_Util::tearDownFS();
100
-		\OC_Util::setupFS($user);
93
+    /**
94
+     * Act on behalf on trash item owner
95
+     * @param string $user
96
+     * @return boolean
97
+     */
98
+    protected function setupFS($user) {
99
+        \OC_Util::tearDownFS();
100
+        \OC_Util::setupFS($user);
101 101
 
102
-		// Check if this user has a trashbin directory
103
-		$view = new \OC\Files\View('/' . $user);
104
-		if (!$view->is_dir('/files_trashbin/files')) {
105
-			return false;
106
-		}
102
+        // Check if this user has a trashbin directory
103
+        $view = new \OC\Files\View('/' . $user);
104
+        if (!$view->is_dir('/files_trashbin/files')) {
105
+            return false;
106
+        }
107 107
 
108
-		return true;
109
-	}
108
+        return true;
109
+    }
110 110
 }
Please login to merge, or discard this patch.
apps/files_external/templates/list.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 		<tr>
18 18
 			<th id='headerName' class="hidden column-name">
19 19
 				<div id="headerName-container">
20
-					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a>
20
+					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a>
21 21
 				</div>
22 22
 			</th>
23 23
 			<th id="headerBackend" class="hidden column-backend">
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/Actions/LinkAction.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -28,76 +28,76 @@
 block discarded – undo
28 28
 
29 29
 class LinkAction implements ILinkAction {
30 30
 
31
-	/** @var string */
32
-	private $icon;
33
-
34
-	/** @var string */
35
-	private $name;
36
-
37
-	/** @var string */
38
-	private $href;
39
-
40
-	/** @var int */
41
-	private $priority = 10;
42
-
43
-	/**
44
-	 * @param string $icon absolute URI to an icon
45
-	 */
46
-	public function setIcon($icon) {
47
-		$this->icon = $icon;
48
-	}
49
-
50
-	/**
51
-	 * @param string $name
52
-	 */
53
-	public function setName($name) {
54
-		$this->name = $name;
55
-	}
56
-
57
-	/**
58
-	 * @return string
59
-	 */
60
-	public function getName() {
61
-		return $this->name;
62
-	}
63
-
64
-	/**
65
-	 * @param int $priority
66
-	 */
67
-	public function setPriority($priority) {
68
-		$this->priority = $priority;
69
-	}
70
-
71
-	/**
72
-	 * @return int
73
-	 */
74
-	public function getPriority() {
75
-		return $this->priority;
76
-	}
77
-
78
-	/**
79
-	 * @param string $href
80
-	 */
81
-	public function setHref($href) {
82
-		$this->href = $href;
83
-	}
84
-
85
-	/**
86
-	 * @return string
87
-	 */
88
-	public function getHref() {
89
-		return $this->href;
90
-	}
91
-
92
-	/**
93
-	 * @return array
94
-	 */
95
-	public function jsonSerialize() {
96
-		return [
97
-			'title' => $this->name,
98
-			'icon' => $this->icon,
99
-			'hyperlink' => $this->href,
100
-		];
101
-	}
31
+    /** @var string */
32
+    private $icon;
33
+
34
+    /** @var string */
35
+    private $name;
36
+
37
+    /** @var string */
38
+    private $href;
39
+
40
+    /** @var int */
41
+    private $priority = 10;
42
+
43
+    /**
44
+     * @param string $icon absolute URI to an icon
45
+     */
46
+    public function setIcon($icon) {
47
+        $this->icon = $icon;
48
+    }
49
+
50
+    /**
51
+     * @param string $name
52
+     */
53
+    public function setName($name) {
54
+        $this->name = $name;
55
+    }
56
+
57
+    /**
58
+     * @return string
59
+     */
60
+    public function getName() {
61
+        return $this->name;
62
+    }
63
+
64
+    /**
65
+     * @param int $priority
66
+     */
67
+    public function setPriority($priority) {
68
+        $this->priority = $priority;
69
+    }
70
+
71
+    /**
72
+     * @return int
73
+     */
74
+    public function getPriority() {
75
+        return $this->priority;
76
+    }
77
+
78
+    /**
79
+     * @param string $href
80
+     */
81
+    public function setHref($href) {
82
+        $this->href = $href;
83
+    }
84
+
85
+    /**
86
+     * @return string
87
+     */
88
+    public function getHref() {
89
+        return $this->href;
90
+    }
91
+
92
+    /**
93
+     * @return array
94
+     */
95
+    public function jsonSerialize() {
96
+        return [
97
+            'title' => $this->name,
98
+            'icon' => $this->icon,
99
+            'hyperlink' => $this->href,
100
+        ];
101
+    }
102 102
 
103 103
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IAction.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -33,33 +33,33 @@
 block discarded – undo
33 33
  */
34 34
 interface IAction extends JsonSerializable {
35 35
 
36
-	/**
37
-	 * @param string $icon absolute URI to an icon
38
-	 * @since 12.0
39
-	 */
40
-	public function setIcon($icon);
36
+    /**
37
+     * @param string $icon absolute URI to an icon
38
+     * @since 12.0
39
+     */
40
+    public function setIcon($icon);
41 41
 
42
-	/**
43
-	 * @return string localized action name, e.g. 'Call'
44
-	 * @since 12.0
45
-	 */
46
-	public function getName();
42
+    /**
43
+     * @return string localized action name, e.g. 'Call'
44
+     * @since 12.0
45
+     */
46
+    public function getName();
47 47
 
48
-	/**
49
-	 * @param string $name localized action name, e.g. 'Call'
50
-	 * @since 12.0
51
-	 */
52
-	public function setName($name);
48
+    /**
49
+     * @param string $name localized action name, e.g. 'Call'
50
+     * @since 12.0
51
+     */
52
+    public function setName($name);
53 53
 
54
-	/**
55
-	 * @param int $priority priorize actions, high order ones are shown on top
56
-	 * @since 12.0
57
-	 */
58
-	public function setPriority($priority);
54
+    /**
55
+     * @param int $priority priorize actions, high order ones are shown on top
56
+     * @since 12.0
57
+     */
58
+    public function setPriority($priority);
59 59
 
60
-	/**
61
-	 * @return int priority to priorize actions, high order ones are shown on top
62
-	 * @since 12.0
63
-	 */
64
-	public function getPriority();
60
+    /**
61
+     * @return int priority to priorize actions, high order ones are shown on top
62
+     * @since 12.0
63
+     */
64
+    public function getPriority();
65 65
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IActionFactory.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,27 +28,27 @@
 block discarded – undo
28 28
  */
29 29
 interface IActionFactory {
30 30
 
31
-	/**
32
-	 * Construct and return a new link action for the contacts menu
33
-	 *
34
-	 * @since 12.0
35
-	 *
36
-	 * @param string $icon full path to the action's icon
37
-	 * @param string $name localized name of the action
38
-	 * @param string $href target URL
39
-	 * @return ILinkAction
40
-	 */
41
-	public function newLinkAction($icon, $name, $href);
31
+    /**
32
+     * Construct and return a new link action for the contacts menu
33
+     *
34
+     * @since 12.0
35
+     *
36
+     * @param string $icon full path to the action's icon
37
+     * @param string $name localized name of the action
38
+     * @param string $href target URL
39
+     * @return ILinkAction
40
+     */
41
+    public function newLinkAction($icon, $name, $href);
42 42
 
43
-	/**
44
-	 * Construct and return a new email action for the contacts menu
45
-	 *
46
-	 * @since 12.0
47
-	 *
48
-	 * @param string $icon full path to the action's icon
49
-	 * @param string $name localized name of the action
50
-	 * @param string $email target e-mail address
51
-	 * @return ILinkAction
52
-	 */
53
-	public function newEMailAction($icon, $name, $email);
43
+    /**
44
+     * Construct and return a new email action for the contacts menu
45
+     *
46
+     * @since 12.0
47
+     *
48
+     * @param string $icon full path to the action's icon
49
+     * @param string $name localized name of the action
50
+     * @param string $email target e-mail address
51
+     * @return ILinkAction
52
+     */
53
+    public function newEMailAction($icon, $name, $email);
54 54
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/ILinkAction.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
29 29
  */
30 30
 interface ILinkAction extends IAction {
31 31
 
32
-	/**
33
-	 * @since 12.0
34
-	 * @param string $href the target URL of the action
35
-	 */
36
-	public function setHref($href);
32
+    /**
33
+     * @since 12.0
34
+     * @param string $href the target URL of the action
35
+     */
36
+    public function setHref($href);
37 37
 
38
-	/**
39
-	 * @since 12.0
40
-	 * @return string
41
-	 */
42
-	public function getHref();
38
+    /**
39
+     * @since 12.0
40
+     * @return string
41
+     */
42
+    public function getHref();
43 43
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 use OC\DB\QueryBuilder\QueryFunction;
25 25
 
26 26
 class OCIFunctionBuilder extends FunctionBuilder {
27
-	public function md5($input) {
28
-		return new QueryFunction('LOWER(DBMS_OBFUSCATION_TOOLKIT.md5 (input => UTL_RAW.cast_to_raw(' . $this->helper->quoteColumnName($input) .')))');
29
-	}
27
+    public function md5($input) {
28
+        return new QueryFunction('LOWER(DBMS_OBFUSCATION_TOOLKIT.md5 (input => UTL_RAW.cast_to_raw(' . $this->helper->quoteColumnName($input) .')))');
29
+    }
30 30
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
 
26 26
 class OCIFunctionBuilder extends FunctionBuilder {
27 27
 	public function md5($input) {
28
-		return new QueryFunction('LOWER(DBMS_OBFUSCATION_TOOLKIT.md5 (input => UTL_RAW.cast_to_raw(' . $this->helper->quoteColumnName($input) .')))');
28
+		return new QueryFunction('LOWER(DBMS_OBFUSCATION_TOOLKIT.md5 (input => UTL_RAW.cast_to_raw('.$this->helper->quoteColumnName($input).')))');
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
lib/private/DB/AdapterSqlite.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 
43 43
 	public function fixupStatement($statement) {
44 44
 		$statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)', $statement);
45
-		$statement = str_replace( '`', '"', $statement );
46
-		$statement = str_ireplace( 'NOW()', 'datetime(\'now\')', $statement );
45
+		$statement = str_replace('`', '"', $statement);
46
+		$statement = str_ireplace('NOW()', 'datetime(\'now\')', $statement);
47 47
 		$statement = str_ireplace('GREATEST(', 'MAX(', $statement);
48
-		$statement = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement );
48
+		$statement = str_ireplace('UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement);
49 49
 		return $statement;
50 50
 	}
51 51
 
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 		if (empty($compare)) {
65 65
 			$compare = array_keys($input);
66 66
 		}
67
-		$fieldList = '`' . implode('`,`', array_keys($input)) . '`';
67
+		$fieldList = '`'.implode('`,`', array_keys($input)).'`';
68 68
 		$query = "INSERT INTO `$table` ($fieldList) SELECT "
69
-			. str_repeat('?,', count($input)-1).'? '
69
+			. str_repeat('?,', count($input) - 1).'? '
70 70
 			. " WHERE NOT EXISTS (SELECT 1 FROM `$table` WHERE ";
71 71
 
72 72
 		$inserts = array_values($input);
73
-		foreach($compare as $key) {
74
-			$query .= '`' . $key . '`';
73
+		foreach ($compare as $key) {
74
+			$query .= '`'.$key.'`';
75 75
 			if (is_null($input[$key])) {
76 76
 				$query .= ' IS NULL AND ';
77 77
 			} else {
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -31,70 +31,70 @@
 block discarded – undo
31 31
 
32 32
 class AdapterSqlite extends Adapter {
33 33
 
34
-	/**
35
-	 * @param string $tableName
36
-	 */
37
-	public function lockTable($tableName) {
38
-		$this->conn->executeUpdate('BEGIN EXCLUSIVE TRANSACTION');
39
-	}
34
+    /**
35
+     * @param string $tableName
36
+     */
37
+    public function lockTable($tableName) {
38
+        $this->conn->executeUpdate('BEGIN EXCLUSIVE TRANSACTION');
39
+    }
40 40
 
41
-	public function unlockTable() {
42
-		$this->conn->executeUpdate('COMMIT TRANSACTION');
43
-	}
41
+    public function unlockTable() {
42
+        $this->conn->executeUpdate('COMMIT TRANSACTION');
43
+    }
44 44
 
45
-	public function fixupStatement($statement) {
46
-		$statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)', $statement);
47
-		$statement = str_replace( '`', '"', $statement );
48
-		$statement = str_ireplace( 'NOW()', 'datetime(\'now\')', $statement );
49
-		$statement = str_ireplace('GREATEST(', 'MAX(', $statement);
50
-		$statement = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement );
51
-		return $statement;
52
-	}
45
+    public function fixupStatement($statement) {
46
+        $statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)', $statement);
47
+        $statement = str_replace( '`', '"', $statement );
48
+        $statement = str_ireplace( 'NOW()', 'datetime(\'now\')', $statement );
49
+        $statement = str_ireplace('GREATEST(', 'MAX(', $statement);
50
+        $statement = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement );
51
+        return $statement;
52
+    }
53 53
 
54
-	/**
55
-	 * Insert a row if the matching row does not exists. To accomplish proper race condition avoidance
56
-	 * it is needed that there is also a unique constraint on the values. Then this method will
57
-	 * catch the exception and return 0.
58
-	 *
59
-	 * @param string $table The table name (will replace *PREFIX* with the actual prefix)
60
-	 * @param array $input data that should be inserted into the table  (column name => value)
61
-	 * @param array|null $compare List of values that should be checked for "if not exists"
62
-	 *				If this is null or an empty array, all keys of $input will be compared
63
-	 *				Please note: text fields (clob) must not be used in the compare array
64
-	 * @return int number of inserted rows
65
-	 * @throws \Doctrine\DBAL\DBALException
66
-	 * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371
67
-	 */
68
-	public function insertIfNotExist($table, $input, array $compare = null) {
69
-		if (empty($compare)) {
70
-			$compare = array_keys($input);
71
-		}
72
-		$fieldList = '`' . implode('`,`', array_keys($input)) . '`';
73
-		$query = "INSERT INTO `$table` ($fieldList) SELECT "
74
-			. str_repeat('?,', count($input)-1).'? '
75
-			. " WHERE NOT EXISTS (SELECT 1 FROM `$table` WHERE ";
54
+    /**
55
+     * Insert a row if the matching row does not exists. To accomplish proper race condition avoidance
56
+     * it is needed that there is also a unique constraint on the values. Then this method will
57
+     * catch the exception and return 0.
58
+     *
59
+     * @param string $table The table name (will replace *PREFIX* with the actual prefix)
60
+     * @param array $input data that should be inserted into the table  (column name => value)
61
+     * @param array|null $compare List of values that should be checked for "if not exists"
62
+     *				If this is null or an empty array, all keys of $input will be compared
63
+     *				Please note: text fields (clob) must not be used in the compare array
64
+     * @return int number of inserted rows
65
+     * @throws \Doctrine\DBAL\DBALException
66
+     * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371
67
+     */
68
+    public function insertIfNotExist($table, $input, array $compare = null) {
69
+        if (empty($compare)) {
70
+            $compare = array_keys($input);
71
+        }
72
+        $fieldList = '`' . implode('`,`', array_keys($input)) . '`';
73
+        $query = "INSERT INTO `$table` ($fieldList) SELECT "
74
+            . str_repeat('?,', count($input)-1).'? '
75
+            . " WHERE NOT EXISTS (SELECT 1 FROM `$table` WHERE ";
76 76
 
77
-		$inserts = array_values($input);
78
-		foreach($compare as $key) {
79
-			$query .= '`' . $key . '`';
80
-			if (is_null($input[$key])) {
81
-				$query .= ' IS NULL AND ';
82
-			} else {
83
-				$inserts[] = $input[$key];
84
-				$query .= ' = ? AND ';
85
-			}
86
-		}
87
-		$query = substr($query, 0, -5);
88
-		$query .= ')';
77
+        $inserts = array_values($input);
78
+        foreach($compare as $key) {
79
+            $query .= '`' . $key . '`';
80
+            if (is_null($input[$key])) {
81
+                $query .= ' IS NULL AND ';
82
+            } else {
83
+                $inserts[] = $input[$key];
84
+                $query .= ' = ? AND ';
85
+            }
86
+        }
87
+        $query = substr($query, 0, -5);
88
+        $query .= ')';
89 89
 
90
-		try {
91
-			return $this->conn->executeUpdate($query, $inserts);
92
-		} catch (UniqueConstraintViolationException $e) {
93
-			// if this is thrown then a concurrent insert happened between the insert and the sub-select in the insert, that should have avoided it
94
-			// it's fine to ignore this then
95
-			//
96
-			// more discussions about this can be found at https://github.com/nextcloud/server/pull/12315
97
-			return 0;
98
-		}
99
-	}
90
+        try {
91
+            return $this->conn->executeUpdate($query, $inserts);
92
+        } catch (UniqueConstraintViolationException $e) {
93
+            // if this is thrown then a concurrent insert happened between the insert and the sub-select in the insert, that should have avoided it
94
+            // it's fine to ignore this then
95
+            //
96
+            // more discussions about this can be found at https://github.com/nextcloud/server/pull/12315
97
+            return 0;
98
+        }
99
+    }
100 100
 }
Please login to merge, or discard this patch.