Passed
Push — master ( 72fda1...adc4f1 )
by Roeland
18:06 queued 05:03
created
console.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -40,65 +40,65 @@
 block discarded – undo
40 40
 define('OC_CONSOLE', 1);
41 41
 
42 42
 function exceptionHandler($exception) {
43
-	echo "An unhandled exception has been thrown:" . PHP_EOL;
44
-	echo $exception;
45
-	exit(1);
43
+    echo "An unhandled exception has been thrown:" . PHP_EOL;
44
+    echo $exception;
45
+    exit(1);
46 46
 }
47 47
 try {
48
-	require_once __DIR__ . '/lib/base.php';
48
+    require_once __DIR__ . '/lib/base.php';
49 49
 
50
-	// set to run indefinitely if needed
51
-	if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
52
-		@set_time_limit(0);
53
-	}
50
+    // set to run indefinitely if needed
51
+    if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
52
+        @set_time_limit(0);
53
+    }
54 54
 
55
-	if (!OC::$CLI) {
56
-		echo "This script can be run from the command line only" . PHP_EOL;
57
-		exit(1);
58
-	}
55
+    if (!OC::$CLI) {
56
+        echo "This script can be run from the command line only" . PHP_EOL;
57
+        exit(1);
58
+    }
59 59
 
60
-	set_exception_handler('exceptionHandler');
60
+    set_exception_handler('exceptionHandler');
61 61
 
62
-	if (!function_exists('posix_getuid')) {
63
-		echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php" . PHP_EOL;
64
-		exit(1);
65
-	}
66
-	$user = posix_getuid();
67
-	$configUser = fileowner(OC::$configDir . 'config.php');
68
-	if ($user !== $configUser) {
69
-		echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
70
-		echo "Current user id: " . $user . PHP_EOL;
71
-		echo "Owner id of config.php: " . $configUser . PHP_EOL;
72
-		echo "Try adding 'sudo -u #" . $configUser . "' to the beginning of the command (without the single quotes)" . PHP_EOL;
73
-		echo "If running with 'docker exec' try adding the option '-u " . $configUser . "' to the docker command (without the single quotes)" . PHP_EOL;
74
-		exit(1);
75
-	}
62
+    if (!function_exists('posix_getuid')) {
63
+        echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php" . PHP_EOL;
64
+        exit(1);
65
+    }
66
+    $user = posix_getuid();
67
+    $configUser = fileowner(OC::$configDir . 'config.php');
68
+    if ($user !== $configUser) {
69
+        echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
70
+        echo "Current user id: " . $user . PHP_EOL;
71
+        echo "Owner id of config.php: " . $configUser . PHP_EOL;
72
+        echo "Try adding 'sudo -u #" . $configUser . "' to the beginning of the command (without the single quotes)" . PHP_EOL;
73
+        echo "If running with 'docker exec' try adding the option '-u " . $configUser . "' to the docker command (without the single quotes)" . PHP_EOL;
74
+        exit(1);
75
+    }
76 76
 
77
-	$oldWorkingDir = getcwd();
78
-	if ($oldWorkingDir === false) {
79
-		echo "This script can be run from the Nextcloud root directory only." . PHP_EOL;
80
-		echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL;
81
-	} elseif ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) {
82
-		echo "This script can be run from the Nextcloud root directory only." . PHP_EOL;
83
-		echo "Can't change to Nextcloud root directory." . PHP_EOL;
84
-		exit(1);
85
-	}
77
+    $oldWorkingDir = getcwd();
78
+    if ($oldWorkingDir === false) {
79
+        echo "This script can be run from the Nextcloud root directory only." . PHP_EOL;
80
+        echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL;
81
+    } elseif ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) {
82
+        echo "This script can be run from the Nextcloud root directory only." . PHP_EOL;
83
+        echo "Can't change to Nextcloud root directory." . PHP_EOL;
84
+        exit(1);
85
+    }
86 86
 
87
-	if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) {
88
-		echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php" . PHP_EOL;
89
-	}
87
+    if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) {
88
+        echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php" . PHP_EOL;
89
+    }
90 90
 
91
-	$application = new Application(
92
-		\OC::$server->getConfig(),
93
-		\OC::$server->getEventDispatcher(),
94
-		\OC::$server->getRequest(),
95
-		\OC::$server->getLogger(),
96
-		\OC::$server->query(\OC\MemoryInfo::class)
97
-	);
98
-	$application->loadCommands(new ArgvInput(), new ConsoleOutput());
99
-	$application->run();
91
+    $application = new Application(
92
+        \OC::$server->getConfig(),
93
+        \OC::$server->getEventDispatcher(),
94
+        \OC::$server->getRequest(),
95
+        \OC::$server->getLogger(),
96
+        \OC::$server->query(\OC\MemoryInfo::class)
97
+    );
98
+    $application->loadCommands(new ArgvInput(), new ConsoleOutput());
99
+    $application->run();
100 100
 } catch (Exception $ex) {
101
-	exceptionHandler($ex);
101
+    exceptionHandler($ex);
102 102
 } catch (Error $ex) {
103
-	exceptionHandler($ex);
103
+    exceptionHandler($ex);
104 104
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  *
32 32
  */
33 33
 
34
-require_once __DIR__ . '/lib/versioncheck.php';
34
+require_once __DIR__.'/lib/versioncheck.php';
35 35
 
36 36
 use OC\Console\Application;
37 37
 use Symfony\Component\Console\Input\ArgvInput;
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 define('OC_CONSOLE', 1);
41 41
 
42 42
 function exceptionHandler($exception) {
43
-	echo "An unhandled exception has been thrown:" . PHP_EOL;
43
+	echo "An unhandled exception has been thrown:".PHP_EOL;
44 44
 	echo $exception;
45 45
 	exit(1);
46 46
 }
47 47
 try {
48
-	require_once __DIR__ . '/lib/base.php';
48
+	require_once __DIR__.'/lib/base.php';
49 49
 
50 50
 	// set to run indefinitely if needed
51 51
 	if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
@@ -53,39 +53,39 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	if (!OC::$CLI) {
56
-		echo "This script can be run from the command line only" . PHP_EOL;
56
+		echo "This script can be run from the command line only".PHP_EOL;
57 57
 		exit(1);
58 58
 	}
59 59
 
60 60
 	set_exception_handler('exceptionHandler');
61 61
 
62 62
 	if (!function_exists('posix_getuid')) {
63
-		echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php" . PHP_EOL;
63
+		echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php".PHP_EOL;
64 64
 		exit(1);
65 65
 	}
66 66
 	$user = posix_getuid();
67
-	$configUser = fileowner(OC::$configDir . 'config.php');
67
+	$configUser = fileowner(OC::$configDir.'config.php');
68 68
 	if ($user !== $configUser) {
69
-		echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
70
-		echo "Current user id: " . $user . PHP_EOL;
71
-		echo "Owner id of config.php: " . $configUser . PHP_EOL;
72
-		echo "Try adding 'sudo -u #" . $configUser . "' to the beginning of the command (without the single quotes)" . PHP_EOL;
73
-		echo "If running with 'docker exec' try adding the option '-u " . $configUser . "' to the docker command (without the single quotes)" . PHP_EOL;
69
+		echo "Console has to be executed with the user that owns the file config/config.php".PHP_EOL;
70
+		echo "Current user id: ".$user.PHP_EOL;
71
+		echo "Owner id of config.php: ".$configUser.PHP_EOL;
72
+		echo "Try adding 'sudo -u #".$configUser."' to the beginning of the command (without the single quotes)".PHP_EOL;
73
+		echo "If running with 'docker exec' try adding the option '-u ".$configUser."' to the docker command (without the single quotes)".PHP_EOL;
74 74
 		exit(1);
75 75
 	}
76 76
 
77 77
 	$oldWorkingDir = getcwd();
78 78
 	if ($oldWorkingDir === false) {
79
-		echo "This script can be run from the Nextcloud root directory only." . PHP_EOL;
80
-		echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL;
79
+		echo "This script can be run from the Nextcloud root directory only.".PHP_EOL;
80
+		echo "Can't determine current working dir - the script will continue to work but be aware of the above fact.".PHP_EOL;
81 81
 	} elseif ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) {
82
-		echo "This script can be run from the Nextcloud root directory only." . PHP_EOL;
83
-		echo "Can't change to Nextcloud root directory." . PHP_EOL;
82
+		echo "This script can be run from the Nextcloud root directory only.".PHP_EOL;
83
+		echo "Can't change to Nextcloud root directory.".PHP_EOL;
84 84
 		exit(1);
85 85
 	}
86 86
 
87 87
 	if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) {
88
-		echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php" . PHP_EOL;
88
+		echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php".PHP_EOL;
89 89
 	}
90 90
 
91 91
 	$application = new Application(
Please login to merge, or discard this patch.
cron.php 2 patches
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -39,125 +39,125 @@
 block discarded – undo
39 39
 require_once __DIR__ . '/lib/versioncheck.php';
40 40
 
41 41
 try {
42
-	require_once __DIR__ . '/lib/base.php';
43
-
44
-	if (\OCP\Util::needUpgrade()) {
45
-		\OC::$server->getLogger()->debug('Update required, skipping cron', ['app' => 'cron']);
46
-		exit;
47
-	}
48
-	if ((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
49
-		\OC::$server->getLogger()->debug('We are in maintenance mode, skipping cron', ['app' => 'cron']);
50
-		exit;
51
-	}
52
-
53
-	// load all apps to get all api routes properly setup
54
-	OC_App::loadApps();
55
-
56
-	\OC::$server->getSession()->close();
57
-
58
-	// initialize a dummy memory session
59
-	$session = new \OC\Session\Memory('');
60
-	$cryptoWrapper = \OC::$server->getSessionCryptoWrapper();
61
-	$session = $cryptoWrapper->wrapSession($session);
62
-	\OC::$server->setSession($session);
63
-
64
-	$logger = \OC::$server->getLogger();
65
-	$config = \OC::$server->getConfig();
66
-
67
-	// Don't do anything if Nextcloud has not been installed
68
-	if (!$config->getSystemValue('installed', false)) {
69
-		exit(0);
70
-	}
71
-
72
-	\OC::$server->getTempManager()->cleanOld();
73
-
74
-	// Exit if background jobs are disabled!
75
-	$appMode = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax');
76
-	if ($appMode === 'none') {
77
-		if (OC::$CLI) {
78
-			echo 'Background Jobs are disabled!' . PHP_EOL;
79
-		} else {
80
-			OC_JSON::error(['data' => ['message' => 'Background jobs disabled!']]);
81
-		}
82
-		exit(1);
83
-	}
84
-
85
-	if (OC::$CLI) {
86
-		// set to run indefinitely if needed
87
-		if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
88
-			@set_time_limit(0);
89
-		}
90
-
91
-		// the cron job must be executed with the right user
92
-		if (!function_exists('posix_getuid')) {
93
-			echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php" . PHP_EOL;
94
-			exit(1);
95
-		}
96
-
97
-		$user = posix_getuid();
98
-		$configUser = fileowner(OC::$configDir . 'config.php');
99
-		if ($user !== $configUser) {
100
-			echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
101
-			echo "Current user id: " . $user . PHP_EOL;
102
-			echo "Owner id of config.php: " . $configUser . PHP_EOL;
103
-			exit(1);
104
-		}
105
-
106
-
107
-		// We call Nextcloud from the CLI (aka cron)
108
-		if ($appMode !== 'cron') {
109
-			$config->setAppValue('core', 'backgroundjobs_mode', 'cron');
110
-		}
111
-
112
-		// Work
113
-		$jobList = \OC::$server->getJobList();
114
-
115
-		// We only ask for jobs for 14 minutes, because after 5 minutes the next
116
-		// system cron task should spawn and we want to have at most three
117
-		// cron jobs running in parallel.
118
-		$endTime = time() + 14 * 60;
119
-
120
-		$executedJobs = [];
121
-		while ($job = $jobList->getNext()) {
122
-			if (isset($executedJobs[$job->getId()])) {
123
-				$jobList->unlockJob($job);
124
-				break;
125
-			}
126
-
127
-			$job->execute($jobList, $logger);
128
-			// clean up after unclean jobs
129
-			\OC_Util::tearDownFS();
130
-
131
-			$jobList->setLastJob($job);
132
-			$executedJobs[$job->getId()] = true;
133
-			unset($job);
134
-
135
-			if (time() > $endTime) {
136
-				break;
137
-			}
138
-		}
139
-	} else {
140
-		// We call cron.php from some website
141
-		if ($appMode === 'cron') {
142
-			// Cron is cron :-P
143
-			OC_JSON::error(['data' => ['message' => 'Backgroundjobs are using system cron!']]);
144
-		} else {
145
-			// Work and success :-)
146
-			$jobList = \OC::$server->getJobList();
147
-			$job = $jobList->getNext();
148
-			if ($job != null) {
149
-				$job->execute($jobList, $logger);
150
-				$jobList->setLastJob($job);
151
-			}
152
-			OC_JSON::success();
153
-		}
154
-	}
155
-
156
-	// Log the successful cron execution
157
-	$config->setAppValue('core', 'lastcron', time());
158
-	exit();
42
+    require_once __DIR__ . '/lib/base.php';
43
+
44
+    if (\OCP\Util::needUpgrade()) {
45
+        \OC::$server->getLogger()->debug('Update required, skipping cron', ['app' => 'cron']);
46
+        exit;
47
+    }
48
+    if ((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
49
+        \OC::$server->getLogger()->debug('We are in maintenance mode, skipping cron', ['app' => 'cron']);
50
+        exit;
51
+    }
52
+
53
+    // load all apps to get all api routes properly setup
54
+    OC_App::loadApps();
55
+
56
+    \OC::$server->getSession()->close();
57
+
58
+    // initialize a dummy memory session
59
+    $session = new \OC\Session\Memory('');
60
+    $cryptoWrapper = \OC::$server->getSessionCryptoWrapper();
61
+    $session = $cryptoWrapper->wrapSession($session);
62
+    \OC::$server->setSession($session);
63
+
64
+    $logger = \OC::$server->getLogger();
65
+    $config = \OC::$server->getConfig();
66
+
67
+    // Don't do anything if Nextcloud has not been installed
68
+    if (!$config->getSystemValue('installed', false)) {
69
+        exit(0);
70
+    }
71
+
72
+    \OC::$server->getTempManager()->cleanOld();
73
+
74
+    // Exit if background jobs are disabled!
75
+    $appMode = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax');
76
+    if ($appMode === 'none') {
77
+        if (OC::$CLI) {
78
+            echo 'Background Jobs are disabled!' . PHP_EOL;
79
+        } else {
80
+            OC_JSON::error(['data' => ['message' => 'Background jobs disabled!']]);
81
+        }
82
+        exit(1);
83
+    }
84
+
85
+    if (OC::$CLI) {
86
+        // set to run indefinitely if needed
87
+        if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
88
+            @set_time_limit(0);
89
+        }
90
+
91
+        // the cron job must be executed with the right user
92
+        if (!function_exists('posix_getuid')) {
93
+            echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php" . PHP_EOL;
94
+            exit(1);
95
+        }
96
+
97
+        $user = posix_getuid();
98
+        $configUser = fileowner(OC::$configDir . 'config.php');
99
+        if ($user !== $configUser) {
100
+            echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
101
+            echo "Current user id: " . $user . PHP_EOL;
102
+            echo "Owner id of config.php: " . $configUser . PHP_EOL;
103
+            exit(1);
104
+        }
105
+
106
+
107
+        // We call Nextcloud from the CLI (aka cron)
108
+        if ($appMode !== 'cron') {
109
+            $config->setAppValue('core', 'backgroundjobs_mode', 'cron');
110
+        }
111
+
112
+        // Work
113
+        $jobList = \OC::$server->getJobList();
114
+
115
+        // We only ask for jobs for 14 minutes, because after 5 minutes the next
116
+        // system cron task should spawn and we want to have at most three
117
+        // cron jobs running in parallel.
118
+        $endTime = time() + 14 * 60;
119
+
120
+        $executedJobs = [];
121
+        while ($job = $jobList->getNext()) {
122
+            if (isset($executedJobs[$job->getId()])) {
123
+                $jobList->unlockJob($job);
124
+                break;
125
+            }
126
+
127
+            $job->execute($jobList, $logger);
128
+            // clean up after unclean jobs
129
+            \OC_Util::tearDownFS();
130
+
131
+            $jobList->setLastJob($job);
132
+            $executedJobs[$job->getId()] = true;
133
+            unset($job);
134
+
135
+            if (time() > $endTime) {
136
+                break;
137
+            }
138
+        }
139
+    } else {
140
+        // We call cron.php from some website
141
+        if ($appMode === 'cron') {
142
+            // Cron is cron :-P
143
+            OC_JSON::error(['data' => ['message' => 'Backgroundjobs are using system cron!']]);
144
+        } else {
145
+            // Work and success :-)
146
+            $jobList = \OC::$server->getJobList();
147
+            $job = $jobList->getNext();
148
+            if ($job != null) {
149
+                $job->execute($jobList, $logger);
150
+                $jobList->setLastJob($job);
151
+            }
152
+            OC_JSON::success();
153
+        }
154
+    }
155
+
156
+    // Log the successful cron execution
157
+    $config->setAppValue('core', 'lastcron', time());
158
+    exit();
159 159
 } catch (Exception $ex) {
160
-	\OC::$server->getLogger()->logException($ex, ['app' => 'cron']);
160
+    \OC::$server->getLogger()->logException($ex, ['app' => 'cron']);
161 161
 } catch (Error $ex) {
162
-	\OC::$server->getLogger()->logException($ex, ['app' => 'cron']);
162
+    \OC::$server->getLogger()->logException($ex, ['app' => 'cron']);
163 163
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
  *
37 37
  */
38 38
 
39
-require_once __DIR__ . '/lib/versioncheck.php';
39
+require_once __DIR__.'/lib/versioncheck.php';
40 40
 
41 41
 try {
42
-	require_once __DIR__ . '/lib/base.php';
42
+	require_once __DIR__.'/lib/base.php';
43 43
 
44 44
 	if (\OCP\Util::needUpgrade()) {
45 45
 		\OC::$server->getLogger()->debug('Update required, skipping cron', ['app' => 'cron']);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	$appMode = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax');
76 76
 	if ($appMode === 'none') {
77 77
 		if (OC::$CLI) {
78
-			echo 'Background Jobs are disabled!' . PHP_EOL;
78
+			echo 'Background Jobs are disabled!'.PHP_EOL;
79 79
 		} else {
80 80
 			OC_JSON::error(['data' => ['message' => 'Background jobs disabled!']]);
81 81
 		}
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
 
91 91
 		// the cron job must be executed with the right user
92 92
 		if (!function_exists('posix_getuid')) {
93
-			echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php" . PHP_EOL;
93
+			echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php".PHP_EOL;
94 94
 			exit(1);
95 95
 		}
96 96
 
97 97
 		$user = posix_getuid();
98
-		$configUser = fileowner(OC::$configDir . 'config.php');
98
+		$configUser = fileowner(OC::$configDir.'config.php');
99 99
 		if ($user !== $configUser) {
100
-			echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
101
-			echo "Current user id: " . $user . PHP_EOL;
102
-			echo "Owner id of config.php: " . $configUser . PHP_EOL;
100
+			echo "Console has to be executed with the user that owns the file config/config.php".PHP_EOL;
101
+			echo "Current user id: ".$user.PHP_EOL;
102
+			echo "Owner id of config.php: ".$configUser.PHP_EOL;
103 103
 			exit(1);
104 104
 		}
105 105
 
Please login to merge, or discard this patch.
config/config.sample.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
  */
42 42
 'instanceid' => '',
43 43
 
44
- /**
45
-  * The salt used to hash all passwords, auto-generated by the Nextcloud
46
-  * installer. (There are also per-user salts.) If you lose this salt you lose
47
-  * all your passwords. This example is for documentation only, and you should
48
-  * never use it.
49
-  *
50
-  * @deprecated This salt is deprecated and only used for legacy-compatibility,
51
-  * developers should *NOT* use this value for anything nowadays.
52
-  *
53
-  * 'passwordsalt' => 'd3c944a9af095aa08f',
54
- */
44
+    /**
45
+     * The salt used to hash all passwords, auto-generated by the Nextcloud
46
+     * installer. (There are also per-user salts.) If you lose this salt you lose
47
+     * all your passwords. This example is for documentation only, and you should
48
+     * never use it.
49
+     *
50
+     * @deprecated This salt is deprecated and only used for legacy-compatibility,
51
+     * developers should *NOT* use this value for anything nowadays.
52
+     *
53
+     * 'passwordsalt' => 'd3c944a9af095aa08f',
54
+     */
55 55
 'passwordsalt' => '',
56 56
 
57 57
 /**
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
  *   Using TLS certificates where commonName=<IP address> is deprecated
70 70
  */
71 71
 'trusted_domains' =>
72
-   [
72
+    [
73 73
     'demo.example.org',
74 74
     'otherdomain.example.org',
75 75
     '10.111.112.113',
76 76
     '[2001:db8::1]'
77
-  ],
77
+    ],
78 78
 
79 79
 
80 80
 /**
@@ -740,10 +740,10 @@  discard block
 block discarded – undo
740 740
  *  - www.edri.org
741 741
  */
742 742
 'connectivity_check_domains' => [
743
-	'www.nextcloud.com',
744
-	'www.startpage.com',
745
-	'www.eff.org',
746
-	'www.edri.org'
743
+    'www.nextcloud.com',
744
+    'www.startpage.com',
745
+    'www.eff.org',
746
+    'www.edri.org'
747 747
 ],
748 748
 
749 749
 /**
@@ -859,9 +859,9 @@  discard block
 block discarded – undo
859 859
  * Defaults to an empty array.
860 860
  */
861 861
 'log.condition' => [
862
-	'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9',
863
-	'users' => ['sample-user'],
864
-	'apps' => ['files'],
862
+    'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9',
863
+    'users' => ['sample-user'],
864
+    'apps' => ['files'],
865 865
 ],
866 866
 
867 867
 /**
@@ -915,18 +915,18 @@  discard block
 block discarded – undo
915 915
  *  - iOS client app id: ``1125420102``
916 916
  */
917 917
 'customclient_desktop' =>
918
-	'https://nextcloud.com/install/#install-clients',
918
+    'https://nextcloud.com/install/#install-clients',
919 919
 'customclient_android' =>
920
-	'https://play.google.com/store/apps/details?id=com.nextcloud.client',
920
+    'https://play.google.com/store/apps/details?id=com.nextcloud.client',
921 921
 'customclient_ios' =>
922
-	'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8',
922
+    'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8',
923 923
 'customclient_ios_appid' =>
924
-		'1125420102',
924
+        '1125420102',
925 925
 /**
926
- * Apps
927
- *
928
- * Options for the Apps folder, Apps store, and App code checker.
929
- */
926
+         * Apps
927
+         *
928
+         * Options for the Apps folder, Apps store, and App code checker.
929
+         */
930 930
 
931 931
 /**
932 932
  * When enabled, admins may install apps from the Nextcloud app store.
@@ -952,11 +952,11 @@  discard block
 block discarded – undo
952 952
  * indicates if a Web server can write files to that folder.
953 953
  */
954 954
 'apps_paths' => [
955
-	[
956
-		'path'=> '/var/www/nextcloud/apps',
957
-		'url' => '/apps',
958
-		'writable' => true,
959
-	],
955
+    [
956
+        'path'=> '/var/www/nextcloud/apps',
957
+        'url' => '/apps',
958
+        'writable' => true,
959
+    ],
960 960
 ],
961 961
 
962 962
 /**
@@ -1021,8 +1021,8 @@  discard block
 block discarded – undo
1021 1021
  * Defaults to ``''`` (empty string)
1022 1022
  */
1023 1023
 'preview_office_cl_parameters' =>
1024
-	' --headless --nologo --nofirststartwizard --invisible --norestore '.
1025
-	'--convert-to png --outdir ',
1024
+    ' --headless --nologo --nofirststartwizard --invisible --norestore '.
1025
+    '--convert-to png --outdir ',
1026 1026
 
1027 1027
 /**
1028 1028
  * Only register providers that have been explicitly enabled
@@ -1059,17 +1059,17 @@  discard block
 block discarded – undo
1059 1059
  *  - OC\Preview\Krita
1060 1060
  */
1061 1061
 'enabledPreviewProviders' => [
1062
-	'OC\Preview\PNG',
1063
-	'OC\Preview\JPEG',
1064
-	'OC\Preview\GIF',
1065
-	'OC\Preview\HEIC',
1066
-	'OC\Preview\BMP',
1067
-	'OC\Preview\XBitmap',
1068
-	'OC\Preview\MP3',
1069
-	'OC\Preview\TXT',
1070
-	'OC\Preview\MarkDown',
1071
-	'OC\Preview\OpenDocument',
1072
-	'OC\Preview\Krita',
1062
+    'OC\Preview\PNG',
1063
+    'OC\Preview\JPEG',
1064
+    'OC\Preview\GIF',
1065
+    'OC\Preview\HEIC',
1066
+    'OC\Preview\BMP',
1067
+    'OC\Preview\XBitmap',
1068
+    'OC\Preview\MP3',
1069
+    'OC\Preview\TXT',
1070
+    'OC\Preview\MarkDown',
1071
+    'OC\Preview\OpenDocument',
1072
+    'OC\Preview\Krita',
1073 1073
 ],
1074 1074
 
1075 1075
 /**
@@ -1145,11 +1145,11 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
 /**
1147 1147
  * Extra SSL options to be used for configuration.
1148
-  *
1148
+ *
1149 1149
  * Defaults to an empty array.
1150 1150
  */
1151 1151
 'openssl' => [
1152
-	'config' => '/absolute/location/of/openssl.cnf',
1152
+    'config' => '/absolute/location/of/openssl.cnf',
1153 1153
 ],
1154 1154
 
1155 1155
 /**
@@ -1197,11 +1197,11 @@  discard block
 block discarded – undo
1197 1197
  * for more information.
1198 1198
  */
1199 1199
 'redis' => [
1200
-	'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock'
1201
-	'port' => 6379,
1202
-	'timeout' => 0.0,
1203
-	'password' => '', // Optional, if not defined no password will be used.
1204
-	'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index.
1200
+    'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock'
1201
+    'port' => 6379,
1202
+    'timeout' => 0.0,
1203
+    'password' => '', // Optional, if not defined no password will be used.
1204
+    'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index.
1205 1205
 ],
1206 1206
 
1207 1207
 /**
@@ -1230,14 +1230,14 @@  discard block
 block discarded – undo
1230 1230
  * https://github.com/phpredis/phpredis/commit/c5994f2a42b8a348af92d3acb4edff1328ad8ce1
1231 1231
  */
1232 1232
 'redis.cluster' => [
1233
-	'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required
1234
-		'localhost:7000',
1235
-		'localhost:7001',
1236
-	],
1237
-	'timeout' => 0.0,
1238
-	'read_timeout' => 0.0,
1239
-	'failover_mode' => \RedisCluster::FAILOVER_ERROR,
1240
-	'password' => '', // Optional, if not defined no password will be used.
1233
+    'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required
1234
+        'localhost:7000',
1235
+        'localhost:7001',
1236
+    ],
1237
+    'timeout' => 0.0,
1238
+    'read_timeout' => 0.0,
1239
+    'failover_mode' => \RedisCluster::FAILOVER_ERROR,
1240
+    'password' => '', // Optional, if not defined no password will be used.
1241 1241
 ],
1242 1242
 
1243 1243
 
@@ -1245,35 +1245,35 @@  discard block
 block discarded – undo
1245 1245
  * Server details for one or more memcached servers to use for memory caching.
1246 1246
  */
1247 1247
 'memcached_servers' => [
1248
-	// hostname, port and optional weight. Also see:
1249
-	// https://www.php.net/manual/en/memcached.addservers.php
1250
-	// https://www.php.net/manual/en/memcached.addserver.php
1251
-	['localhost', 11211],
1252
-	//array('other.host.local', 11211),
1248
+    // hostname, port and optional weight. Also see:
1249
+    // https://www.php.net/manual/en/memcached.addservers.php
1250
+    // https://www.php.net/manual/en/memcached.addserver.php
1251
+    ['localhost', 11211],
1252
+    //array('other.host.local', 11211),
1253 1253
 ],
1254 1254
 
1255 1255
 /**
1256 1256
  * Connection options for memcached
1257 1257
  */
1258 1258
 'memcached_options' => [
1259
-	// Set timeouts to 50ms
1260
-	\Memcached::OPT_CONNECT_TIMEOUT => 50,
1261
-	\Memcached::OPT_RETRY_TIMEOUT =>   50,
1262
-	\Memcached::OPT_SEND_TIMEOUT =>    50,
1263
-	\Memcached::OPT_RECV_TIMEOUT =>    50,
1264
-	\Memcached::OPT_POLL_TIMEOUT =>    50,
1259
+    // Set timeouts to 50ms
1260
+    \Memcached::OPT_CONNECT_TIMEOUT => 50,
1261
+    \Memcached::OPT_RETRY_TIMEOUT =>   50,
1262
+    \Memcached::OPT_SEND_TIMEOUT =>    50,
1263
+    \Memcached::OPT_RECV_TIMEOUT =>    50,
1264
+    \Memcached::OPT_POLL_TIMEOUT =>    50,
1265 1265
 
1266
-	// Enable compression
1267
-	\Memcached::OPT_COMPRESSION =>          true,
1266
+    // Enable compression
1267
+    \Memcached::OPT_COMPRESSION =>          true,
1268 1268
 
1269
-	// Turn on consistent hashing
1270
-	\Memcached::OPT_LIBKETAMA_COMPATIBLE => true,
1269
+    // Turn on consistent hashing
1270
+    \Memcached::OPT_LIBKETAMA_COMPATIBLE => true,
1271 1271
 
1272
-	// Enable Binary Protocol
1273
-	\Memcached::OPT_BINARY_PROTOCOL =>      true,
1272
+    // Enable Binary Protocol
1273
+    \Memcached::OPT_BINARY_PROTOCOL =>      true,
1274 1274
 
1275
-	// Binary serializer vill be enabled if the igbinary PECL module is available
1276
-	//\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY,
1275
+    // Binary serializer vill be enabled if the igbinary PECL module is available
1276
+    //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY,
1277 1277
 ],
1278 1278
 
1279 1279
 
@@ -1319,61 +1319,61 @@  discard block
 block discarded – undo
1319 1319
  * One way to test is applying for a trystack account at http://trystack.org/
1320 1320
  */
1321 1321
 'objectstore' => [
1322
-	'class' => 'OC\\Files\\ObjectStore\\Swift',
1323
-	'arguments' => [
1324
-		// trystack will use your facebook id as the user name
1325
-		'username' => 'facebook100000123456789',
1326
-		// in the trystack dashboard go to user -> settings -> API Password to
1327
-		// generate a password
1328
-		'password' => 'Secr3tPaSSWoRdt7',
1329
-		// must already exist in the objectstore, name can be different
1330
-		'container' => 'nextcloud',
1331
-		// prefix to prepend to the fileid, default is 'oid:urn:'
1332
-		'objectPrefix' => 'oid:urn:',
1333
-		// create the container if it does not exist. default is false
1334
-		'autocreate' => true,
1335
-		// required, dev-/trystack defaults to 'RegionOne'
1336
-		'region' => 'RegionOne',
1337
-		// The Identity / Keystone endpoint
1338
-		'url' => 'http://8.21.28.222:5000/v2.0',
1339
-		// required on dev-/trystack
1340
-		'tenantName' => 'facebook100000123456789',
1341
-		// dev-/trystack uses swift by default, the lib defaults to 'cloudFiles'
1342
-		// if omitted
1343
-		'serviceName' => 'swift',
1344
-		// The Interface / url Type, optional
1345
-		'urlType' => 'internal'
1346
-	],
1322
+    'class' => 'OC\\Files\\ObjectStore\\Swift',
1323
+    'arguments' => [
1324
+        // trystack will use your facebook id as the user name
1325
+        'username' => 'facebook100000123456789',
1326
+        // in the trystack dashboard go to user -> settings -> API Password to
1327
+        // generate a password
1328
+        'password' => 'Secr3tPaSSWoRdt7',
1329
+        // must already exist in the objectstore, name can be different
1330
+        'container' => 'nextcloud',
1331
+        // prefix to prepend to the fileid, default is 'oid:urn:'
1332
+        'objectPrefix' => 'oid:urn:',
1333
+        // create the container if it does not exist. default is false
1334
+        'autocreate' => true,
1335
+        // required, dev-/trystack defaults to 'RegionOne'
1336
+        'region' => 'RegionOne',
1337
+        // The Identity / Keystone endpoint
1338
+        'url' => 'http://8.21.28.222:5000/v2.0',
1339
+        // required on dev-/trystack
1340
+        'tenantName' => 'facebook100000123456789',
1341
+        // dev-/trystack uses swift by default, the lib defaults to 'cloudFiles'
1342
+        // if omitted
1343
+        'serviceName' => 'swift',
1344
+        // The Interface / url Type, optional
1345
+        'urlType' => 'internal'
1346
+    ],
1347 1347
 ],
1348 1348
 
1349 1349
 /**
1350 1350
  * To use swift V3
1351 1351
  */
1352 1352
 'objectstore' => [
1353
-	'class' => 'OC\\Files\\ObjectStore\\Swift',
1354
-	'arguments' => [
1355
-		'autocreate' => true,
1356
-		'user' => [
1357
-			'name' => 'swift',
1358
-			'password' => 'swift',
1359
-			'domain' => [
1360
-				'name' => 'default',
1361
-			],
1362
-		],
1363
-		'scope' => [
1364
-			'project' => [
1365
-				'name' => 'service',
1366
-				'domain' => [
1367
-					'name' => 'default',
1368
-				],
1369
-			],
1370
-		],
1371
-		'tenantName' => 'service',
1372
-		'serviceName' => 'swift',
1373
-		'region' => 'regionOne',
1374
-		'url' => 'http://yourswifthost:5000/v3',
1375
-		'bucket' => 'nextcloud',
1376
-	],
1353
+    'class' => 'OC\\Files\\ObjectStore\\Swift',
1354
+    'arguments' => [
1355
+        'autocreate' => true,
1356
+        'user' => [
1357
+            'name' => 'swift',
1358
+            'password' => 'swift',
1359
+            'domain' => [
1360
+                'name' => 'default',
1361
+            ],
1362
+        ],
1363
+        'scope' => [
1364
+            'project' => [
1365
+                'name' => 'service',
1366
+                'domain' => [
1367
+                    'name' => 'default',
1368
+                ],
1369
+            ],
1370
+        ],
1371
+        'tenantName' => 'service',
1372
+        'serviceName' => 'swift',
1373
+        'region' => 'regionOne',
1374
+        'url' => 'http://yourswifthost:5000/v3',
1375
+        'bucket' => 'nextcloud',
1376
+    ],
1377 1377
 ],
1378 1378
 
1379 1379
 /**
@@ -1454,8 +1454,8 @@  discard block
 block discarded – undo
1454 1454
  * encryption in MySQL or specify a custom wait timeout on a cheap hoster.
1455 1455
  */
1456 1456
 'dbdriveroptions' => [
1457
-	PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem',
1458
-	PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800'
1457
+    PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem',
1458
+    PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800'
1459 1459
 ],
1460 1460
 
1461 1461
 /**
@@ -1512,10 +1512,10 @@  discard block
 block discarded – undo
1512 1512
  *  - pgsql (PostgreSQL)
1513 1513
  */
1514 1514
 'supportedDatabases' => [
1515
-	'sqlite',
1516
-	'mysql',
1517
-	'pgsql',
1518
-	'oci',
1515
+    'sqlite',
1516
+    'mysql',
1517
+    'pgsql',
1518
+    'oci',
1519 1519
 ],
1520 1520
 
1521 1521
 /**
@@ -1842,8 +1842,8 @@  discard block
 block discarded – undo
1842 1842
  * WARNING: only use this if you know what you are doing
1843 1843
  */
1844 1844
 'csrf.optout' => [
1845
-	'/^WebDAVFS/', // OS X Finder
1846
-	'/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive
1845
+    '/^WebDAVFS/', // OS X Finder
1846
+    '/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive
1847 1847
 ],
1848 1848
 
1849 1849
 /**
Please login to merge, or discard this patch.
lib/public/DB/QueryBuilder/IQueryBuilder.php 1 patch
Indentation   +867 added lines, -867 removed lines patch added patch discarded remove patch
@@ -35,871 +35,871 @@
 block discarded – undo
35 35
  */
36 36
 interface IQueryBuilder {
37 37
 
38
-	/**
39
-	 * @since 9.0.0
40
-	 */
41
-	public const PARAM_NULL = \PDO::PARAM_NULL;
42
-	/**
43
-	 * @since 9.0.0
44
-	 */
45
-	public const PARAM_BOOL = \PDO::PARAM_BOOL;
46
-	/**
47
-	 * @since 9.0.0
48
-	 */
49
-	public const PARAM_INT = \PDO::PARAM_INT;
50
-	/**
51
-	 * @since 9.0.0
52
-	 */
53
-	public const PARAM_STR = \PDO::PARAM_STR;
54
-	/**
55
-	 * @since 9.0.0
56
-	 */
57
-	public const PARAM_LOB = \PDO::PARAM_LOB;
58
-	/**
59
-	 * @since 9.0.0
60
-	 */
61
-	public const PARAM_DATE = 'datetime';
62
-
63
-	/**
64
-	 * @since 9.0.0
65
-	 */
66
-	public const PARAM_INT_ARRAY = Connection::PARAM_INT_ARRAY;
67
-	/**
68
-	 * @since 9.0.0
69
-	 */
70
-	public const PARAM_STR_ARRAY = Connection::PARAM_STR_ARRAY;
71
-
72
-
73
-	/**
74
-	 * Enable/disable automatic prefixing of table names with the oc_ prefix
75
-	 *
76
-	 * @param bool $enabled If set to true table names will be prefixed with the
77
-	 * owncloud database prefix automatically.
78
-	 * @since 8.2.0
79
-	 */
80
-	public function automaticTablePrefix($enabled);
81
-
82
-	/**
83
-	 * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
84
-	 * This producer method is intended for convenient inline usage. Example:
85
-	 *
86
-	 * <code>
87
-	 *     $qb = $conn->getQueryBuilder()
88
-	 *         ->select('u')
89
-	 *         ->from('users', 'u')
90
-	 *         ->where($qb->expr()->eq('u.id', 1));
91
-	 * </code>
92
-	 *
93
-	 * For more complex expression construction, consider storing the expression
94
-	 * builder object in a local variable.
95
-	 *
96
-	 * @return \OCP\DB\QueryBuilder\IExpressionBuilder
97
-	 * @since 8.2.0
98
-	 */
99
-	public function expr();
100
-
101
-	/**
102
-	 * Gets an FunctionBuilder used for object-oriented construction of query functions.
103
-	 * This producer method is intended for convenient inline usage. Example:
104
-	 *
105
-	 * <code>
106
-	 *     $qb = $conn->getQueryBuilder()
107
-	 *         ->select('u')
108
-	 *         ->from('users', 'u')
109
-	 *         ->where($qb->fun()->md5('u.id'));
110
-	 * </code>
111
-	 *
112
-	 * For more complex function construction, consider storing the function
113
-	 * builder object in a local variable.
114
-	 *
115
-	 * @return \OCP\DB\QueryBuilder\IFunctionBuilder
116
-	 * @since 12.0.0
117
-	 */
118
-	public function func();
119
-
120
-	/**
121
-	 * Gets the type of the currently built query.
122
-	 *
123
-	 * @return integer
124
-	 * @since 8.2.0
125
-	 */
126
-	public function getType();
127
-
128
-	/**
129
-	 * Gets the associated DBAL Connection for this query builder.
130
-	 *
131
-	 * @return \OCP\IDBConnection
132
-	 * @since 8.2.0
133
-	 */
134
-	public function getConnection();
135
-
136
-	/**
137
-	 * Gets the state of this query builder instance.
138
-	 *
139
-	 * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
140
-	 * @since 8.2.0
141
-	 */
142
-	public function getState();
143
-
144
-	/**
145
-	 * Executes this query using the bound parameters and their types.
146
-	 *
147
-	 * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
148
-	 * for insert, update and delete statements.
149
-	 *
150
-	 * @return \Doctrine\DBAL\Driver\Statement|int
151
-	 * @since 8.2.0
152
-	 */
153
-	public function execute();
154
-
155
-	/**
156
-	 * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
157
-	 *
158
-	 * <code>
159
-	 *     $qb = $conn->getQueryBuilder()
160
-	 *         ->select('u')
161
-	 *         ->from('User', 'u')
162
-	 *     echo $qb->getSQL(); // SELECT u FROM User u
163
-	 * </code>
164
-	 *
165
-	 * @return string The SQL query string.
166
-	 * @since 8.2.0
167
-	 */
168
-	public function getSQL();
169
-
170
-	/**
171
-	 * Sets a query parameter for the query being constructed.
172
-	 *
173
-	 * <code>
174
-	 *     $qb = $conn->getQueryBuilder()
175
-	 *         ->select('u')
176
-	 *         ->from('users', 'u')
177
-	 *         ->where('u.id = :user_id')
178
-	 *         ->setParameter(':user_id', 1);
179
-	 * </code>
180
-	 *
181
-	 * @param string|integer $key The parameter position or name.
182
-	 * @param mixed $value The parameter value.
183
-	 * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
184
-	 *
185
-	 * @return $this This QueryBuilder instance.
186
-	 * @since 8.2.0
187
-	 */
188
-	public function setParameter($key, $value, $type = null);
189
-
190
-	/**
191
-	 * Sets a collection of query parameters for the query being constructed.
192
-	 *
193
-	 * <code>
194
-	 *     $qb = $conn->getQueryBuilder()
195
-	 *         ->select('u')
196
-	 *         ->from('users', 'u')
197
-	 *         ->where('u.id = :user_id1 OR u.id = :user_id2')
198
-	 *         ->setParameters(array(
199
-	 *             ':user_id1' => 1,
200
-	 *             ':user_id2' => 2
201
-	 *         ));
202
-	 * </code>
203
-	 *
204
-	 * @param array $params The query parameters to set.
205
-	 * @param array $types The query parameters types to set.
206
-	 *
207
-	 * @return $this This QueryBuilder instance.
208
-	 * @since 8.2.0
209
-	 */
210
-	public function setParameters(array $params, array $types = []);
211
-
212
-	/**
213
-	 * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
214
-	 *
215
-	 * @return array The currently defined query parameters indexed by parameter index or name.
216
-	 * @since 8.2.0
217
-	 */
218
-	public function getParameters();
219
-
220
-	/**
221
-	 * Gets a (previously set) query parameter of the query being constructed.
222
-	 *
223
-	 * @param mixed $key The key (index or name) of the bound parameter.
224
-	 *
225
-	 * @return mixed The value of the bound parameter.
226
-	 * @since 8.2.0
227
-	 */
228
-	public function getParameter($key);
229
-
230
-	/**
231
-	 * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
232
-	 *
233
-	 * @return array The currently defined query parameter types indexed by parameter index or name.
234
-	 * @since 8.2.0
235
-	 */
236
-	public function getParameterTypes();
237
-
238
-	/**
239
-	 * Gets a (previously set) query parameter type of the query being constructed.
240
-	 *
241
-	 * @param mixed $key The key (index or name) of the bound parameter type.
242
-	 *
243
-	 * @return mixed The value of the bound parameter type.
244
-	 * @since 8.2.0
245
-	 */
246
-	public function getParameterType($key);
247
-
248
-	/**
249
-	 * Sets the position of the first result to retrieve (the "offset").
250
-	 *
251
-	 * @param integer $firstResult The first result to return.
252
-	 *
253
-	 * @return $this This QueryBuilder instance.
254
-	 * @since 8.2.0
255
-	 */
256
-	public function setFirstResult($firstResult);
257
-
258
-	/**
259
-	 * Gets the position of the first result the query object was set to retrieve (the "offset").
260
-	 * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
261
-	 *
262
-	 * @return integer The position of the first result.
263
-	 * @since 8.2.0
264
-	 */
265
-	public function getFirstResult();
266
-
267
-	/**
268
-	 * Sets the maximum number of results to retrieve (the "limit").
269
-	 *
270
-	 * @param integer $maxResults The maximum number of results to retrieve.
271
-	 *
272
-	 * @return $this This QueryBuilder instance.
273
-	 * @since 8.2.0
274
-	 */
275
-	public function setMaxResults($maxResults);
276
-
277
-	/**
278
-	 * Gets the maximum number of results the query object was set to retrieve (the "limit").
279
-	 * Returns NULL if {@link setMaxResults} was not applied to this query builder.
280
-	 *
281
-	 * @return int|null The maximum number of results.
282
-	 * @since 8.2.0
283
-	 */
284
-	public function getMaxResults();
285
-
286
-	/**
287
-	 * Specifies an item that is to be returned in the query result.
288
-	 * Replaces any previously specified selections, if any.
289
-	 *
290
-	 * <code>
291
-	 *     $qb = $conn->getQueryBuilder()
292
-	 *         ->select('u.id', 'p.id')
293
-	 *         ->from('users', 'u')
294
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
295
-	 * </code>
296
-	 *
297
-	 * @param mixed ...$selects The selection expressions.
298
-	 *
299
-	 * @return $this This QueryBuilder instance.
300
-	 * @since 8.2.0
301
-	 */
302
-	public function select(...$selects);
303
-
304
-	/**
305
-	 * Specifies an item that is to be returned with a different name in the query result.
306
-	 *
307
-	 * <code>
308
-	 *     $qb = $conn->getQueryBuilder()
309
-	 *         ->selectAlias('u.id', 'user_id')
310
-	 *         ->from('users', 'u')
311
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
312
-	 * </code>
313
-	 *
314
-	 * @param mixed $select The selection expressions.
315
-	 * @param string $alias The column alias used in the constructed query.
316
-	 *
317
-	 * @return $this This QueryBuilder instance.
318
-	 * @since 8.2.1
319
-	 */
320
-	public function selectAlias($select, $alias);
321
-
322
-	/**
323
-	 * Specifies an item that is to be returned uniquely in the query result.
324
-	 *
325
-	 * <code>
326
-	 *     $qb = $conn->getQueryBuilder()
327
-	 *         ->selectDistinct('type')
328
-	 *         ->from('users');
329
-	 * </code>
330
-	 *
331
-	 * @param mixed $select The selection expressions.
332
-	 *
333
-	 * @return $this This QueryBuilder instance.
334
-	 * @since 9.0.0
335
-	 */
336
-	public function selectDistinct($select);
337
-
338
-	/**
339
-	 * Adds an item that is to be returned in the query result.
340
-	 *
341
-	 * <code>
342
-	 *     $qb = $conn->getQueryBuilder()
343
-	 *         ->select('u.id')
344
-	 *         ->addSelect('p.id')
345
-	 *         ->from('users', 'u')
346
-	 *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
347
-	 * </code>
348
-	 *
349
-	 * @param mixed ...$select The selection expression.
350
-	 *
351
-	 * @return $this This QueryBuilder instance.
352
-	 * @since 8.2.0
353
-	 */
354
-	public function addSelect(...$select);
355
-
356
-	/**
357
-	 * Turns the query being built into a bulk delete query that ranges over
358
-	 * a certain table.
359
-	 *
360
-	 * <code>
361
-	 *     $qb = $conn->getQueryBuilder()
362
-	 *         ->delete('users', 'u')
363
-	 *         ->where('u.id = :user_id');
364
-	 *         ->setParameter(':user_id', 1);
365
-	 * </code>
366
-	 *
367
-	 * @param string $delete The table whose rows are subject to the deletion.
368
-	 * @param string $alias The table alias used in the constructed query.
369
-	 *
370
-	 * @return $this This QueryBuilder instance.
371
-	 * @since 8.2.0
372
-	 */
373
-	public function delete($delete = null, $alias = null);
374
-
375
-	/**
376
-	 * Turns the query being built into a bulk update query that ranges over
377
-	 * a certain table
378
-	 *
379
-	 * <code>
380
-	 *     $qb = $conn->getQueryBuilder()
381
-	 *         ->update('users', 'u')
382
-	 *         ->set('u.password', md5('password'))
383
-	 *         ->where('u.id = ?');
384
-	 * </code>
385
-	 *
386
-	 * @param string $update The table whose rows are subject to the update.
387
-	 * @param string $alias The table alias used in the constructed query.
388
-	 *
389
-	 * @return $this This QueryBuilder instance.
390
-	 * @since 8.2.0
391
-	 */
392
-	public function update($update = null, $alias = null);
393
-
394
-	/**
395
-	 * Turns the query being built into an insert query that inserts into
396
-	 * a certain table
397
-	 *
398
-	 * <code>
399
-	 *     $qb = $conn->getQueryBuilder()
400
-	 *         ->insert('users')
401
-	 *         ->values(
402
-	 *             array(
403
-	 *                 'name' => '?',
404
-	 *                 'password' => '?'
405
-	 *             )
406
-	 *         );
407
-	 * </code>
408
-	 *
409
-	 * @param string $insert The table into which the rows should be inserted.
410
-	 *
411
-	 * @return $this This QueryBuilder instance.
412
-	 * @since 8.2.0
413
-	 */
414
-	public function insert($insert = null);
415
-
416
-	/**
417
-	 * Creates and adds a query root corresponding to the table identified by the
418
-	 * given alias, forming a cartesian product with any existing query roots.
419
-	 *
420
-	 * <code>
421
-	 *     $qb = $conn->getQueryBuilder()
422
-	 *         ->select('u.id')
423
-	 *         ->from('users', 'u')
424
-	 * </code>
425
-	 *
426
-	 * @param string $from The table.
427
-	 * @param string|null $alias The alias of the table.
428
-	 *
429
-	 * @return $this This QueryBuilder instance.
430
-	 * @since 8.2.0
431
-	 */
432
-	public function from($from, $alias = null);
433
-
434
-	/**
435
-	 * Creates and adds a join to the query.
436
-	 *
437
-	 * <code>
438
-	 *     $qb = $conn->getQueryBuilder()
439
-	 *         ->select('u.name')
440
-	 *         ->from('users', 'u')
441
-	 *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
442
-	 * </code>
443
-	 *
444
-	 * @param string $fromAlias The alias that points to a from clause.
445
-	 * @param string $join The table name to join.
446
-	 * @param string $alias The alias of the join table.
447
-	 * @param string $condition The condition for the join.
448
-	 *
449
-	 * @return $this This QueryBuilder instance.
450
-	 * @since 8.2.0
451
-	 */
452
-	public function join($fromAlias, $join, $alias, $condition = null);
453
-
454
-	/**
455
-	 * Creates and adds a join to the query.
456
-	 *
457
-	 * <code>
458
-	 *     $qb = $conn->getQueryBuilder()
459
-	 *         ->select('u.name')
460
-	 *         ->from('users', 'u')
461
-	 *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
462
-	 * </code>
463
-	 *
464
-	 * @param string $fromAlias The alias that points to a from clause.
465
-	 * @param string $join The table name to join.
466
-	 * @param string $alias The alias of the join table.
467
-	 * @param string $condition The condition for the join.
468
-	 *
469
-	 * @return $this This QueryBuilder instance.
470
-	 * @since 8.2.0
471
-	 */
472
-	public function innerJoin($fromAlias, $join, $alias, $condition = null);
473
-
474
-	/**
475
-	 * Creates and adds a left join to the query.
476
-	 *
477
-	 * <code>
478
-	 *     $qb = $conn->getQueryBuilder()
479
-	 *         ->select('u.name')
480
-	 *         ->from('users', 'u')
481
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
482
-	 * </code>
483
-	 *
484
-	 * @param string $fromAlias The alias that points to a from clause.
485
-	 * @param string $join The table name to join.
486
-	 * @param string $alias The alias of the join table.
487
-	 * @param string $condition The condition for the join.
488
-	 *
489
-	 * @return $this This QueryBuilder instance.
490
-	 * @since 8.2.0
491
-	 */
492
-	public function leftJoin($fromAlias, $join, $alias, $condition = null);
493
-
494
-	/**
495
-	 * Creates and adds a right join to the query.
496
-	 *
497
-	 * <code>
498
-	 *     $qb = $conn->getQueryBuilder()
499
-	 *         ->select('u.name')
500
-	 *         ->from('users', 'u')
501
-	 *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
502
-	 * </code>
503
-	 *
504
-	 * @param string $fromAlias The alias that points to a from clause.
505
-	 * @param string $join The table name to join.
506
-	 * @param string $alias The alias of the join table.
507
-	 * @param string $condition The condition for the join.
508
-	 *
509
-	 * @return $this This QueryBuilder instance.
510
-	 * @since 8.2.0
511
-	 */
512
-	public function rightJoin($fromAlias, $join, $alias, $condition = null);
513
-
514
-	/**
515
-	 * Sets a new value for a column in a bulk update query.
516
-	 *
517
-	 * <code>
518
-	 *     $qb = $conn->getQueryBuilder()
519
-	 *         ->update('users', 'u')
520
-	 *         ->set('u.password', md5('password'))
521
-	 *         ->where('u.id = ?');
522
-	 * </code>
523
-	 *
524
-	 * @param string $key The column to set.
525
-	 * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
526
-	 *
527
-	 * @return $this This QueryBuilder instance.
528
-	 * @since 8.2.0
529
-	 */
530
-	public function set($key, $value);
531
-
532
-	/**
533
-	 * Specifies one or more restrictions to the query result.
534
-	 * Replaces any previously specified restrictions, if any.
535
-	 *
536
-	 * <code>
537
-	 *     $qb = $conn->getQueryBuilder()
538
-	 *         ->select('u.name')
539
-	 *         ->from('users', 'u')
540
-	 *         ->where('u.id = ?');
541
-	 *
542
-	 *     // You can optionally programatically build and/or expressions
543
-	 *     $qb = $conn->getQueryBuilder();
544
-	 *
545
-	 *     $or = $qb->expr()->orx();
546
-	 *     $or->add($qb->expr()->eq('u.id', 1));
547
-	 *     $or->add($qb->expr()->eq('u.id', 2));
548
-	 *
549
-	 *     $qb->update('users', 'u')
550
-	 *         ->set('u.password', md5('password'))
551
-	 *         ->where($or);
552
-	 * </code>
553
-	 *
554
-	 * @param mixed $predicates The restriction predicates.
555
-	 *
556
-	 * @return $this This QueryBuilder instance.
557
-	 * @since 8.2.0
558
-	 */
559
-	public function where(...$predicates);
560
-
561
-	/**
562
-	 * Adds one or more restrictions to the query results, forming a logical
563
-	 * conjunction with any previously specified restrictions.
564
-	 *
565
-	 * <code>
566
-	 *     $qb = $conn->getQueryBuilder()
567
-	 *         ->select('u')
568
-	 *         ->from('users', 'u')
569
-	 *         ->where('u.username LIKE ?')
570
-	 *         ->andWhere('u.is_active = 1');
571
-	 * </code>
572
-	 *
573
-	 * @param mixed ...$where The query restrictions.
574
-	 *
575
-	 * @return $this This QueryBuilder instance.
576
-	 *
577
-	 * @see where()
578
-	 * @since 8.2.0
579
-	 */
580
-	public function andWhere(...$where);
581
-
582
-	/**
583
-	 * Adds one or more restrictions to the query results, forming a logical
584
-	 * disjunction with any previously specified restrictions.
585
-	 *
586
-	 * <code>
587
-	 *     $qb = $conn->getQueryBuilder()
588
-	 *         ->select('u.name')
589
-	 *         ->from('users', 'u')
590
-	 *         ->where('u.id = 1')
591
-	 *         ->orWhere('u.id = 2');
592
-	 * </code>
593
-	 *
594
-	 * @param mixed ...$where The WHERE statement.
595
-	 *
596
-	 * @return $this This QueryBuilder instance.
597
-	 *
598
-	 * @see where()
599
-	 * @since 8.2.0
600
-	 */
601
-	public function orWhere(...$where);
602
-
603
-	/**
604
-	 * Specifies a grouping over the results of the query.
605
-	 * Replaces any previously specified groupings, if any.
606
-	 *
607
-	 * <code>
608
-	 *     $qb = $conn->getQueryBuilder()
609
-	 *         ->select('u.name')
610
-	 *         ->from('users', 'u')
611
-	 *         ->groupBy('u.id');
612
-	 * </code>
613
-	 *
614
-	 * @param mixed ...$groupBys The grouping expression.
615
-	 *
616
-	 * @return $this This QueryBuilder instance.
617
-	 * @since 8.2.0
618
-	 */
619
-	public function groupBy(...$groupBys);
620
-
621
-	/**
622
-	 * Adds a grouping expression to the query.
623
-	 *
624
-	 * <code>
625
-	 *     $qb = $conn->getQueryBuilder()
626
-	 *         ->select('u.name')
627
-	 *         ->from('users', 'u')
628
-	 *         ->groupBy('u.lastLogin');
629
-	 *         ->addGroupBy('u.createdAt')
630
-	 * </code>
631
-	 *
632
-	 * @param mixed ...$groupBy The grouping expression.
633
-	 *
634
-	 * @return $this This QueryBuilder instance.
635
-	 * @since 8.2.0
636
-	 */
637
-	public function addGroupBy(...$groupBy);
638
-
639
-	/**
640
-	 * Sets a value for a column in an insert query.
641
-	 *
642
-	 * <code>
643
-	 *     $qb = $conn->getQueryBuilder()
644
-	 *         ->insert('users')
645
-	 *         ->values(
646
-	 *             array(
647
-	 *                 'name' => '?'
648
-	 *             )
649
-	 *         )
650
-	 *         ->setValue('password', '?');
651
-	 * </code>
652
-	 *
653
-	 * @param string $column The column into which the value should be inserted.
654
-	 * @param IParameter|string $value The value that should be inserted into the column.
655
-	 *
656
-	 * @return $this This QueryBuilder instance.
657
-	 * @since 8.2.0
658
-	 */
659
-	public function setValue($column, $value);
660
-
661
-	/**
662
-	 * Specifies values for an insert query indexed by column names.
663
-	 * Replaces any previous values, if any.
664
-	 *
665
-	 * <code>
666
-	 *     $qb = $conn->getQueryBuilder()
667
-	 *         ->insert('users')
668
-	 *         ->values(
669
-	 *             array(
670
-	 *                 'name' => '?',
671
-	 *                 'password' => '?'
672
-	 *             )
673
-	 *         );
674
-	 * </code>
675
-	 *
676
-	 * @param array $values The values to specify for the insert query indexed by column names.
677
-	 *
678
-	 * @return $this This QueryBuilder instance.
679
-	 * @since 8.2.0
680
-	 */
681
-	public function values(array $values);
682
-
683
-	/**
684
-	 * Specifies a restriction over the groups of the query.
685
-	 * Replaces any previous having restrictions, if any.
686
-	 *
687
-	 * @param mixed ...$having The restriction over the groups.
688
-	 *
689
-	 * @return $this This QueryBuilder instance.
690
-	 * @since 8.2.0
691
-	 */
692
-	public function having(...$having);
693
-
694
-	/**
695
-	 * Adds a restriction over the groups of the query, forming a logical
696
-	 * conjunction with any existing having restrictions.
697
-	 *
698
-	 * @param mixed ...$having The restriction to append.
699
-	 *
700
-	 * @return $this This QueryBuilder instance.
701
-	 * @since 8.2.0
702
-	 */
703
-	public function andHaving(...$having);
704
-
705
-	/**
706
-	 * Adds a restriction over the groups of the query, forming a logical
707
-	 * disjunction with any existing having restrictions.
708
-	 *
709
-	 * @param mixed ...$having The restriction to add.
710
-	 *
711
-	 * @return $this This QueryBuilder instance.
712
-	 * @since 8.2.0
713
-	 */
714
-	public function orHaving(...$having);
715
-
716
-	/**
717
-	 * Specifies an ordering for the query results.
718
-	 * Replaces any previously specified orderings, if any.
719
-	 *
720
-	 * @param string $sort The ordering expression.
721
-	 * @param string $order The ordering direction.
722
-	 *
723
-	 * @return $this This QueryBuilder instance.
724
-	 * @since 8.2.0
725
-	 */
726
-	public function orderBy($sort, $order = null);
727
-
728
-	/**
729
-	 * Adds an ordering to the query results.
730
-	 *
731
-	 * @param string $sort The ordering expression.
732
-	 * @param string $order The ordering direction.
733
-	 *
734
-	 * @return $this This QueryBuilder instance.
735
-	 * @since 8.2.0
736
-	 */
737
-	public function addOrderBy($sort, $order = null);
738
-
739
-	/**
740
-	 * Gets a query part by its name.
741
-	 *
742
-	 * @param string $queryPartName
743
-	 *
744
-	 * @return mixed
745
-	 * @since 8.2.0
746
-	 */
747
-	public function getQueryPart($queryPartName);
748
-
749
-	/**
750
-	 * Gets all query parts.
751
-	 *
752
-	 * @return array
753
-	 * @since 8.2.0
754
-	 */
755
-	public function getQueryParts();
756
-
757
-	/**
758
-	 * Resets SQL parts.
759
-	 *
760
-	 * @param array|null $queryPartNames
761
-	 *
762
-	 * @return $this This QueryBuilder instance.
763
-	 * @since 8.2.0
764
-	 */
765
-	public function resetQueryParts($queryPartNames = null);
766
-
767
-	/**
768
-	 * Resets a single SQL part.
769
-	 *
770
-	 * @param string $queryPartName
771
-	 *
772
-	 * @return $this This QueryBuilder instance.
773
-	 * @since 8.2.0
774
-	 */
775
-	public function resetQueryPart($queryPartName);
776
-
777
-	/**
778
-	 * Creates a new named parameter and bind the value $value to it.
779
-	 *
780
-	 * This method provides a shortcut for PDOStatement::bindValue
781
-	 * when using prepared statements.
782
-	 *
783
-	 * The parameter $value specifies the value that you want to bind. If
784
-	 * $placeholder is not provided bindValue() will automatically create a
785
-	 * placeholder for you. An automatic placeholder will be of the name
786
-	 * ':dcValue1', ':dcValue2' etc.
787
-	 *
788
-	 * For more information see {@link https://www.php.net/pdostatement-bindparam}
789
-	 *
790
-	 * Example:
791
-	 * <code>
792
-	 * $value = 2;
793
-	 * $q->eq( 'id', $q->bindValue( $value ) );
794
-	 * $stmt = $q->executeQuery(); // executed with 'id = 2'
795
-	 * </code>
796
-	 *
797
-	 * @license New BSD License
798
-	 * @link http://www.zetacomponents.org
799
-	 *
800
-	 * @param mixed $value
801
-	 * @param mixed $type
802
-	 * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
803
-	 *
804
-	 * @return IParameter
805
-	 * @since 8.2.0
806
-	 */
807
-	public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null);
808
-
809
-	/**
810
-	 * Creates a new positional parameter and bind the given value to it.
811
-	 *
812
-	 * Attention: If you are using positional parameters with the query builder you have
813
-	 * to be very careful to bind all parameters in the order they appear in the SQL
814
-	 * statement , otherwise they get bound in the wrong order which can lead to serious
815
-	 * bugs in your code.
816
-	 *
817
-	 * Example:
818
-	 * <code>
819
-	 *  $qb = $conn->getQueryBuilder();
820
-	 *  $qb->select('u.*')
821
-	 *     ->from('users', 'u')
822
-	 *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
823
-	 *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
824
-	 * </code>
825
-	 *
826
-	 * @param mixed $value
827
-	 * @param integer $type
828
-	 *
829
-	 * @return IParameter
830
-	 * @since 8.2.0
831
-	 */
832
-	public function createPositionalParameter($value, $type = self::PARAM_STR);
833
-
834
-	/**
835
-	 * Creates a new parameter
836
-	 *
837
-	 * Example:
838
-	 * <code>
839
-	 *  $qb = $conn->getQueryBuilder();
840
-	 *  $qb->select('u.*')
841
-	 *     ->from('users', 'u')
842
-	 *     ->where('u.username = ' . $qb->createParameter('name'))
843
-	 *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
844
-	 * </code>
845
-	 *
846
-	 * @param string $name
847
-	 *
848
-	 * @return IParameter
849
-	 * @since 8.2.0
850
-	 */
851
-	public function createParameter($name);
852
-
853
-	/**
854
-	 * Creates a new function
855
-	 *
856
-	 * Attention: Column names inside the call have to be quoted before hand
857
-	 *
858
-	 * Example:
859
-	 * <code>
860
-	 *  $qb = $conn->getQueryBuilder();
861
-	 *  $qb->select($qb->createFunction('COUNT(*)'))
862
-	 *     ->from('users', 'u')
863
-	 *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
864
-	 * </code>
865
-	 * <code>
866
-	 *  $qb = $conn->getQueryBuilder();
867
-	 *  $qb->select($qb->createFunction('COUNT(`column`)'))
868
-	 *     ->from('users', 'u')
869
-	 *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
870
-	 * </code>
871
-	 *
872
-	 * @param string $call
873
-	 *
874
-	 * @return IQueryFunction
875
-	 * @since 8.2.0
876
-	 */
877
-	public function createFunction($call);
878
-
879
-	/**
880
-	 * Used to get the id of the last inserted element
881
-	 * @return int
882
-	 * @throws \BadMethodCallException When being called before an insert query has been run.
883
-	 * @since 9.0.0
884
-	 */
885
-	public function getLastInsertId();
886
-
887
-	/**
888
-	 * Returns the table name quoted and with database prefix as needed by the implementation
889
-	 *
890
-	 * @param string $table
891
-	 * @return string
892
-	 * @since 9.0.0
893
-	 */
894
-	public function getTableName($table);
895
-
896
-	/**
897
-	 * Returns the column name quoted and with table alias prefix as needed by the implementation
898
-	 *
899
-	 * @param string $column
900
-	 * @param string $tableAlias
901
-	 * @return string
902
-	 * @since 9.0.0
903
-	 */
904
-	public function getColumnName($column, $tableAlias = '');
38
+    /**
39
+     * @since 9.0.0
40
+     */
41
+    public const PARAM_NULL = \PDO::PARAM_NULL;
42
+    /**
43
+     * @since 9.0.0
44
+     */
45
+    public const PARAM_BOOL = \PDO::PARAM_BOOL;
46
+    /**
47
+     * @since 9.0.0
48
+     */
49
+    public const PARAM_INT = \PDO::PARAM_INT;
50
+    /**
51
+     * @since 9.0.0
52
+     */
53
+    public const PARAM_STR = \PDO::PARAM_STR;
54
+    /**
55
+     * @since 9.0.0
56
+     */
57
+    public const PARAM_LOB = \PDO::PARAM_LOB;
58
+    /**
59
+     * @since 9.0.0
60
+     */
61
+    public const PARAM_DATE = 'datetime';
62
+
63
+    /**
64
+     * @since 9.0.0
65
+     */
66
+    public const PARAM_INT_ARRAY = Connection::PARAM_INT_ARRAY;
67
+    /**
68
+     * @since 9.0.0
69
+     */
70
+    public const PARAM_STR_ARRAY = Connection::PARAM_STR_ARRAY;
71
+
72
+
73
+    /**
74
+     * Enable/disable automatic prefixing of table names with the oc_ prefix
75
+     *
76
+     * @param bool $enabled If set to true table names will be prefixed with the
77
+     * owncloud database prefix automatically.
78
+     * @since 8.2.0
79
+     */
80
+    public function automaticTablePrefix($enabled);
81
+
82
+    /**
83
+     * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
84
+     * This producer method is intended for convenient inline usage. Example:
85
+     *
86
+     * <code>
87
+     *     $qb = $conn->getQueryBuilder()
88
+     *         ->select('u')
89
+     *         ->from('users', 'u')
90
+     *         ->where($qb->expr()->eq('u.id', 1));
91
+     * </code>
92
+     *
93
+     * For more complex expression construction, consider storing the expression
94
+     * builder object in a local variable.
95
+     *
96
+     * @return \OCP\DB\QueryBuilder\IExpressionBuilder
97
+     * @since 8.2.0
98
+     */
99
+    public function expr();
100
+
101
+    /**
102
+     * Gets an FunctionBuilder used for object-oriented construction of query functions.
103
+     * This producer method is intended for convenient inline usage. Example:
104
+     *
105
+     * <code>
106
+     *     $qb = $conn->getQueryBuilder()
107
+     *         ->select('u')
108
+     *         ->from('users', 'u')
109
+     *         ->where($qb->fun()->md5('u.id'));
110
+     * </code>
111
+     *
112
+     * For more complex function construction, consider storing the function
113
+     * builder object in a local variable.
114
+     *
115
+     * @return \OCP\DB\QueryBuilder\IFunctionBuilder
116
+     * @since 12.0.0
117
+     */
118
+    public function func();
119
+
120
+    /**
121
+     * Gets the type of the currently built query.
122
+     *
123
+     * @return integer
124
+     * @since 8.2.0
125
+     */
126
+    public function getType();
127
+
128
+    /**
129
+     * Gets the associated DBAL Connection for this query builder.
130
+     *
131
+     * @return \OCP\IDBConnection
132
+     * @since 8.2.0
133
+     */
134
+    public function getConnection();
135
+
136
+    /**
137
+     * Gets the state of this query builder instance.
138
+     *
139
+     * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
140
+     * @since 8.2.0
141
+     */
142
+    public function getState();
143
+
144
+    /**
145
+     * Executes this query using the bound parameters and their types.
146
+     *
147
+     * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
148
+     * for insert, update and delete statements.
149
+     *
150
+     * @return \Doctrine\DBAL\Driver\Statement|int
151
+     * @since 8.2.0
152
+     */
153
+    public function execute();
154
+
155
+    /**
156
+     * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
157
+     *
158
+     * <code>
159
+     *     $qb = $conn->getQueryBuilder()
160
+     *         ->select('u')
161
+     *         ->from('User', 'u')
162
+     *     echo $qb->getSQL(); // SELECT u FROM User u
163
+     * </code>
164
+     *
165
+     * @return string The SQL query string.
166
+     * @since 8.2.0
167
+     */
168
+    public function getSQL();
169
+
170
+    /**
171
+     * Sets a query parameter for the query being constructed.
172
+     *
173
+     * <code>
174
+     *     $qb = $conn->getQueryBuilder()
175
+     *         ->select('u')
176
+     *         ->from('users', 'u')
177
+     *         ->where('u.id = :user_id')
178
+     *         ->setParameter(':user_id', 1);
179
+     * </code>
180
+     *
181
+     * @param string|integer $key The parameter position or name.
182
+     * @param mixed $value The parameter value.
183
+     * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
184
+     *
185
+     * @return $this This QueryBuilder instance.
186
+     * @since 8.2.0
187
+     */
188
+    public function setParameter($key, $value, $type = null);
189
+
190
+    /**
191
+     * Sets a collection of query parameters for the query being constructed.
192
+     *
193
+     * <code>
194
+     *     $qb = $conn->getQueryBuilder()
195
+     *         ->select('u')
196
+     *         ->from('users', 'u')
197
+     *         ->where('u.id = :user_id1 OR u.id = :user_id2')
198
+     *         ->setParameters(array(
199
+     *             ':user_id1' => 1,
200
+     *             ':user_id2' => 2
201
+     *         ));
202
+     * </code>
203
+     *
204
+     * @param array $params The query parameters to set.
205
+     * @param array $types The query parameters types to set.
206
+     *
207
+     * @return $this This QueryBuilder instance.
208
+     * @since 8.2.0
209
+     */
210
+    public function setParameters(array $params, array $types = []);
211
+
212
+    /**
213
+     * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
214
+     *
215
+     * @return array The currently defined query parameters indexed by parameter index or name.
216
+     * @since 8.2.0
217
+     */
218
+    public function getParameters();
219
+
220
+    /**
221
+     * Gets a (previously set) query parameter of the query being constructed.
222
+     *
223
+     * @param mixed $key The key (index or name) of the bound parameter.
224
+     *
225
+     * @return mixed The value of the bound parameter.
226
+     * @since 8.2.0
227
+     */
228
+    public function getParameter($key);
229
+
230
+    /**
231
+     * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
232
+     *
233
+     * @return array The currently defined query parameter types indexed by parameter index or name.
234
+     * @since 8.2.0
235
+     */
236
+    public function getParameterTypes();
237
+
238
+    /**
239
+     * Gets a (previously set) query parameter type of the query being constructed.
240
+     *
241
+     * @param mixed $key The key (index or name) of the bound parameter type.
242
+     *
243
+     * @return mixed The value of the bound parameter type.
244
+     * @since 8.2.0
245
+     */
246
+    public function getParameterType($key);
247
+
248
+    /**
249
+     * Sets the position of the first result to retrieve (the "offset").
250
+     *
251
+     * @param integer $firstResult The first result to return.
252
+     *
253
+     * @return $this This QueryBuilder instance.
254
+     * @since 8.2.0
255
+     */
256
+    public function setFirstResult($firstResult);
257
+
258
+    /**
259
+     * Gets the position of the first result the query object was set to retrieve (the "offset").
260
+     * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
261
+     *
262
+     * @return integer The position of the first result.
263
+     * @since 8.2.0
264
+     */
265
+    public function getFirstResult();
266
+
267
+    /**
268
+     * Sets the maximum number of results to retrieve (the "limit").
269
+     *
270
+     * @param integer $maxResults The maximum number of results to retrieve.
271
+     *
272
+     * @return $this This QueryBuilder instance.
273
+     * @since 8.2.0
274
+     */
275
+    public function setMaxResults($maxResults);
276
+
277
+    /**
278
+     * Gets the maximum number of results the query object was set to retrieve (the "limit").
279
+     * Returns NULL if {@link setMaxResults} was not applied to this query builder.
280
+     *
281
+     * @return int|null The maximum number of results.
282
+     * @since 8.2.0
283
+     */
284
+    public function getMaxResults();
285
+
286
+    /**
287
+     * Specifies an item that is to be returned in the query result.
288
+     * Replaces any previously specified selections, if any.
289
+     *
290
+     * <code>
291
+     *     $qb = $conn->getQueryBuilder()
292
+     *         ->select('u.id', 'p.id')
293
+     *         ->from('users', 'u')
294
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
295
+     * </code>
296
+     *
297
+     * @param mixed ...$selects The selection expressions.
298
+     *
299
+     * @return $this This QueryBuilder instance.
300
+     * @since 8.2.0
301
+     */
302
+    public function select(...$selects);
303
+
304
+    /**
305
+     * Specifies an item that is to be returned with a different name in the query result.
306
+     *
307
+     * <code>
308
+     *     $qb = $conn->getQueryBuilder()
309
+     *         ->selectAlias('u.id', 'user_id')
310
+     *         ->from('users', 'u')
311
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
312
+     * </code>
313
+     *
314
+     * @param mixed $select The selection expressions.
315
+     * @param string $alias The column alias used in the constructed query.
316
+     *
317
+     * @return $this This QueryBuilder instance.
318
+     * @since 8.2.1
319
+     */
320
+    public function selectAlias($select, $alias);
321
+
322
+    /**
323
+     * Specifies an item that is to be returned uniquely in the query result.
324
+     *
325
+     * <code>
326
+     *     $qb = $conn->getQueryBuilder()
327
+     *         ->selectDistinct('type')
328
+     *         ->from('users');
329
+     * </code>
330
+     *
331
+     * @param mixed $select The selection expressions.
332
+     *
333
+     * @return $this This QueryBuilder instance.
334
+     * @since 9.0.0
335
+     */
336
+    public function selectDistinct($select);
337
+
338
+    /**
339
+     * Adds an item that is to be returned in the query result.
340
+     *
341
+     * <code>
342
+     *     $qb = $conn->getQueryBuilder()
343
+     *         ->select('u.id')
344
+     *         ->addSelect('p.id')
345
+     *         ->from('users', 'u')
346
+     *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
347
+     * </code>
348
+     *
349
+     * @param mixed ...$select The selection expression.
350
+     *
351
+     * @return $this This QueryBuilder instance.
352
+     * @since 8.2.0
353
+     */
354
+    public function addSelect(...$select);
355
+
356
+    /**
357
+     * Turns the query being built into a bulk delete query that ranges over
358
+     * a certain table.
359
+     *
360
+     * <code>
361
+     *     $qb = $conn->getQueryBuilder()
362
+     *         ->delete('users', 'u')
363
+     *         ->where('u.id = :user_id');
364
+     *         ->setParameter(':user_id', 1);
365
+     * </code>
366
+     *
367
+     * @param string $delete The table whose rows are subject to the deletion.
368
+     * @param string $alias The table alias used in the constructed query.
369
+     *
370
+     * @return $this This QueryBuilder instance.
371
+     * @since 8.2.0
372
+     */
373
+    public function delete($delete = null, $alias = null);
374
+
375
+    /**
376
+     * Turns the query being built into a bulk update query that ranges over
377
+     * a certain table
378
+     *
379
+     * <code>
380
+     *     $qb = $conn->getQueryBuilder()
381
+     *         ->update('users', 'u')
382
+     *         ->set('u.password', md5('password'))
383
+     *         ->where('u.id = ?');
384
+     * </code>
385
+     *
386
+     * @param string $update The table whose rows are subject to the update.
387
+     * @param string $alias The table alias used in the constructed query.
388
+     *
389
+     * @return $this This QueryBuilder instance.
390
+     * @since 8.2.0
391
+     */
392
+    public function update($update = null, $alias = null);
393
+
394
+    /**
395
+     * Turns the query being built into an insert query that inserts into
396
+     * a certain table
397
+     *
398
+     * <code>
399
+     *     $qb = $conn->getQueryBuilder()
400
+     *         ->insert('users')
401
+     *         ->values(
402
+     *             array(
403
+     *                 'name' => '?',
404
+     *                 'password' => '?'
405
+     *             )
406
+     *         );
407
+     * </code>
408
+     *
409
+     * @param string $insert The table into which the rows should be inserted.
410
+     *
411
+     * @return $this This QueryBuilder instance.
412
+     * @since 8.2.0
413
+     */
414
+    public function insert($insert = null);
415
+
416
+    /**
417
+     * Creates and adds a query root corresponding to the table identified by the
418
+     * given alias, forming a cartesian product with any existing query roots.
419
+     *
420
+     * <code>
421
+     *     $qb = $conn->getQueryBuilder()
422
+     *         ->select('u.id')
423
+     *         ->from('users', 'u')
424
+     * </code>
425
+     *
426
+     * @param string $from The table.
427
+     * @param string|null $alias The alias of the table.
428
+     *
429
+     * @return $this This QueryBuilder instance.
430
+     * @since 8.2.0
431
+     */
432
+    public function from($from, $alias = null);
433
+
434
+    /**
435
+     * Creates and adds a join to the query.
436
+     *
437
+     * <code>
438
+     *     $qb = $conn->getQueryBuilder()
439
+     *         ->select('u.name')
440
+     *         ->from('users', 'u')
441
+     *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
442
+     * </code>
443
+     *
444
+     * @param string $fromAlias The alias that points to a from clause.
445
+     * @param string $join The table name to join.
446
+     * @param string $alias The alias of the join table.
447
+     * @param string $condition The condition for the join.
448
+     *
449
+     * @return $this This QueryBuilder instance.
450
+     * @since 8.2.0
451
+     */
452
+    public function join($fromAlias, $join, $alias, $condition = null);
453
+
454
+    /**
455
+     * Creates and adds a join to the query.
456
+     *
457
+     * <code>
458
+     *     $qb = $conn->getQueryBuilder()
459
+     *         ->select('u.name')
460
+     *         ->from('users', 'u')
461
+     *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
462
+     * </code>
463
+     *
464
+     * @param string $fromAlias The alias that points to a from clause.
465
+     * @param string $join The table name to join.
466
+     * @param string $alias The alias of the join table.
467
+     * @param string $condition The condition for the join.
468
+     *
469
+     * @return $this This QueryBuilder instance.
470
+     * @since 8.2.0
471
+     */
472
+    public function innerJoin($fromAlias, $join, $alias, $condition = null);
473
+
474
+    /**
475
+     * Creates and adds a left join to the query.
476
+     *
477
+     * <code>
478
+     *     $qb = $conn->getQueryBuilder()
479
+     *         ->select('u.name')
480
+     *         ->from('users', 'u')
481
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
482
+     * </code>
483
+     *
484
+     * @param string $fromAlias The alias that points to a from clause.
485
+     * @param string $join The table name to join.
486
+     * @param string $alias The alias of the join table.
487
+     * @param string $condition The condition for the join.
488
+     *
489
+     * @return $this This QueryBuilder instance.
490
+     * @since 8.2.0
491
+     */
492
+    public function leftJoin($fromAlias, $join, $alias, $condition = null);
493
+
494
+    /**
495
+     * Creates and adds a right join to the query.
496
+     *
497
+     * <code>
498
+     *     $qb = $conn->getQueryBuilder()
499
+     *         ->select('u.name')
500
+     *         ->from('users', 'u')
501
+     *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
502
+     * </code>
503
+     *
504
+     * @param string $fromAlias The alias that points to a from clause.
505
+     * @param string $join The table name to join.
506
+     * @param string $alias The alias of the join table.
507
+     * @param string $condition The condition for the join.
508
+     *
509
+     * @return $this This QueryBuilder instance.
510
+     * @since 8.2.0
511
+     */
512
+    public function rightJoin($fromAlias, $join, $alias, $condition = null);
513
+
514
+    /**
515
+     * Sets a new value for a column in a bulk update query.
516
+     *
517
+     * <code>
518
+     *     $qb = $conn->getQueryBuilder()
519
+     *         ->update('users', 'u')
520
+     *         ->set('u.password', md5('password'))
521
+     *         ->where('u.id = ?');
522
+     * </code>
523
+     *
524
+     * @param string $key The column to set.
525
+     * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
526
+     *
527
+     * @return $this This QueryBuilder instance.
528
+     * @since 8.2.0
529
+     */
530
+    public function set($key, $value);
531
+
532
+    /**
533
+     * Specifies one or more restrictions to the query result.
534
+     * Replaces any previously specified restrictions, if any.
535
+     *
536
+     * <code>
537
+     *     $qb = $conn->getQueryBuilder()
538
+     *         ->select('u.name')
539
+     *         ->from('users', 'u')
540
+     *         ->where('u.id = ?');
541
+     *
542
+     *     // You can optionally programatically build and/or expressions
543
+     *     $qb = $conn->getQueryBuilder();
544
+     *
545
+     *     $or = $qb->expr()->orx();
546
+     *     $or->add($qb->expr()->eq('u.id', 1));
547
+     *     $or->add($qb->expr()->eq('u.id', 2));
548
+     *
549
+     *     $qb->update('users', 'u')
550
+     *         ->set('u.password', md5('password'))
551
+     *         ->where($or);
552
+     * </code>
553
+     *
554
+     * @param mixed $predicates The restriction predicates.
555
+     *
556
+     * @return $this This QueryBuilder instance.
557
+     * @since 8.2.0
558
+     */
559
+    public function where(...$predicates);
560
+
561
+    /**
562
+     * Adds one or more restrictions to the query results, forming a logical
563
+     * conjunction with any previously specified restrictions.
564
+     *
565
+     * <code>
566
+     *     $qb = $conn->getQueryBuilder()
567
+     *         ->select('u')
568
+     *         ->from('users', 'u')
569
+     *         ->where('u.username LIKE ?')
570
+     *         ->andWhere('u.is_active = 1');
571
+     * </code>
572
+     *
573
+     * @param mixed ...$where The query restrictions.
574
+     *
575
+     * @return $this This QueryBuilder instance.
576
+     *
577
+     * @see where()
578
+     * @since 8.2.0
579
+     */
580
+    public function andWhere(...$where);
581
+
582
+    /**
583
+     * Adds one or more restrictions to the query results, forming a logical
584
+     * disjunction with any previously specified restrictions.
585
+     *
586
+     * <code>
587
+     *     $qb = $conn->getQueryBuilder()
588
+     *         ->select('u.name')
589
+     *         ->from('users', 'u')
590
+     *         ->where('u.id = 1')
591
+     *         ->orWhere('u.id = 2');
592
+     * </code>
593
+     *
594
+     * @param mixed ...$where The WHERE statement.
595
+     *
596
+     * @return $this This QueryBuilder instance.
597
+     *
598
+     * @see where()
599
+     * @since 8.2.0
600
+     */
601
+    public function orWhere(...$where);
602
+
603
+    /**
604
+     * Specifies a grouping over the results of the query.
605
+     * Replaces any previously specified groupings, if any.
606
+     *
607
+     * <code>
608
+     *     $qb = $conn->getQueryBuilder()
609
+     *         ->select('u.name')
610
+     *         ->from('users', 'u')
611
+     *         ->groupBy('u.id');
612
+     * </code>
613
+     *
614
+     * @param mixed ...$groupBys The grouping expression.
615
+     *
616
+     * @return $this This QueryBuilder instance.
617
+     * @since 8.2.0
618
+     */
619
+    public function groupBy(...$groupBys);
620
+
621
+    /**
622
+     * Adds a grouping expression to the query.
623
+     *
624
+     * <code>
625
+     *     $qb = $conn->getQueryBuilder()
626
+     *         ->select('u.name')
627
+     *         ->from('users', 'u')
628
+     *         ->groupBy('u.lastLogin');
629
+     *         ->addGroupBy('u.createdAt')
630
+     * </code>
631
+     *
632
+     * @param mixed ...$groupBy The grouping expression.
633
+     *
634
+     * @return $this This QueryBuilder instance.
635
+     * @since 8.2.0
636
+     */
637
+    public function addGroupBy(...$groupBy);
638
+
639
+    /**
640
+     * Sets a value for a column in an insert query.
641
+     *
642
+     * <code>
643
+     *     $qb = $conn->getQueryBuilder()
644
+     *         ->insert('users')
645
+     *         ->values(
646
+     *             array(
647
+     *                 'name' => '?'
648
+     *             )
649
+     *         )
650
+     *         ->setValue('password', '?');
651
+     * </code>
652
+     *
653
+     * @param string $column The column into which the value should be inserted.
654
+     * @param IParameter|string $value The value that should be inserted into the column.
655
+     *
656
+     * @return $this This QueryBuilder instance.
657
+     * @since 8.2.0
658
+     */
659
+    public function setValue($column, $value);
660
+
661
+    /**
662
+     * Specifies values for an insert query indexed by column names.
663
+     * Replaces any previous values, if any.
664
+     *
665
+     * <code>
666
+     *     $qb = $conn->getQueryBuilder()
667
+     *         ->insert('users')
668
+     *         ->values(
669
+     *             array(
670
+     *                 'name' => '?',
671
+     *                 'password' => '?'
672
+     *             )
673
+     *         );
674
+     * </code>
675
+     *
676
+     * @param array $values The values to specify for the insert query indexed by column names.
677
+     *
678
+     * @return $this This QueryBuilder instance.
679
+     * @since 8.2.0
680
+     */
681
+    public function values(array $values);
682
+
683
+    /**
684
+     * Specifies a restriction over the groups of the query.
685
+     * Replaces any previous having restrictions, if any.
686
+     *
687
+     * @param mixed ...$having The restriction over the groups.
688
+     *
689
+     * @return $this This QueryBuilder instance.
690
+     * @since 8.2.0
691
+     */
692
+    public function having(...$having);
693
+
694
+    /**
695
+     * Adds a restriction over the groups of the query, forming a logical
696
+     * conjunction with any existing having restrictions.
697
+     *
698
+     * @param mixed ...$having The restriction to append.
699
+     *
700
+     * @return $this This QueryBuilder instance.
701
+     * @since 8.2.0
702
+     */
703
+    public function andHaving(...$having);
704
+
705
+    /**
706
+     * Adds a restriction over the groups of the query, forming a logical
707
+     * disjunction with any existing having restrictions.
708
+     *
709
+     * @param mixed ...$having The restriction to add.
710
+     *
711
+     * @return $this This QueryBuilder instance.
712
+     * @since 8.2.0
713
+     */
714
+    public function orHaving(...$having);
715
+
716
+    /**
717
+     * Specifies an ordering for the query results.
718
+     * Replaces any previously specified orderings, if any.
719
+     *
720
+     * @param string $sort The ordering expression.
721
+     * @param string $order The ordering direction.
722
+     *
723
+     * @return $this This QueryBuilder instance.
724
+     * @since 8.2.0
725
+     */
726
+    public function orderBy($sort, $order = null);
727
+
728
+    /**
729
+     * Adds an ordering to the query results.
730
+     *
731
+     * @param string $sort The ordering expression.
732
+     * @param string $order The ordering direction.
733
+     *
734
+     * @return $this This QueryBuilder instance.
735
+     * @since 8.2.0
736
+     */
737
+    public function addOrderBy($sort, $order = null);
738
+
739
+    /**
740
+     * Gets a query part by its name.
741
+     *
742
+     * @param string $queryPartName
743
+     *
744
+     * @return mixed
745
+     * @since 8.2.0
746
+     */
747
+    public function getQueryPart($queryPartName);
748
+
749
+    /**
750
+     * Gets all query parts.
751
+     *
752
+     * @return array
753
+     * @since 8.2.0
754
+     */
755
+    public function getQueryParts();
756
+
757
+    /**
758
+     * Resets SQL parts.
759
+     *
760
+     * @param array|null $queryPartNames
761
+     *
762
+     * @return $this This QueryBuilder instance.
763
+     * @since 8.2.0
764
+     */
765
+    public function resetQueryParts($queryPartNames = null);
766
+
767
+    /**
768
+     * Resets a single SQL part.
769
+     *
770
+     * @param string $queryPartName
771
+     *
772
+     * @return $this This QueryBuilder instance.
773
+     * @since 8.2.0
774
+     */
775
+    public function resetQueryPart($queryPartName);
776
+
777
+    /**
778
+     * Creates a new named parameter and bind the value $value to it.
779
+     *
780
+     * This method provides a shortcut for PDOStatement::bindValue
781
+     * when using prepared statements.
782
+     *
783
+     * The parameter $value specifies the value that you want to bind. If
784
+     * $placeholder is not provided bindValue() will automatically create a
785
+     * placeholder for you. An automatic placeholder will be of the name
786
+     * ':dcValue1', ':dcValue2' etc.
787
+     *
788
+     * For more information see {@link https://www.php.net/pdostatement-bindparam}
789
+     *
790
+     * Example:
791
+     * <code>
792
+     * $value = 2;
793
+     * $q->eq( 'id', $q->bindValue( $value ) );
794
+     * $stmt = $q->executeQuery(); // executed with 'id = 2'
795
+     * </code>
796
+     *
797
+     * @license New BSD License
798
+     * @link http://www.zetacomponents.org
799
+     *
800
+     * @param mixed $value
801
+     * @param mixed $type
802
+     * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
803
+     *
804
+     * @return IParameter
805
+     * @since 8.2.0
806
+     */
807
+    public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null);
808
+
809
+    /**
810
+     * Creates a new positional parameter and bind the given value to it.
811
+     *
812
+     * Attention: If you are using positional parameters with the query builder you have
813
+     * to be very careful to bind all parameters in the order they appear in the SQL
814
+     * statement , otherwise they get bound in the wrong order which can lead to serious
815
+     * bugs in your code.
816
+     *
817
+     * Example:
818
+     * <code>
819
+     *  $qb = $conn->getQueryBuilder();
820
+     *  $qb->select('u.*')
821
+     *     ->from('users', 'u')
822
+     *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
823
+     *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
824
+     * </code>
825
+     *
826
+     * @param mixed $value
827
+     * @param integer $type
828
+     *
829
+     * @return IParameter
830
+     * @since 8.2.0
831
+     */
832
+    public function createPositionalParameter($value, $type = self::PARAM_STR);
833
+
834
+    /**
835
+     * Creates a new parameter
836
+     *
837
+     * Example:
838
+     * <code>
839
+     *  $qb = $conn->getQueryBuilder();
840
+     *  $qb->select('u.*')
841
+     *     ->from('users', 'u')
842
+     *     ->where('u.username = ' . $qb->createParameter('name'))
843
+     *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
844
+     * </code>
845
+     *
846
+     * @param string $name
847
+     *
848
+     * @return IParameter
849
+     * @since 8.2.0
850
+     */
851
+    public function createParameter($name);
852
+
853
+    /**
854
+     * Creates a new function
855
+     *
856
+     * Attention: Column names inside the call have to be quoted before hand
857
+     *
858
+     * Example:
859
+     * <code>
860
+     *  $qb = $conn->getQueryBuilder();
861
+     *  $qb->select($qb->createFunction('COUNT(*)'))
862
+     *     ->from('users', 'u')
863
+     *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
864
+     * </code>
865
+     * <code>
866
+     *  $qb = $conn->getQueryBuilder();
867
+     *  $qb->select($qb->createFunction('COUNT(`column`)'))
868
+     *     ->from('users', 'u')
869
+     *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
870
+     * </code>
871
+     *
872
+     * @param string $call
873
+     *
874
+     * @return IQueryFunction
875
+     * @since 8.2.0
876
+     */
877
+    public function createFunction($call);
878
+
879
+    /**
880
+     * Used to get the id of the last inserted element
881
+     * @return int
882
+     * @throws \BadMethodCallException When being called before an insert query has been run.
883
+     * @since 9.0.0
884
+     */
885
+    public function getLastInsertId();
886
+
887
+    /**
888
+     * Returns the table name quoted and with database prefix as needed by the implementation
889
+     *
890
+     * @param string $table
891
+     * @return string
892
+     * @since 9.0.0
893
+     */
894
+    public function getTableName($table);
895
+
896
+    /**
897
+     * Returns the column name quoted and with table alias prefix as needed by the implementation
898
+     *
899
+     * @param string $column
900
+     * @param string $tableAlias
901
+     * @return string
902
+     * @since 9.0.0
903
+     */
904
+    public function getColumnName($column, $tableAlias = '');
905 905
 }
Please login to merge, or discard this patch.
lib/public/Files/Storage/IStorage.php 1 patch
Indentation   +411 added lines, -411 removed lines patch added patch discarded remove patch
@@ -47,415 +47,415 @@
 block discarded – undo
47 47
  * @since 9.0.0
48 48
  */
49 49
 interface IStorage {
50
-	/**
51
-	 * $parameters is a free form array with the configuration options needed to construct the storage
52
-	 *
53
-	 * @param array $parameters
54
-	 * @since 9.0.0
55
-	 */
56
-	public function __construct($parameters);
57
-
58
-	/**
59
-	 * Get the identifier for the storage,
60
-	 * the returned id should be the same for every storage object that is created with the same parameters
61
-	 * and two storage objects with the same id should refer to two storages that display the same files.
62
-	 *
63
-	 * @return string
64
-	 * @since 9.0.0
65
-	 */
66
-	public function getId();
67
-
68
-	/**
69
-	 * see https://www.php.net/manual/en/function.mkdir.php
70
-	 * implementations need to implement a recursive mkdir
71
-	 *
72
-	 * @param string $path
73
-	 * @return bool
74
-	 * @since 9.0.0
75
-	 */
76
-	public function mkdir($path);
77
-
78
-	/**
79
-	 * see https://www.php.net/manual/en/function.rmdir.php
80
-	 *
81
-	 * @param string $path
82
-	 * @return bool
83
-	 * @since 9.0.0
84
-	 */
85
-	public function rmdir($path);
86
-
87
-	/**
88
-	 * see https://www.php.net/manual/en/function.opendir.php
89
-	 *
90
-	 * @param string $path
91
-	 * @return resource|false
92
-	 * @since 9.0.0
93
-	 */
94
-	public function opendir($path);
95
-
96
-	/**
97
-	 * see https://www.php.net/manual/en/function.is-dir.php
98
-	 *
99
-	 * @param string $path
100
-	 * @return bool
101
-	 * @since 9.0.0
102
-	 */
103
-	public function is_dir($path);
104
-
105
-	/**
106
-	 * see https://www.php.net/manual/en/function.is-file.php
107
-	 *
108
-	 * @param string $path
109
-	 * @return bool
110
-	 * @since 9.0.0
111
-	 */
112
-	public function is_file($path);
113
-
114
-	/**
115
-	 * see https://www.php.net/manual/en/function.stat.php
116
-	 * only the following keys are required in the result: size and mtime
117
-	 *
118
-	 * @param string $path
119
-	 * @return array|false
120
-	 * @since 9.0.0
121
-	 */
122
-	public function stat($path);
123
-
124
-	/**
125
-	 * see https://www.php.net/manual/en/function.filetype.php
126
-	 *
127
-	 * @param string $path
128
-	 * @return string|false
129
-	 * @since 9.0.0
130
-	 */
131
-	public function filetype($path);
132
-
133
-	/**
134
-	 * see https://www.php.net/manual/en/function.filesize.php
135
-	 * The result for filesize when called on a folder is required to be 0
136
-	 *
137
-	 * @param string $path
138
-	 * @return int|false
139
-	 * @since 9.0.0
140
-	 */
141
-	public function filesize($path);
142
-
143
-	/**
144
-	 * check if a file can be created in $path
145
-	 *
146
-	 * @param string $path
147
-	 * @return bool
148
-	 * @since 9.0.0
149
-	 */
150
-	public function isCreatable($path);
151
-
152
-	/**
153
-	 * check if a file can be read
154
-	 *
155
-	 * @param string $path
156
-	 * @return bool
157
-	 * @since 9.0.0
158
-	 */
159
-	public function isReadable($path);
160
-
161
-	/**
162
-	 * check if a file can be written to
163
-	 *
164
-	 * @param string $path
165
-	 * @return bool
166
-	 * @since 9.0.0
167
-	 */
168
-	public function isUpdatable($path);
169
-
170
-	/**
171
-	 * check if a file can be deleted
172
-	 *
173
-	 * @param string $path
174
-	 * @return bool
175
-	 * @since 9.0.0
176
-	 */
177
-	public function isDeletable($path);
178
-
179
-	/**
180
-	 * check if a file can be shared
181
-	 *
182
-	 * @param string $path
183
-	 * @return bool
184
-	 * @since 9.0.0
185
-	 */
186
-	public function isSharable($path);
187
-
188
-	/**
189
-	 * get the full permissions of a path.
190
-	 * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
191
-	 *
192
-	 * @param string $path
193
-	 * @return int
194
-	 * @since 9.0.0
195
-	 */
196
-	public function getPermissions($path);
197
-
198
-	/**
199
-	 * see https://www.php.net/manual/en/function.file_exists.php
200
-	 *
201
-	 * @param string $path
202
-	 * @return bool
203
-	 * @since 9.0.0
204
-	 */
205
-	public function file_exists($path);
206
-
207
-	/**
208
-	 * see https://www.php.net/manual/en/function.filemtime.php
209
-	 *
210
-	 * @param string $path
211
-	 * @return int|false
212
-	 * @since 9.0.0
213
-	 */
214
-	public function filemtime($path);
215
-
216
-	/**
217
-	 * see https://www.php.net/manual/en/function.file_get_contents.php
218
-	 *
219
-	 * @param string $path
220
-	 * @return string|false
221
-	 * @since 9.0.0
222
-	 */
223
-	public function file_get_contents($path);
224
-
225
-	/**
226
-	 * see https://www.php.net/manual/en/function.file_put_contents.php
227
-	 *
228
-	 * @param string $path
229
-	 * @param mixed $data
230
-	 * @return int|false
231
-	 * @since 9.0.0
232
-	 */
233
-	public function file_put_contents($path, $data);
234
-
235
-	/**
236
-	 * see https://www.php.net/manual/en/function.unlink.php
237
-	 *
238
-	 * @param string $path
239
-	 * @return bool
240
-	 * @since 9.0.0
241
-	 */
242
-	public function unlink($path);
243
-
244
-	/**
245
-	 * see https://www.php.net/manual/en/function.rename.php
246
-	 *
247
-	 * @param string $path1
248
-	 * @param string $path2
249
-	 * @return bool
250
-	 * @since 9.0.0
251
-	 */
252
-	public function rename($path1, $path2);
253
-
254
-	/**
255
-	 * see https://www.php.net/manual/en/function.copy.php
256
-	 *
257
-	 * @param string $path1
258
-	 * @param string $path2
259
-	 * @return bool
260
-	 * @since 9.0.0
261
-	 */
262
-	public function copy($path1, $path2);
263
-
264
-	/**
265
-	 * see https://www.php.net/manual/en/function.fopen.php
266
-	 *
267
-	 * @param string $path
268
-	 * @param string $mode
269
-	 * @return resource|false
270
-	 * @since 9.0.0
271
-	 */
272
-	public function fopen($path, $mode);
273
-
274
-	/**
275
-	 * get the mimetype for a file or folder
276
-	 * The mimetype for a folder is required to be "httpd/unix-directory"
277
-	 *
278
-	 * @param string $path
279
-	 * @return string|false
280
-	 * @since 9.0.0
281
-	 */
282
-	public function getMimeType($path);
283
-
284
-	/**
285
-	 * see https://www.php.net/manual/en/function.hash-file.php
286
-	 *
287
-	 * @param string $type
288
-	 * @param string $path
289
-	 * @param bool $raw
290
-	 * @return string|false
291
-	 * @since 9.0.0
292
-	 */
293
-	public function hash($type, $path, $raw = false);
294
-
295
-	/**
296
-	 * see https://www.php.net/manual/en/function.free_space.php
297
-	 *
298
-	 * @param string $path
299
-	 * @return int|false
300
-	 * @since 9.0.0
301
-	 */
302
-	public function free_space($path);
303
-
304
-	/**
305
-	 * see https://www.php.net/manual/en/function.touch.php
306
-	 * If the backend does not support the operation, false should be returned
307
-	 *
308
-	 * @param string $path
309
-	 * @param int $mtime
310
-	 * @return bool
311
-	 * @since 9.0.0
312
-	 */
313
-	public function touch($path, $mtime = null);
314
-
315
-	/**
316
-	 * get the path to a local version of the file.
317
-	 * The local version of the file can be temporary and doesn't have to be persistent across requests
318
-	 *
319
-	 * @param string $path
320
-	 * @return string|false
321
-	 * @since 9.0.0
322
-	 */
323
-	public function getLocalFile($path);
324
-
325
-	/**
326
-	 * check if a file or folder has been updated since $time
327
-	 *
328
-	 * @param string $path
329
-	 * @param int $time
330
-	 * @return bool
331
-	 * @since 9.0.0
332
-	 *
333
-	 * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
334
-	 * returning true for other changes in the folder is optional
335
-	 */
336
-	public function hasUpdated($path, $time);
337
-
338
-	/**
339
-	 * get the ETag for a file or folder
340
-	 *
341
-	 * @param string $path
342
-	 * @return string|false
343
-	 * @since 9.0.0
344
-	 */
345
-	public function getETag($path);
346
-
347
-	/**
348
-	 * Returns whether the storage is local, which means that files
349
-	 * are stored on the local filesystem instead of remotely.
350
-	 * Calling getLocalFile() for local storages should always
351
-	 * return the local files, whereas for non-local storages
352
-	 * it might return a temporary file.
353
-	 *
354
-	 * @return bool true if the files are stored locally, false otherwise
355
-	 * @since 9.0.0
356
-	 */
357
-	public function isLocal();
358
-
359
-	/**
360
-	 * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
361
-	 *
362
-	 * @param string $class
363
-	 * @return bool
364
-	 * @since 9.0.0
365
-	 */
366
-	public function instanceOfStorage($class);
367
-
368
-	/**
369
-	 * A custom storage implementation can return an url for direct download of a give file.
370
-	 *
371
-	 * For now the returned array can hold the parameter url - in future more attributes might follow.
372
-	 *
373
-	 * @param string $path
374
-	 * @return array|false
375
-	 * @since 9.0.0
376
-	 */
377
-	public function getDirectDownload($path);
378
-
379
-	/**
380
-	 * @param string $path the path of the target folder
381
-	 * @param string $fileName the name of the file itself
382
-	 * @return void
383
-	 * @throws InvalidPathException
384
-	 * @since 9.0.0
385
-	 */
386
-	public function verifyPath($path, $fileName);
387
-
388
-	/**
389
-	 * @param IStorage $sourceStorage
390
-	 * @param string $sourceInternalPath
391
-	 * @param string $targetInternalPath
392
-	 * @return bool
393
-	 * @since 9.0.0
394
-	 */
395
-	public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
396
-
397
-	/**
398
-	 * @param IStorage $sourceStorage
399
-	 * @param string $sourceInternalPath
400
-	 * @param string $targetInternalPath
401
-	 * @return bool
402
-	 * @since 9.0.0
403
-	 */
404
-	public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
405
-
406
-	/**
407
-	 * Test a storage for availability
408
-	 *
409
-	 * @since 9.0.0
410
-	 * @return bool
411
-	 */
412
-	public function test();
413
-
414
-	/**
415
-	 * @since 9.0.0
416
-	 * @return array [ available, last_checked ]
417
-	 */
418
-	public function getAvailability();
419
-
420
-	/**
421
-	 * @since 9.0.0
422
-	 * @param bool $isAvailable
423
-	 */
424
-	public function setAvailability($isAvailable);
425
-
426
-	/**
427
-	 * @param string $path path for which to retrieve the owner
428
-	 * @since 9.0.0
429
-	 */
430
-	public function getOwner($path);
431
-
432
-	/**
433
-	 * @return ICache
434
-	 * @since 9.0.0
435
-	 */
436
-	public function getCache();
437
-
438
-	/**
439
-	 * @return IPropagator
440
-	 * @since 9.0.0
441
-	 */
442
-	public function getPropagator();
443
-
444
-	/**
445
-	 * @return IScanner
446
-	 * @since 9.0.0
447
-	 */
448
-	public function getScanner();
449
-
450
-	/**
451
-	 * @return IUpdater
452
-	 * @since 9.0.0
453
-	 */
454
-	public function getUpdater();
455
-
456
-	/**
457
-	 * @return IWatcher
458
-	 * @since 9.0.0
459
-	 */
460
-	public function getWatcher();
50
+    /**
51
+     * $parameters is a free form array with the configuration options needed to construct the storage
52
+     *
53
+     * @param array $parameters
54
+     * @since 9.0.0
55
+     */
56
+    public function __construct($parameters);
57
+
58
+    /**
59
+     * Get the identifier for the storage,
60
+     * the returned id should be the same for every storage object that is created with the same parameters
61
+     * and two storage objects with the same id should refer to two storages that display the same files.
62
+     *
63
+     * @return string
64
+     * @since 9.0.0
65
+     */
66
+    public function getId();
67
+
68
+    /**
69
+     * see https://www.php.net/manual/en/function.mkdir.php
70
+     * implementations need to implement a recursive mkdir
71
+     *
72
+     * @param string $path
73
+     * @return bool
74
+     * @since 9.0.0
75
+     */
76
+    public function mkdir($path);
77
+
78
+    /**
79
+     * see https://www.php.net/manual/en/function.rmdir.php
80
+     *
81
+     * @param string $path
82
+     * @return bool
83
+     * @since 9.0.0
84
+     */
85
+    public function rmdir($path);
86
+
87
+    /**
88
+     * see https://www.php.net/manual/en/function.opendir.php
89
+     *
90
+     * @param string $path
91
+     * @return resource|false
92
+     * @since 9.0.0
93
+     */
94
+    public function opendir($path);
95
+
96
+    /**
97
+     * see https://www.php.net/manual/en/function.is-dir.php
98
+     *
99
+     * @param string $path
100
+     * @return bool
101
+     * @since 9.0.0
102
+     */
103
+    public function is_dir($path);
104
+
105
+    /**
106
+     * see https://www.php.net/manual/en/function.is-file.php
107
+     *
108
+     * @param string $path
109
+     * @return bool
110
+     * @since 9.0.0
111
+     */
112
+    public function is_file($path);
113
+
114
+    /**
115
+     * see https://www.php.net/manual/en/function.stat.php
116
+     * only the following keys are required in the result: size and mtime
117
+     *
118
+     * @param string $path
119
+     * @return array|false
120
+     * @since 9.0.0
121
+     */
122
+    public function stat($path);
123
+
124
+    /**
125
+     * see https://www.php.net/manual/en/function.filetype.php
126
+     *
127
+     * @param string $path
128
+     * @return string|false
129
+     * @since 9.0.0
130
+     */
131
+    public function filetype($path);
132
+
133
+    /**
134
+     * see https://www.php.net/manual/en/function.filesize.php
135
+     * The result for filesize when called on a folder is required to be 0
136
+     *
137
+     * @param string $path
138
+     * @return int|false
139
+     * @since 9.0.0
140
+     */
141
+    public function filesize($path);
142
+
143
+    /**
144
+     * check if a file can be created in $path
145
+     *
146
+     * @param string $path
147
+     * @return bool
148
+     * @since 9.0.0
149
+     */
150
+    public function isCreatable($path);
151
+
152
+    /**
153
+     * check if a file can be read
154
+     *
155
+     * @param string $path
156
+     * @return bool
157
+     * @since 9.0.0
158
+     */
159
+    public function isReadable($path);
160
+
161
+    /**
162
+     * check if a file can be written to
163
+     *
164
+     * @param string $path
165
+     * @return bool
166
+     * @since 9.0.0
167
+     */
168
+    public function isUpdatable($path);
169
+
170
+    /**
171
+     * check if a file can be deleted
172
+     *
173
+     * @param string $path
174
+     * @return bool
175
+     * @since 9.0.0
176
+     */
177
+    public function isDeletable($path);
178
+
179
+    /**
180
+     * check if a file can be shared
181
+     *
182
+     * @param string $path
183
+     * @return bool
184
+     * @since 9.0.0
185
+     */
186
+    public function isSharable($path);
187
+
188
+    /**
189
+     * get the full permissions of a path.
190
+     * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
191
+     *
192
+     * @param string $path
193
+     * @return int
194
+     * @since 9.0.0
195
+     */
196
+    public function getPermissions($path);
197
+
198
+    /**
199
+     * see https://www.php.net/manual/en/function.file_exists.php
200
+     *
201
+     * @param string $path
202
+     * @return bool
203
+     * @since 9.0.0
204
+     */
205
+    public function file_exists($path);
206
+
207
+    /**
208
+     * see https://www.php.net/manual/en/function.filemtime.php
209
+     *
210
+     * @param string $path
211
+     * @return int|false
212
+     * @since 9.0.0
213
+     */
214
+    public function filemtime($path);
215
+
216
+    /**
217
+     * see https://www.php.net/manual/en/function.file_get_contents.php
218
+     *
219
+     * @param string $path
220
+     * @return string|false
221
+     * @since 9.0.0
222
+     */
223
+    public function file_get_contents($path);
224
+
225
+    /**
226
+     * see https://www.php.net/manual/en/function.file_put_contents.php
227
+     *
228
+     * @param string $path
229
+     * @param mixed $data
230
+     * @return int|false
231
+     * @since 9.0.0
232
+     */
233
+    public function file_put_contents($path, $data);
234
+
235
+    /**
236
+     * see https://www.php.net/manual/en/function.unlink.php
237
+     *
238
+     * @param string $path
239
+     * @return bool
240
+     * @since 9.0.0
241
+     */
242
+    public function unlink($path);
243
+
244
+    /**
245
+     * see https://www.php.net/manual/en/function.rename.php
246
+     *
247
+     * @param string $path1
248
+     * @param string $path2
249
+     * @return bool
250
+     * @since 9.0.0
251
+     */
252
+    public function rename($path1, $path2);
253
+
254
+    /**
255
+     * see https://www.php.net/manual/en/function.copy.php
256
+     *
257
+     * @param string $path1
258
+     * @param string $path2
259
+     * @return bool
260
+     * @since 9.0.0
261
+     */
262
+    public function copy($path1, $path2);
263
+
264
+    /**
265
+     * see https://www.php.net/manual/en/function.fopen.php
266
+     *
267
+     * @param string $path
268
+     * @param string $mode
269
+     * @return resource|false
270
+     * @since 9.0.0
271
+     */
272
+    public function fopen($path, $mode);
273
+
274
+    /**
275
+     * get the mimetype for a file or folder
276
+     * The mimetype for a folder is required to be "httpd/unix-directory"
277
+     *
278
+     * @param string $path
279
+     * @return string|false
280
+     * @since 9.0.0
281
+     */
282
+    public function getMimeType($path);
283
+
284
+    /**
285
+     * see https://www.php.net/manual/en/function.hash-file.php
286
+     *
287
+     * @param string $type
288
+     * @param string $path
289
+     * @param bool $raw
290
+     * @return string|false
291
+     * @since 9.0.0
292
+     */
293
+    public function hash($type, $path, $raw = false);
294
+
295
+    /**
296
+     * see https://www.php.net/manual/en/function.free_space.php
297
+     *
298
+     * @param string $path
299
+     * @return int|false
300
+     * @since 9.0.0
301
+     */
302
+    public function free_space($path);
303
+
304
+    /**
305
+     * see https://www.php.net/manual/en/function.touch.php
306
+     * If the backend does not support the operation, false should be returned
307
+     *
308
+     * @param string $path
309
+     * @param int $mtime
310
+     * @return bool
311
+     * @since 9.0.0
312
+     */
313
+    public function touch($path, $mtime = null);
314
+
315
+    /**
316
+     * get the path to a local version of the file.
317
+     * The local version of the file can be temporary and doesn't have to be persistent across requests
318
+     *
319
+     * @param string $path
320
+     * @return string|false
321
+     * @since 9.0.0
322
+     */
323
+    public function getLocalFile($path);
324
+
325
+    /**
326
+     * check if a file or folder has been updated since $time
327
+     *
328
+     * @param string $path
329
+     * @param int $time
330
+     * @return bool
331
+     * @since 9.0.0
332
+     *
333
+     * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
334
+     * returning true for other changes in the folder is optional
335
+     */
336
+    public function hasUpdated($path, $time);
337
+
338
+    /**
339
+     * get the ETag for a file or folder
340
+     *
341
+     * @param string $path
342
+     * @return string|false
343
+     * @since 9.0.0
344
+     */
345
+    public function getETag($path);
346
+
347
+    /**
348
+     * Returns whether the storage is local, which means that files
349
+     * are stored on the local filesystem instead of remotely.
350
+     * Calling getLocalFile() for local storages should always
351
+     * return the local files, whereas for non-local storages
352
+     * it might return a temporary file.
353
+     *
354
+     * @return bool true if the files are stored locally, false otherwise
355
+     * @since 9.0.0
356
+     */
357
+    public function isLocal();
358
+
359
+    /**
360
+     * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
361
+     *
362
+     * @param string $class
363
+     * @return bool
364
+     * @since 9.0.0
365
+     */
366
+    public function instanceOfStorage($class);
367
+
368
+    /**
369
+     * A custom storage implementation can return an url for direct download of a give file.
370
+     *
371
+     * For now the returned array can hold the parameter url - in future more attributes might follow.
372
+     *
373
+     * @param string $path
374
+     * @return array|false
375
+     * @since 9.0.0
376
+     */
377
+    public function getDirectDownload($path);
378
+
379
+    /**
380
+     * @param string $path the path of the target folder
381
+     * @param string $fileName the name of the file itself
382
+     * @return void
383
+     * @throws InvalidPathException
384
+     * @since 9.0.0
385
+     */
386
+    public function verifyPath($path, $fileName);
387
+
388
+    /**
389
+     * @param IStorage $sourceStorage
390
+     * @param string $sourceInternalPath
391
+     * @param string $targetInternalPath
392
+     * @return bool
393
+     * @since 9.0.0
394
+     */
395
+    public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
396
+
397
+    /**
398
+     * @param IStorage $sourceStorage
399
+     * @param string $sourceInternalPath
400
+     * @param string $targetInternalPath
401
+     * @return bool
402
+     * @since 9.0.0
403
+     */
404
+    public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
405
+
406
+    /**
407
+     * Test a storage for availability
408
+     *
409
+     * @since 9.0.0
410
+     * @return bool
411
+     */
412
+    public function test();
413
+
414
+    /**
415
+     * @since 9.0.0
416
+     * @return array [ available, last_checked ]
417
+     */
418
+    public function getAvailability();
419
+
420
+    /**
421
+     * @since 9.0.0
422
+     * @param bool $isAvailable
423
+     */
424
+    public function setAvailability($isAvailable);
425
+
426
+    /**
427
+     * @param string $path path for which to retrieve the owner
428
+     * @since 9.0.0
429
+     */
430
+    public function getOwner($path);
431
+
432
+    /**
433
+     * @return ICache
434
+     * @since 9.0.0
435
+     */
436
+    public function getCache();
437
+
438
+    /**
439
+     * @return IPropagator
440
+     * @since 9.0.0
441
+     */
442
+    public function getPropagator();
443
+
444
+    /**
445
+     * @return IScanner
446
+     * @since 9.0.0
447
+     */
448
+    public function getScanner();
449
+
450
+    /**
451
+     * @return IUpdater
452
+     * @since 9.0.0
453
+     */
454
+    public function getUpdater();
455
+
456
+    /**
457
+     * @return IWatcher
458
+     * @since 9.0.0
459
+     */
460
+    public function getWatcher();
461 461
 }
Please login to merge, or discard this patch.
lib/public/Files/Storage.php 1 patch
Indentation   +413 added lines, -413 removed lines patch added patch discarded remove patch
@@ -51,417 +51,417 @@
 block discarded – undo
51 51
  * @deprecated 9.0.0 use \OCP\Files\Storage\IStorage instead
52 52
  */
53 53
 interface Storage extends IStorage {
54
-	/**
55
-	 * $parameters is a free form array with the configuration options needed to construct the storage
56
-	 *
57
-	 * @param array $parameters
58
-	 * @since 6.0.0
59
-	 */
60
-	public function __construct($parameters);
61
-
62
-	/**
63
-	 * Get the identifier for the storage,
64
-	 * the returned id should be the same for every storage object that is created with the same parameters
65
-	 * and two storage objects with the same id should refer to two storages that display the same files.
66
-	 *
67
-	 * @return string
68
-	 * @since 6.0.0
69
-	 */
70
-	public function getId();
71
-
72
-	/**
73
-	 * see https://www.php.net/manual/en/function.mkdir.php
74
-	 * implementations need to implement a recursive mkdir
75
-	 *
76
-	 * @param string $path
77
-	 * @return bool
78
-	 * @since 6.0.0
79
-	 */
80
-	public function mkdir($path);
81
-
82
-	/**
83
-	 * see https://www.php.net/manual/en/function.rmdir.php
84
-	 *
85
-	 * @param string $path
86
-	 * @return bool
87
-	 * @since 6.0.0
88
-	 */
89
-	public function rmdir($path);
90
-
91
-	/**
92
-	 * see https://www.php.net/manual/en/function.opendir.php
93
-	 *
94
-	 * @param string $path
95
-	 * @return resource|false
96
-	 * @since 6.0.0
97
-	 */
98
-	public function opendir($path);
99
-
100
-	/**
101
-	 * see https://www.php.net/manual/en/function.is-dir.php
102
-	 *
103
-	 * @param string $path
104
-	 * @return bool
105
-	 * @since 6.0.0
106
-	 */
107
-	public function is_dir($path);
108
-
109
-	/**
110
-	 * see https://www.php.net/manual/en/function.is-file.php
111
-	 *
112
-	 * @param string $path
113
-	 * @return bool
114
-	 * @since 6.0.0
115
-	 */
116
-	public function is_file($path);
117
-
118
-	/**
119
-	 * see https://www.php.net/manual/en/function.stat.php
120
-	 * only the following keys are required in the result: size and mtime
121
-	 *
122
-	 * @param string $path
123
-	 * @return array|false
124
-	 * @since 6.0.0
125
-	 */
126
-	public function stat($path);
127
-
128
-	/**
129
-	 * see https://www.php.net/manual/en/function.filetype.php
130
-	 *
131
-	 * @param string $path
132
-	 * @return string|false
133
-	 * @since 6.0.0
134
-	 */
135
-	public function filetype($path);
136
-
137
-	/**
138
-	 * see https://www.php.net/manual/en/function.filesize.php
139
-	 * The result for filesize when called on a folder is required to be 0
140
-	 *
141
-	 * @param string $path
142
-	 * @return int|false
143
-	 * @since 6.0.0
144
-	 */
145
-	public function filesize($path);
146
-
147
-	/**
148
-	 * check if a file can be created in $path
149
-	 *
150
-	 * @param string $path
151
-	 * @return bool
152
-	 * @since 6.0.0
153
-	 */
154
-	public function isCreatable($path);
155
-
156
-	/**
157
-	 * check if a file can be read
158
-	 *
159
-	 * @param string $path
160
-	 * @return bool
161
-	 * @since 6.0.0
162
-	 */
163
-	public function isReadable($path);
164
-
165
-	/**
166
-	 * check if a file can be written to
167
-	 *
168
-	 * @param string $path
169
-	 * @return bool
170
-	 * @since 6.0.0
171
-	 */
172
-	public function isUpdatable($path);
173
-
174
-	/**
175
-	 * check if a file can be deleted
176
-	 *
177
-	 * @param string $path
178
-	 * @return bool
179
-	 * @since 6.0.0
180
-	 */
181
-	public function isDeletable($path);
182
-
183
-	/**
184
-	 * check if a file can be shared
185
-	 *
186
-	 * @param string $path
187
-	 * @return bool
188
-	 * @since 6.0.0
189
-	 */
190
-	public function isSharable($path);
191
-
192
-	/**
193
-	 * get the full permissions of a path.
194
-	 * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
195
-	 *
196
-	 * @param string $path
197
-	 * @return int
198
-	 * @since 6.0.0
199
-	 */
200
-	public function getPermissions($path);
201
-
202
-	/**
203
-	 * see https://www.php.net/manual/en/function.file_exists.php
204
-	 *
205
-	 * @param string $path
206
-	 * @return bool
207
-	 * @since 6.0.0
208
-	 */
209
-	public function file_exists($path);
210
-
211
-	/**
212
-	 * see https://www.php.net/manual/en/function.filemtime.php
213
-	 *
214
-	 * @param string $path
215
-	 * @return int|false
216
-	 * @since 6.0.0
217
-	 */
218
-	public function filemtime($path);
219
-
220
-	/**
221
-	 * see https://www.php.net/manual/en/function.file_get_contents.php
222
-	 *
223
-	 * @param string $path
224
-	 * @return string|false
225
-	 * @since 6.0.0
226
-	 */
227
-	public function file_get_contents($path);
228
-
229
-	/**
230
-	 * see https://www.php.net/manual/en/function.file_put_contents.php
231
-	 *
232
-	 * @param string $path
233
-	 * @param mixed $data
234
-	 * @return int|false
235
-	 * @since 6.0.0
236
-	 */
237
-	public function file_put_contents($path, $data);
238
-
239
-	/**
240
-	 * see https://www.php.net/manual/en/function.unlink.php
241
-	 *
242
-	 * @param string $path
243
-	 * @return bool
244
-	 * @since 6.0.0
245
-	 */
246
-	public function unlink($path);
247
-
248
-	/**
249
-	 * see https://www.php.net/manual/en/function.rename.php
250
-	 *
251
-	 * @param string $path1
252
-	 * @param string $path2
253
-	 * @return bool
254
-	 * @since 6.0.0
255
-	 */
256
-	public function rename($path1, $path2);
257
-
258
-	/**
259
-	 * see https://www.php.net/manual/en/function.copy.php
260
-	 *
261
-	 * @param string $path1
262
-	 * @param string $path2
263
-	 * @return bool
264
-	 * @since 6.0.0
265
-	 */
266
-	public function copy($path1, $path2);
267
-
268
-	/**
269
-	 * see https://www.php.net/manual/en/function.fopen.php
270
-	 *
271
-	 * @param string $path
272
-	 * @param string $mode
273
-	 * @return resource|false
274
-	 * @since 6.0.0
275
-	 */
276
-	public function fopen($path, $mode);
277
-
278
-	/**
279
-	 * get the mimetype for a file or folder
280
-	 * The mimetype for a folder is required to be "httpd/unix-directory"
281
-	 *
282
-	 * @param string $path
283
-	 * @return string|false
284
-	 * @since 6.0.0
285
-	 */
286
-	public function getMimeType($path);
287
-
288
-	/**
289
-	 * see https://www.php.net/manual/en/function.hash-file.php
290
-	 *
291
-	 * @param string $type
292
-	 * @param string $path
293
-	 * @param bool $raw
294
-	 * @return string|false
295
-	 * @since 6.0.0
296
-	 */
297
-	public function hash($type, $path, $raw = false);
298
-
299
-	/**
300
-	 * see https://www.php.net/manual/en/function.free_space.php
301
-	 *
302
-	 * @param string $path
303
-	 * @return int|false
304
-	 * @since 6.0.0
305
-	 */
306
-	public function free_space($path);
307
-
308
-	/**
309
-	 * search for occurrences of $query in file names
310
-	 *
311
-	 * @param string $query
312
-	 * @return array|false
313
-	 * @since 6.0.0
314
-	 */
315
-	public function search($query);
316
-
317
-	/**
318
-	 * see https://www.php.net/manual/en/function.touch.php
319
-	 * If the backend does not support the operation, false should be returned
320
-	 *
321
-	 * @param string $path
322
-	 * @param int $mtime
323
-	 * @return bool
324
-	 * @since 6.0.0
325
-	 */
326
-	public function touch($path, $mtime = null);
327
-
328
-	/**
329
-	 * get the path to a local version of the file.
330
-	 * The local version of the file can be temporary and doesn't have to be persistent across requests
331
-	 *
332
-	 * @param string $path
333
-	 * @return string|false
334
-	 * @since 6.0.0
335
-	 */
336
-	public function getLocalFile($path);
337
-
338
-	/**
339
-	 * check if a file or folder has been updated since $time
340
-	 *
341
-	 * @param string $path
342
-	 * @param int $time
343
-	 * @return bool
344
-	 * @since 6.0.0
345
-	 *
346
-	 * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
347
-	 * returning true for other changes in the folder is optional
348
-	 */
349
-	public function hasUpdated($path, $time);
350
-
351
-	/**
352
-	 * get the ETag for a file or folder
353
-	 *
354
-	 * @param string $path
355
-	 * @return string|false
356
-	 * @since 6.0.0
357
-	 */
358
-	public function getETag($path);
359
-
360
-	/**
361
-	 * Returns whether the storage is local, which means that files
362
-	 * are stored on the local filesystem instead of remotely.
363
-	 * Calling getLocalFile() for local storages should always
364
-	 * return the local files, whereas for non-local storages
365
-	 * it might return a temporary file.
366
-	 *
367
-	 * @return bool true if the files are stored locally, false otherwise
368
-	 * @since 7.0.0
369
-	 */
370
-	public function isLocal();
371
-
372
-	/**
373
-	 * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
374
-	 *
375
-	 * @param string $class
376
-	 * @return bool
377
-	 * @since 7.0.0
378
-	 */
379
-	public function instanceOfStorage($class);
380
-
381
-	/**
382
-	 * A custom storage implementation can return an url for direct download of a give file.
383
-	 *
384
-	 * For now the returned array can hold the parameter url - in future more attributes might follow.
385
-	 *
386
-	 * @param string $path
387
-	 * @return array|false
388
-	 * @since 8.0.0
389
-	 */
390
-	public function getDirectDownload($path);
391
-
392
-	/**
393
-	 * @param string $path the path of the target folder
394
-	 * @param string $fileName the name of the file itself
395
-	 * @return void
396
-	 * @throws InvalidPathException
397
-	 * @since 8.1.0
398
-	 */
399
-	public function verifyPath($path, $fileName);
400
-
401
-	/**
402
-	 * @param IStorage $sourceStorage
403
-	 * @param string $sourceInternalPath
404
-	 * @param string $targetInternalPath
405
-	 * @return bool
406
-	 * @since 8.1.0
407
-	 */
408
-	public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
409
-
410
-	/**
411
-	 * @param IStorage $sourceStorage
412
-	 * @param string $sourceInternalPath
413
-	 * @param string $targetInternalPath
414
-	 * @return bool
415
-	 * @since 8.1.0
416
-	 */
417
-	public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
418
-
419
-	/**
420
-	 * @param string $path The path of the file to acquire the lock for
421
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
422
-	 * @param \OCP\Lock\ILockingProvider $provider
423
-	 * @throws \OCP\Lock\LockedException
424
-	 * @since 8.1.0
425
-	 */
426
-	public function acquireLock($path, $type, ILockingProvider $provider);
427
-
428
-	/**
429
-	 * @param string $path The path of the file to acquire the lock for
430
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
431
-	 * @param \OCP\Lock\ILockingProvider $provider
432
-	 * @throws \OCP\Lock\LockedException
433
-	 * @since 8.1.0
434
-	 */
435
-	public function releaseLock($path, $type, ILockingProvider $provider);
436
-
437
-	/**
438
-	 * @param string $path The path of the file to change the lock for
439
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
440
-	 * @param \OCP\Lock\ILockingProvider $provider
441
-	 * @throws \OCP\Lock\LockedException
442
-	 * @since 8.1.0
443
-	 */
444
-	public function changeLock($path, $type, ILockingProvider $provider);
445
-
446
-	/**
447
-	 * Test a storage for availability
448
-	 *
449
-	 * @since 8.2.0
450
-	 * @return bool
451
-	 */
452
-	public function test();
453
-
454
-	/**
455
-	 * @since 8.2.0
456
-	 * @return array [ available, last_checked ]
457
-	 */
458
-	public function getAvailability();
459
-
460
-	/**
461
-	 * @since 8.2.0
462
-	 * @param bool $isAvailable
463
-	 */
464
-	public function setAvailability($isAvailable);
465
-
466
-	public function needsPartFile();
54
+    /**
55
+     * $parameters is a free form array with the configuration options needed to construct the storage
56
+     *
57
+     * @param array $parameters
58
+     * @since 6.0.0
59
+     */
60
+    public function __construct($parameters);
61
+
62
+    /**
63
+     * Get the identifier for the storage,
64
+     * the returned id should be the same for every storage object that is created with the same parameters
65
+     * and two storage objects with the same id should refer to two storages that display the same files.
66
+     *
67
+     * @return string
68
+     * @since 6.0.0
69
+     */
70
+    public function getId();
71
+
72
+    /**
73
+     * see https://www.php.net/manual/en/function.mkdir.php
74
+     * implementations need to implement a recursive mkdir
75
+     *
76
+     * @param string $path
77
+     * @return bool
78
+     * @since 6.0.0
79
+     */
80
+    public function mkdir($path);
81
+
82
+    /**
83
+     * see https://www.php.net/manual/en/function.rmdir.php
84
+     *
85
+     * @param string $path
86
+     * @return bool
87
+     * @since 6.0.0
88
+     */
89
+    public function rmdir($path);
90
+
91
+    /**
92
+     * see https://www.php.net/manual/en/function.opendir.php
93
+     *
94
+     * @param string $path
95
+     * @return resource|false
96
+     * @since 6.0.0
97
+     */
98
+    public function opendir($path);
99
+
100
+    /**
101
+     * see https://www.php.net/manual/en/function.is-dir.php
102
+     *
103
+     * @param string $path
104
+     * @return bool
105
+     * @since 6.0.0
106
+     */
107
+    public function is_dir($path);
108
+
109
+    /**
110
+     * see https://www.php.net/manual/en/function.is-file.php
111
+     *
112
+     * @param string $path
113
+     * @return bool
114
+     * @since 6.0.0
115
+     */
116
+    public function is_file($path);
117
+
118
+    /**
119
+     * see https://www.php.net/manual/en/function.stat.php
120
+     * only the following keys are required in the result: size and mtime
121
+     *
122
+     * @param string $path
123
+     * @return array|false
124
+     * @since 6.0.0
125
+     */
126
+    public function stat($path);
127
+
128
+    /**
129
+     * see https://www.php.net/manual/en/function.filetype.php
130
+     *
131
+     * @param string $path
132
+     * @return string|false
133
+     * @since 6.0.0
134
+     */
135
+    public function filetype($path);
136
+
137
+    /**
138
+     * see https://www.php.net/manual/en/function.filesize.php
139
+     * The result for filesize when called on a folder is required to be 0
140
+     *
141
+     * @param string $path
142
+     * @return int|false
143
+     * @since 6.0.0
144
+     */
145
+    public function filesize($path);
146
+
147
+    /**
148
+     * check if a file can be created in $path
149
+     *
150
+     * @param string $path
151
+     * @return bool
152
+     * @since 6.0.0
153
+     */
154
+    public function isCreatable($path);
155
+
156
+    /**
157
+     * check if a file can be read
158
+     *
159
+     * @param string $path
160
+     * @return bool
161
+     * @since 6.0.0
162
+     */
163
+    public function isReadable($path);
164
+
165
+    /**
166
+     * check if a file can be written to
167
+     *
168
+     * @param string $path
169
+     * @return bool
170
+     * @since 6.0.0
171
+     */
172
+    public function isUpdatable($path);
173
+
174
+    /**
175
+     * check if a file can be deleted
176
+     *
177
+     * @param string $path
178
+     * @return bool
179
+     * @since 6.0.0
180
+     */
181
+    public function isDeletable($path);
182
+
183
+    /**
184
+     * check if a file can be shared
185
+     *
186
+     * @param string $path
187
+     * @return bool
188
+     * @since 6.0.0
189
+     */
190
+    public function isSharable($path);
191
+
192
+    /**
193
+     * get the full permissions of a path.
194
+     * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
195
+     *
196
+     * @param string $path
197
+     * @return int
198
+     * @since 6.0.0
199
+     */
200
+    public function getPermissions($path);
201
+
202
+    /**
203
+     * see https://www.php.net/manual/en/function.file_exists.php
204
+     *
205
+     * @param string $path
206
+     * @return bool
207
+     * @since 6.0.0
208
+     */
209
+    public function file_exists($path);
210
+
211
+    /**
212
+     * see https://www.php.net/manual/en/function.filemtime.php
213
+     *
214
+     * @param string $path
215
+     * @return int|false
216
+     * @since 6.0.0
217
+     */
218
+    public function filemtime($path);
219
+
220
+    /**
221
+     * see https://www.php.net/manual/en/function.file_get_contents.php
222
+     *
223
+     * @param string $path
224
+     * @return string|false
225
+     * @since 6.0.0
226
+     */
227
+    public function file_get_contents($path);
228
+
229
+    /**
230
+     * see https://www.php.net/manual/en/function.file_put_contents.php
231
+     *
232
+     * @param string $path
233
+     * @param mixed $data
234
+     * @return int|false
235
+     * @since 6.0.0
236
+     */
237
+    public function file_put_contents($path, $data);
238
+
239
+    /**
240
+     * see https://www.php.net/manual/en/function.unlink.php
241
+     *
242
+     * @param string $path
243
+     * @return bool
244
+     * @since 6.0.0
245
+     */
246
+    public function unlink($path);
247
+
248
+    /**
249
+     * see https://www.php.net/manual/en/function.rename.php
250
+     *
251
+     * @param string $path1
252
+     * @param string $path2
253
+     * @return bool
254
+     * @since 6.0.0
255
+     */
256
+    public function rename($path1, $path2);
257
+
258
+    /**
259
+     * see https://www.php.net/manual/en/function.copy.php
260
+     *
261
+     * @param string $path1
262
+     * @param string $path2
263
+     * @return bool
264
+     * @since 6.0.0
265
+     */
266
+    public function copy($path1, $path2);
267
+
268
+    /**
269
+     * see https://www.php.net/manual/en/function.fopen.php
270
+     *
271
+     * @param string $path
272
+     * @param string $mode
273
+     * @return resource|false
274
+     * @since 6.0.0
275
+     */
276
+    public function fopen($path, $mode);
277
+
278
+    /**
279
+     * get the mimetype for a file or folder
280
+     * The mimetype for a folder is required to be "httpd/unix-directory"
281
+     *
282
+     * @param string $path
283
+     * @return string|false
284
+     * @since 6.0.0
285
+     */
286
+    public function getMimeType($path);
287
+
288
+    /**
289
+     * see https://www.php.net/manual/en/function.hash-file.php
290
+     *
291
+     * @param string $type
292
+     * @param string $path
293
+     * @param bool $raw
294
+     * @return string|false
295
+     * @since 6.0.0
296
+     */
297
+    public function hash($type, $path, $raw = false);
298
+
299
+    /**
300
+     * see https://www.php.net/manual/en/function.free_space.php
301
+     *
302
+     * @param string $path
303
+     * @return int|false
304
+     * @since 6.0.0
305
+     */
306
+    public function free_space($path);
307
+
308
+    /**
309
+     * search for occurrences of $query in file names
310
+     *
311
+     * @param string $query
312
+     * @return array|false
313
+     * @since 6.0.0
314
+     */
315
+    public function search($query);
316
+
317
+    /**
318
+     * see https://www.php.net/manual/en/function.touch.php
319
+     * If the backend does not support the operation, false should be returned
320
+     *
321
+     * @param string $path
322
+     * @param int $mtime
323
+     * @return bool
324
+     * @since 6.0.0
325
+     */
326
+    public function touch($path, $mtime = null);
327
+
328
+    /**
329
+     * get the path to a local version of the file.
330
+     * The local version of the file can be temporary and doesn't have to be persistent across requests
331
+     *
332
+     * @param string $path
333
+     * @return string|false
334
+     * @since 6.0.0
335
+     */
336
+    public function getLocalFile($path);
337
+
338
+    /**
339
+     * check if a file or folder has been updated since $time
340
+     *
341
+     * @param string $path
342
+     * @param int $time
343
+     * @return bool
344
+     * @since 6.0.0
345
+     *
346
+     * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
347
+     * returning true for other changes in the folder is optional
348
+     */
349
+    public function hasUpdated($path, $time);
350
+
351
+    /**
352
+     * get the ETag for a file or folder
353
+     *
354
+     * @param string $path
355
+     * @return string|false
356
+     * @since 6.0.0
357
+     */
358
+    public function getETag($path);
359
+
360
+    /**
361
+     * Returns whether the storage is local, which means that files
362
+     * are stored on the local filesystem instead of remotely.
363
+     * Calling getLocalFile() for local storages should always
364
+     * return the local files, whereas for non-local storages
365
+     * it might return a temporary file.
366
+     *
367
+     * @return bool true if the files are stored locally, false otherwise
368
+     * @since 7.0.0
369
+     */
370
+    public function isLocal();
371
+
372
+    /**
373
+     * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
374
+     *
375
+     * @param string $class
376
+     * @return bool
377
+     * @since 7.0.0
378
+     */
379
+    public function instanceOfStorage($class);
380
+
381
+    /**
382
+     * A custom storage implementation can return an url for direct download of a give file.
383
+     *
384
+     * For now the returned array can hold the parameter url - in future more attributes might follow.
385
+     *
386
+     * @param string $path
387
+     * @return array|false
388
+     * @since 8.0.0
389
+     */
390
+    public function getDirectDownload($path);
391
+
392
+    /**
393
+     * @param string $path the path of the target folder
394
+     * @param string $fileName the name of the file itself
395
+     * @return void
396
+     * @throws InvalidPathException
397
+     * @since 8.1.0
398
+     */
399
+    public function verifyPath($path, $fileName);
400
+
401
+    /**
402
+     * @param IStorage $sourceStorage
403
+     * @param string $sourceInternalPath
404
+     * @param string $targetInternalPath
405
+     * @return bool
406
+     * @since 8.1.0
407
+     */
408
+    public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
409
+
410
+    /**
411
+     * @param IStorage $sourceStorage
412
+     * @param string $sourceInternalPath
413
+     * @param string $targetInternalPath
414
+     * @return bool
415
+     * @since 8.1.0
416
+     */
417
+    public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
418
+
419
+    /**
420
+     * @param string $path The path of the file to acquire the lock for
421
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
422
+     * @param \OCP\Lock\ILockingProvider $provider
423
+     * @throws \OCP\Lock\LockedException
424
+     * @since 8.1.0
425
+     */
426
+    public function acquireLock($path, $type, ILockingProvider $provider);
427
+
428
+    /**
429
+     * @param string $path The path of the file to acquire the lock for
430
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
431
+     * @param \OCP\Lock\ILockingProvider $provider
432
+     * @throws \OCP\Lock\LockedException
433
+     * @since 8.1.0
434
+     */
435
+    public function releaseLock($path, $type, ILockingProvider $provider);
436
+
437
+    /**
438
+     * @param string $path The path of the file to change the lock for
439
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
440
+     * @param \OCP\Lock\ILockingProvider $provider
441
+     * @throws \OCP\Lock\LockedException
442
+     * @since 8.1.0
443
+     */
444
+    public function changeLock($path, $type, ILockingProvider $provider);
445
+
446
+    /**
447
+     * Test a storage for availability
448
+     *
449
+     * @since 8.2.0
450
+     * @return bool
451
+     */
452
+    public function test();
453
+
454
+    /**
455
+     * @since 8.2.0
456
+     * @return array [ available, last_checked ]
457
+     */
458
+    public function getAvailability();
459
+
460
+    /**
461
+     * @since 8.2.0
462
+     * @param bool $isAvailable
463
+     */
464
+    public function setAvailability($isAvailable);
465
+
466
+    public function needsPartFile();
467 467
 }
Please login to merge, or discard this patch.
lib/public/Util.php 1 patch
Indentation   +472 added lines, -472 removed lines patch added patch discarded remove patch
@@ -58,476 +58,476 @@
 block discarded – undo
58 58
  * @since 4.0.0
59 59
  */
60 60
 class Util {
61
-	/**
62
-	 * @deprecated 14.0.0 use \OCP\ILogger::DEBUG
63
-	 */
64
-	public const DEBUG = 0;
65
-	/**
66
-	 * @deprecated 14.0.0 use \OCP\ILogger::INFO
67
-	 */
68
-	public const INFO = 1;
69
-	/**
70
-	 * @deprecated 14.0.0 use \OCP\ILogger::WARN
71
-	 */
72
-	public const WARN = 2;
73
-	/**
74
-	 * @deprecated 14.0.0 use \OCP\ILogger::ERROR
75
-	 */
76
-	public const ERROR = 3;
77
-	/**
78
-	 * @deprecated 14.0.0 use \OCP\ILogger::FATAL
79
-	 */
80
-	public const FATAL = 4;
81
-
82
-	/** \OCP\Share\IManager */
83
-	private static $shareManager;
84
-
85
-	/**
86
-	 * get the current installed version of Nextcloud
87
-	 * @return array
88
-	 * @since 4.0.0
89
-	 */
90
-	public static function getVersion() {
91
-		return \OC_Util::getVersion();
92
-	}
93
-
94
-	/**
95
-	 * @since 17.0.0
96
-	 */
97
-	public static function hasExtendedSupport(): bool {
98
-		try {
99
-			/** @var \OCP\Support\Subscription\IRegistry */
100
-			$subscriptionRegistry = \OC::$server->query(\OCP\Support\Subscription\IRegistry::class);
101
-			return $subscriptionRegistry->delegateHasExtendedSupport();
102
-		} catch (AppFramework\QueryException $e) {
103
-		}
104
-		return \OC::$server->getConfig()->getSystemValueBool('extendedSupport', false);
105
-	}
106
-
107
-	/**
108
-	 * Set current update channel
109
-	 * @param string $channel
110
-	 * @since 8.1.0
111
-	 */
112
-	public static function setChannel($channel) {
113
-		\OC::$server->getConfig()->setSystemValue('updater.release.channel', $channel);
114
-	}
115
-
116
-	/**
117
-	 * Get current update channel
118
-	 * @return string
119
-	 * @since 8.1.0
120
-	 */
121
-	public static function getChannel() {
122
-		return \OC_Util::getChannel();
123
-	}
124
-
125
-	/**
126
-	 * write a message in the log
127
-	 * @param string $app
128
-	 * @param string $message
129
-	 * @param int $level
130
-	 * @since 4.0.0
131
-	 * @deprecated 13.0.0 use log of \OCP\ILogger
132
-	 */
133
-	public static function writeLog($app, $message, $level) {
134
-		$context = ['app' => $app];
135
-		\OC::$server->getLogger()->log($level, $message, $context);
136
-	}
137
-
138
-	/**
139
-	 * check if sharing is disabled for the current user
140
-	 *
141
-	 * @return boolean
142
-	 * @since 7.0.0
143
-	 * @deprecated 9.1.0 Use \OC::$server->getShareManager()->sharingDisabledForUser
144
-	 */
145
-	public static function isSharingDisabledForUser() {
146
-		if (self::$shareManager === null) {
147
-			self::$shareManager = \OC::$server->getShareManager();
148
-		}
149
-
150
-		$user = \OC::$server->getUserSession()->getUser();
151
-		if ($user !== null) {
152
-			$user = $user->getUID();
153
-		}
154
-
155
-		return self::$shareManager->sharingDisabledForUser($user);
156
-	}
157
-
158
-	/**
159
-	 * get l10n object
160
-	 * @param string $application
161
-	 * @param string|null $language
162
-	 * @return \OCP\IL10N
163
-	 * @since 6.0.0 - parameter $language was added in 8.0.0
164
-	 */
165
-	public static function getL10N($application, $language = null) {
166
-		return \OC::$server->getL10N($application, $language);
167
-	}
168
-
169
-	/**
170
-	 * add a css file
171
-	 * @param string $application
172
-	 * @param string $file
173
-	 * @since 4.0.0
174
-	 */
175
-	public static function addStyle($application, $file = null) {
176
-		\OC_Util::addStyle($application, $file);
177
-	}
178
-
179
-	/**
180
-	 * add a javascript file
181
-	 * @param string $application
182
-	 * @param string $file
183
-	 * @since 4.0.0
184
-	 */
185
-	public static function addScript($application, $file = null) {
186
-		\OC_Util::addScript($application, $file);
187
-	}
188
-
189
-	/**
190
-	 * Add a translation JS file
191
-	 * @param string $application application id
192
-	 * @param string $languageCode language code, defaults to the current locale
193
-	 * @since 8.0.0
194
-	 */
195
-	public static function addTranslations($application, $languageCode = null) {
196
-		\OC_Util::addTranslations($application, $languageCode);
197
-	}
198
-
199
-	/**
200
-	 * Add a custom element to the header
201
-	 * If $text is null then the element will be written as empty element.
202
-	 * So use "" to get a closing tag.
203
-	 * @param string $tag tag name of the element
204
-	 * @param array $attributes array of attributes for the element
205
-	 * @param string $text the text content for the element
206
-	 * @since 4.0.0
207
-	 */
208
-	public static function addHeader($tag, $attributes, $text = null) {
209
-		\OC_Util::addHeader($tag, $attributes, $text);
210
-	}
211
-
212
-	/**
213
-	 * Creates an absolute url to the given app and file.
214
-	 * @param string $app app
215
-	 * @param string $file file
216
-	 * @param array $args array with param=>value, will be appended to the returned url
217
-	 * 	The value of $args will be urlencoded
218
-	 * @return string the url
219
-	 * @since 4.0.0 - parameter $args was added in 4.5.0
220
-	 */
221
-	public static function linkToAbsolute($app, $file, $args = []) {
222
-		$urlGenerator = \OC::$server->getURLGenerator();
223
-		return $urlGenerator->getAbsoluteURL(
224
-			$urlGenerator->linkTo($app, $file, $args)
225
-		);
226
-	}
227
-
228
-	/**
229
-	 * Creates an absolute url for remote use.
230
-	 * @param string $service id
231
-	 * @return string the url
232
-	 * @since 4.0.0
233
-	 */
234
-	public static function linkToRemote($service) {
235
-		$urlGenerator = \OC::$server->getURLGenerator();
236
-		$remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service;
237
-		return $urlGenerator->getAbsoluteURL(
238
-			$remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '')
239
-		);
240
-	}
241
-
242
-	/**
243
-	 * Creates an absolute url for public use
244
-	 * @param string $service id
245
-	 * @return string the url
246
-	 * @since 4.5.0
247
-	 * @deprecated 15.0.0 - use OCP\IURLGenerator
248
-	 */
249
-	public static function linkToPublic($service) {
250
-		$urlGenerator = \OC::$server->getURLGenerator();
251
-		if ($service === 'files') {
252
-			return $urlGenerator->getAbsoluteURL('/s');
253
-		}
254
-		return $urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'public.php').'?service='.$service);
255
-	}
256
-
257
-	/**
258
-	 * Returns the server host name without an eventual port number
259
-	 * @return string the server hostname
260
-	 * @since 5.0.0
261
-	 */
262
-	public static function getServerHostName() {
263
-		$host_name = \OC::$server->getRequest()->getServerHost();
264
-		// strip away port number (if existing)
265
-		$colon_pos = strpos($host_name, ':');
266
-		if ($colon_pos != false) {
267
-			$host_name = substr($host_name, 0, $colon_pos);
268
-		}
269
-		return $host_name;
270
-	}
271
-
272
-	/**
273
-	 * Returns the default email address
274
-	 * @param string $user_part the user part of the address
275
-	 * @return string the default email address
276
-	 *
277
-	 * Assembles a default email address (using the server hostname
278
-	 * and the given user part, and returns it
279
-	 * Example: when given lostpassword-noreply as $user_part param,
280
-	 *     and is currently accessed via http(s)://example.com/,
281
-	 *     it would return '[email protected]'
282
-	 *
283
-	 * If the configuration value 'mail_from_address' is set in
284
-	 * config.php, this value will override the $user_part that
285
-	 * is passed to this function
286
-	 * @since 5.0.0
287
-	 */
288
-	public static function getDefaultEmailAddress($user_part) {
289
-		$config = \OC::$server->getConfig();
290
-		$user_part = $config->getSystemValue('mail_from_address', $user_part);
291
-		$host_name = self::getServerHostName();
292
-		$host_name = $config->getSystemValue('mail_domain', $host_name);
293
-		$defaultEmailAddress = $user_part.'@'.$host_name;
294
-
295
-		$mailer = \OC::$server->getMailer();
296
-		if ($mailer->validateMailAddress($defaultEmailAddress)) {
297
-			return $defaultEmailAddress;
298
-		}
299
-
300
-		// in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain'
301
-		return $user_part.'@localhost.localdomain';
302
-	}
303
-
304
-	/**
305
-	 * Make a human file size (2048 to 2 kB)
306
-	 * @param int $bytes file size in bytes
307
-	 * @return string a human readable file size
308
-	 * @since 4.0.0
309
-	 */
310
-	public static function humanFileSize($bytes) {
311
-		return \OC_Helper::humanFileSize($bytes);
312
-	}
313
-
314
-	/**
315
-	 * Make a computer file size (2 kB to 2048)
316
-	 * @param string $str file size in a fancy format
317
-	 * @return float a file size in bytes
318
-	 *
319
-	 * Inspired by: https://www.php.net/manual/en/function.filesize.php#92418
320
-	 * @since 4.0.0
321
-	 */
322
-	public static function computerFileSize($str) {
323
-		return \OC_Helper::computerFileSize($str);
324
-	}
325
-
326
-	/**
327
-	 * connects a function to a hook
328
-	 *
329
-	 * @param string $signalClass class name of emitter
330
-	 * @param string $signalName name of signal
331
-	 * @param string|object $slotClass class name of slot
332
-	 * @param string $slotName name of slot
333
-	 * @return bool
334
-	 *
335
-	 * This function makes it very easy to connect to use hooks.
336
-	 *
337
-	 * TODO: write example
338
-	 * @since 4.0.0
339
-	 * @deprecated 21.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
340
-	 */
341
-	public static function connectHook($signalClass, $signalName, $slotClass, $slotName) {
342
-		return \OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName);
343
-	}
344
-
345
-	/**
346
-	 * Emits a signal. To get data from the slot use references!
347
-	 * @param string $signalclass class name of emitter
348
-	 * @param string $signalname name of signal
349
-	 * @param array $params default: array() array with additional data
350
-	 * @return bool true if slots exists or false if not
351
-	 *
352
-	 * TODO: write example
353
-	 * @since 4.0.0
354
-	 * @deprecated 21.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTypedEvent
355
-	 */
356
-	public static function emitHook($signalclass, $signalname, $params = []) {
357
-		return \OC_Hook::emit($signalclass, $signalname, $params);
358
-	}
359
-
360
-	/**
361
-	 * Cached encrypted CSRF token. Some static unit-tests of ownCloud compare
362
-	 * multiple OC_Template elements which invoke `callRegister`. If the value
363
-	 * would not be cached these unit-tests would fail.
364
-	 * @var string
365
-	 */
366
-	private static $token = '';
367
-
368
-	/**
369
-	 * Register an get/post call. This is important to prevent CSRF attacks
370
-	 * @since 4.5.0
371
-	 */
372
-	public static function callRegister() {
373
-		if (self::$token === '') {
374
-			self::$token = \OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue();
375
-		}
376
-		return self::$token;
377
-	}
378
-
379
-	/**
380
-	 * Used to sanitize HTML
381
-	 *
382
-	 * This function is used to sanitize HTML and should be applied on any
383
-	 * string or array of strings before displaying it on a web page.
384
-	 *
385
-	 * @param string|array $value
386
-	 * @return string|array an array of sanitized strings or a single sanitized string, depends on the input parameter.
387
-	 * @since 4.5.0
388
-	 */
389
-	public static function sanitizeHTML($value) {
390
-		return \OC_Util::sanitizeHTML($value);
391
-	}
392
-
393
-	/**
394
-	 * Public function to encode url parameters
395
-	 *
396
-	 * This function is used to encode path to file before output.
397
-	 * Encoding is done according to RFC 3986 with one exception:
398
-	 * Character '/' is preserved as is.
399
-	 *
400
-	 * @param string $component part of URI to encode
401
-	 * @return string
402
-	 * @since 6.0.0
403
-	 */
404
-	public static function encodePath($component) {
405
-		return \OC_Util::encodePath($component);
406
-	}
407
-
408
-	/**
409
-	 * Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.
410
-	 *
411
-	 * @param array $input The array to work on
412
-	 * @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default)
413
-	 * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
414
-	 * @return array
415
-	 * @since 4.5.0
416
-	 */
417
-	public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') {
418
-		return \OC_Helper::mb_array_change_key_case($input, $case, $encoding);
419
-	}
420
-
421
-	/**
422
-	 * performs a search in a nested array
423
-	 *
424
-	 * @param array $haystack the array to be searched
425
-	 * @param string $needle the search string
426
-	 * @param mixed $index optional, only search this key name
427
-	 * @return mixed the key of the matching field, otherwise false
428
-	 * @since 4.5.0
429
-	 * @deprecated 15.0.0
430
-	 */
431
-	public static function recursiveArraySearch($haystack, $needle, $index = null) {
432
-		return \OC_Helper::recursiveArraySearch($haystack, $needle, $index);
433
-	}
434
-
435
-	/**
436
-	 * calculates the maximum upload size respecting system settings, free space and user quota
437
-	 *
438
-	 * @param string $dir the current folder where the user currently operates
439
-	 * @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
440
-	 * @return int number of bytes representing
441
-	 * @since 5.0.0
442
-	 */
443
-	public static function maxUploadFilesize($dir, $free = null) {
444
-		return \OC_Helper::maxUploadFilesize($dir, $free);
445
-	}
446
-
447
-	/**
448
-	 * Calculate free space left within user quota
449
-	 * @param string $dir the current folder where the user currently operates
450
-	 * @return int number of bytes representing
451
-	 * @since 7.0.0
452
-	 */
453
-	public static function freeSpace($dir) {
454
-		return \OC_Helper::freeSpace($dir);
455
-	}
456
-
457
-	/**
458
-	 * Calculate PHP upload limit
459
-	 *
460
-	 * @return int number of bytes representing
461
-	 * @since 7.0.0
462
-	 */
463
-	public static function uploadLimit() {
464
-		return \OC_Helper::uploadLimit();
465
-	}
466
-
467
-	/**
468
-	 * Returns whether the given file name is valid
469
-	 * @param string $file file name to check
470
-	 * @return bool true if the file name is valid, false otherwise
471
-	 * @deprecated 8.1.0 use \OC\Files\View::verifyPath()
472
-	 * @since 7.0.0
473
-	 * @suppress PhanDeprecatedFunction
474
-	 */
475
-	public static function isValidFileName($file) {
476
-		return \OC_Util::isValidFileName($file);
477
-	}
478
-
479
-	/**
480
-	 * Compare two strings to provide a natural sort
481
-	 * @param string $a first string to compare
482
-	 * @param string $b second string to compare
483
-	 * @return int -1 if $b comes before $a, 1 if $a comes before $b
484
-	 * or 0 if the strings are identical
485
-	 * @since 7.0.0
486
-	 */
487
-	public static function naturalSortCompare($a, $b) {
488
-		return \OC\NaturalSort::getInstance()->compare($a, $b);
489
-	}
490
-
491
-	/**
492
-	 * check if a password is required for each public link
493
-	 * @return boolean
494
-	 * @since 7.0.0
495
-	 */
496
-	public static function isPublicLinkPasswordRequired() {
497
-		return \OC_Util::isPublicLinkPasswordRequired();
498
-	}
499
-
500
-	/**
501
-	 * check if share API enforces a default expire date
502
-	 * @return boolean
503
-	 * @since 8.0.0
504
-	 */
505
-	public static function isDefaultExpireDateEnforced() {
506
-		return \OC_Util::isDefaultExpireDateEnforced();
507
-	}
508
-
509
-	protected static $needUpgradeCache = null;
510
-
511
-	/**
512
-	 * Checks whether the current version needs upgrade.
513
-	 *
514
-	 * @return bool true if upgrade is needed, false otherwise
515
-	 * @since 7.0.0
516
-	 */
517
-	public static function needUpgrade() {
518
-		if (!isset(self::$needUpgradeCache)) {
519
-			self::$needUpgradeCache = \OC_Util::needUpgrade(\OC::$server->getSystemConfig());
520
-		}
521
-		return self::$needUpgradeCache;
522
-	}
523
-
524
-	/**
525
-	 * is this Internet explorer ?
526
-	 *
527
-	 * @return boolean
528
-	 * @since 14.0.0
529
-	 */
530
-	public static function isIe() {
531
-		return \OC_Util::isIe();
532
-	}
61
+    /**
62
+     * @deprecated 14.0.0 use \OCP\ILogger::DEBUG
63
+     */
64
+    public const DEBUG = 0;
65
+    /**
66
+     * @deprecated 14.0.0 use \OCP\ILogger::INFO
67
+     */
68
+    public const INFO = 1;
69
+    /**
70
+     * @deprecated 14.0.0 use \OCP\ILogger::WARN
71
+     */
72
+    public const WARN = 2;
73
+    /**
74
+     * @deprecated 14.0.0 use \OCP\ILogger::ERROR
75
+     */
76
+    public const ERROR = 3;
77
+    /**
78
+     * @deprecated 14.0.0 use \OCP\ILogger::FATAL
79
+     */
80
+    public const FATAL = 4;
81
+
82
+    /** \OCP\Share\IManager */
83
+    private static $shareManager;
84
+
85
+    /**
86
+     * get the current installed version of Nextcloud
87
+     * @return array
88
+     * @since 4.0.0
89
+     */
90
+    public static function getVersion() {
91
+        return \OC_Util::getVersion();
92
+    }
93
+
94
+    /**
95
+     * @since 17.0.0
96
+     */
97
+    public static function hasExtendedSupport(): bool {
98
+        try {
99
+            /** @var \OCP\Support\Subscription\IRegistry */
100
+            $subscriptionRegistry = \OC::$server->query(\OCP\Support\Subscription\IRegistry::class);
101
+            return $subscriptionRegistry->delegateHasExtendedSupport();
102
+        } catch (AppFramework\QueryException $e) {
103
+        }
104
+        return \OC::$server->getConfig()->getSystemValueBool('extendedSupport', false);
105
+    }
106
+
107
+    /**
108
+     * Set current update channel
109
+     * @param string $channel
110
+     * @since 8.1.0
111
+     */
112
+    public static function setChannel($channel) {
113
+        \OC::$server->getConfig()->setSystemValue('updater.release.channel', $channel);
114
+    }
115
+
116
+    /**
117
+     * Get current update channel
118
+     * @return string
119
+     * @since 8.1.0
120
+     */
121
+    public static function getChannel() {
122
+        return \OC_Util::getChannel();
123
+    }
124
+
125
+    /**
126
+     * write a message in the log
127
+     * @param string $app
128
+     * @param string $message
129
+     * @param int $level
130
+     * @since 4.0.0
131
+     * @deprecated 13.0.0 use log of \OCP\ILogger
132
+     */
133
+    public static function writeLog($app, $message, $level) {
134
+        $context = ['app' => $app];
135
+        \OC::$server->getLogger()->log($level, $message, $context);
136
+    }
137
+
138
+    /**
139
+     * check if sharing is disabled for the current user
140
+     *
141
+     * @return boolean
142
+     * @since 7.0.0
143
+     * @deprecated 9.1.0 Use \OC::$server->getShareManager()->sharingDisabledForUser
144
+     */
145
+    public static function isSharingDisabledForUser() {
146
+        if (self::$shareManager === null) {
147
+            self::$shareManager = \OC::$server->getShareManager();
148
+        }
149
+
150
+        $user = \OC::$server->getUserSession()->getUser();
151
+        if ($user !== null) {
152
+            $user = $user->getUID();
153
+        }
154
+
155
+        return self::$shareManager->sharingDisabledForUser($user);
156
+    }
157
+
158
+    /**
159
+     * get l10n object
160
+     * @param string $application
161
+     * @param string|null $language
162
+     * @return \OCP\IL10N
163
+     * @since 6.0.0 - parameter $language was added in 8.0.0
164
+     */
165
+    public static function getL10N($application, $language = null) {
166
+        return \OC::$server->getL10N($application, $language);
167
+    }
168
+
169
+    /**
170
+     * add a css file
171
+     * @param string $application
172
+     * @param string $file
173
+     * @since 4.0.0
174
+     */
175
+    public static function addStyle($application, $file = null) {
176
+        \OC_Util::addStyle($application, $file);
177
+    }
178
+
179
+    /**
180
+     * add a javascript file
181
+     * @param string $application
182
+     * @param string $file
183
+     * @since 4.0.0
184
+     */
185
+    public static function addScript($application, $file = null) {
186
+        \OC_Util::addScript($application, $file);
187
+    }
188
+
189
+    /**
190
+     * Add a translation JS file
191
+     * @param string $application application id
192
+     * @param string $languageCode language code, defaults to the current locale
193
+     * @since 8.0.0
194
+     */
195
+    public static function addTranslations($application, $languageCode = null) {
196
+        \OC_Util::addTranslations($application, $languageCode);
197
+    }
198
+
199
+    /**
200
+     * Add a custom element to the header
201
+     * If $text is null then the element will be written as empty element.
202
+     * So use "" to get a closing tag.
203
+     * @param string $tag tag name of the element
204
+     * @param array $attributes array of attributes for the element
205
+     * @param string $text the text content for the element
206
+     * @since 4.0.0
207
+     */
208
+    public static function addHeader($tag, $attributes, $text = null) {
209
+        \OC_Util::addHeader($tag, $attributes, $text);
210
+    }
211
+
212
+    /**
213
+     * Creates an absolute url to the given app and file.
214
+     * @param string $app app
215
+     * @param string $file file
216
+     * @param array $args array with param=>value, will be appended to the returned url
217
+     * 	The value of $args will be urlencoded
218
+     * @return string the url
219
+     * @since 4.0.0 - parameter $args was added in 4.5.0
220
+     */
221
+    public static function linkToAbsolute($app, $file, $args = []) {
222
+        $urlGenerator = \OC::$server->getURLGenerator();
223
+        return $urlGenerator->getAbsoluteURL(
224
+            $urlGenerator->linkTo($app, $file, $args)
225
+        );
226
+    }
227
+
228
+    /**
229
+     * Creates an absolute url for remote use.
230
+     * @param string $service id
231
+     * @return string the url
232
+     * @since 4.0.0
233
+     */
234
+    public static function linkToRemote($service) {
235
+        $urlGenerator = \OC::$server->getURLGenerator();
236
+        $remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service;
237
+        return $urlGenerator->getAbsoluteURL(
238
+            $remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '')
239
+        );
240
+    }
241
+
242
+    /**
243
+     * Creates an absolute url for public use
244
+     * @param string $service id
245
+     * @return string the url
246
+     * @since 4.5.0
247
+     * @deprecated 15.0.0 - use OCP\IURLGenerator
248
+     */
249
+    public static function linkToPublic($service) {
250
+        $urlGenerator = \OC::$server->getURLGenerator();
251
+        if ($service === 'files') {
252
+            return $urlGenerator->getAbsoluteURL('/s');
253
+        }
254
+        return $urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'public.php').'?service='.$service);
255
+    }
256
+
257
+    /**
258
+     * Returns the server host name without an eventual port number
259
+     * @return string the server hostname
260
+     * @since 5.0.0
261
+     */
262
+    public static function getServerHostName() {
263
+        $host_name = \OC::$server->getRequest()->getServerHost();
264
+        // strip away port number (if existing)
265
+        $colon_pos = strpos($host_name, ':');
266
+        if ($colon_pos != false) {
267
+            $host_name = substr($host_name, 0, $colon_pos);
268
+        }
269
+        return $host_name;
270
+    }
271
+
272
+    /**
273
+     * Returns the default email address
274
+     * @param string $user_part the user part of the address
275
+     * @return string the default email address
276
+     *
277
+     * Assembles a default email address (using the server hostname
278
+     * and the given user part, and returns it
279
+     * Example: when given lostpassword-noreply as $user_part param,
280
+     *     and is currently accessed via http(s)://example.com/,
281
+     *     it would return '[email protected]'
282
+     *
283
+     * If the configuration value 'mail_from_address' is set in
284
+     * config.php, this value will override the $user_part that
285
+     * is passed to this function
286
+     * @since 5.0.0
287
+     */
288
+    public static function getDefaultEmailAddress($user_part) {
289
+        $config = \OC::$server->getConfig();
290
+        $user_part = $config->getSystemValue('mail_from_address', $user_part);
291
+        $host_name = self::getServerHostName();
292
+        $host_name = $config->getSystemValue('mail_domain', $host_name);
293
+        $defaultEmailAddress = $user_part.'@'.$host_name;
294
+
295
+        $mailer = \OC::$server->getMailer();
296
+        if ($mailer->validateMailAddress($defaultEmailAddress)) {
297
+            return $defaultEmailAddress;
298
+        }
299
+
300
+        // in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain'
301
+        return $user_part.'@localhost.localdomain';
302
+    }
303
+
304
+    /**
305
+     * Make a human file size (2048 to 2 kB)
306
+     * @param int $bytes file size in bytes
307
+     * @return string a human readable file size
308
+     * @since 4.0.0
309
+     */
310
+    public static function humanFileSize($bytes) {
311
+        return \OC_Helper::humanFileSize($bytes);
312
+    }
313
+
314
+    /**
315
+     * Make a computer file size (2 kB to 2048)
316
+     * @param string $str file size in a fancy format
317
+     * @return float a file size in bytes
318
+     *
319
+     * Inspired by: https://www.php.net/manual/en/function.filesize.php#92418
320
+     * @since 4.0.0
321
+     */
322
+    public static function computerFileSize($str) {
323
+        return \OC_Helper::computerFileSize($str);
324
+    }
325
+
326
+    /**
327
+     * connects a function to a hook
328
+     *
329
+     * @param string $signalClass class name of emitter
330
+     * @param string $signalName name of signal
331
+     * @param string|object $slotClass class name of slot
332
+     * @param string $slotName name of slot
333
+     * @return bool
334
+     *
335
+     * This function makes it very easy to connect to use hooks.
336
+     *
337
+     * TODO: write example
338
+     * @since 4.0.0
339
+     * @deprecated 21.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
340
+     */
341
+    public static function connectHook($signalClass, $signalName, $slotClass, $slotName) {
342
+        return \OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName);
343
+    }
344
+
345
+    /**
346
+     * Emits a signal. To get data from the slot use references!
347
+     * @param string $signalclass class name of emitter
348
+     * @param string $signalname name of signal
349
+     * @param array $params default: array() array with additional data
350
+     * @return bool true if slots exists or false if not
351
+     *
352
+     * TODO: write example
353
+     * @since 4.0.0
354
+     * @deprecated 21.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTypedEvent
355
+     */
356
+    public static function emitHook($signalclass, $signalname, $params = []) {
357
+        return \OC_Hook::emit($signalclass, $signalname, $params);
358
+    }
359
+
360
+    /**
361
+     * Cached encrypted CSRF token. Some static unit-tests of ownCloud compare
362
+     * multiple OC_Template elements which invoke `callRegister`. If the value
363
+     * would not be cached these unit-tests would fail.
364
+     * @var string
365
+     */
366
+    private static $token = '';
367
+
368
+    /**
369
+     * Register an get/post call. This is important to prevent CSRF attacks
370
+     * @since 4.5.0
371
+     */
372
+    public static function callRegister() {
373
+        if (self::$token === '') {
374
+            self::$token = \OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue();
375
+        }
376
+        return self::$token;
377
+    }
378
+
379
+    /**
380
+     * Used to sanitize HTML
381
+     *
382
+     * This function is used to sanitize HTML and should be applied on any
383
+     * string or array of strings before displaying it on a web page.
384
+     *
385
+     * @param string|array $value
386
+     * @return string|array an array of sanitized strings or a single sanitized string, depends on the input parameter.
387
+     * @since 4.5.0
388
+     */
389
+    public static function sanitizeHTML($value) {
390
+        return \OC_Util::sanitizeHTML($value);
391
+    }
392
+
393
+    /**
394
+     * Public function to encode url parameters
395
+     *
396
+     * This function is used to encode path to file before output.
397
+     * Encoding is done according to RFC 3986 with one exception:
398
+     * Character '/' is preserved as is.
399
+     *
400
+     * @param string $component part of URI to encode
401
+     * @return string
402
+     * @since 6.0.0
403
+     */
404
+    public static function encodePath($component) {
405
+        return \OC_Util::encodePath($component);
406
+    }
407
+
408
+    /**
409
+     * Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.
410
+     *
411
+     * @param array $input The array to work on
412
+     * @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default)
413
+     * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
414
+     * @return array
415
+     * @since 4.5.0
416
+     */
417
+    public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') {
418
+        return \OC_Helper::mb_array_change_key_case($input, $case, $encoding);
419
+    }
420
+
421
+    /**
422
+     * performs a search in a nested array
423
+     *
424
+     * @param array $haystack the array to be searched
425
+     * @param string $needle the search string
426
+     * @param mixed $index optional, only search this key name
427
+     * @return mixed the key of the matching field, otherwise false
428
+     * @since 4.5.0
429
+     * @deprecated 15.0.0
430
+     */
431
+    public static function recursiveArraySearch($haystack, $needle, $index = null) {
432
+        return \OC_Helper::recursiveArraySearch($haystack, $needle, $index);
433
+    }
434
+
435
+    /**
436
+     * calculates the maximum upload size respecting system settings, free space and user quota
437
+     *
438
+     * @param string $dir the current folder where the user currently operates
439
+     * @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
440
+     * @return int number of bytes representing
441
+     * @since 5.0.0
442
+     */
443
+    public static function maxUploadFilesize($dir, $free = null) {
444
+        return \OC_Helper::maxUploadFilesize($dir, $free);
445
+    }
446
+
447
+    /**
448
+     * Calculate free space left within user quota
449
+     * @param string $dir the current folder where the user currently operates
450
+     * @return int number of bytes representing
451
+     * @since 7.0.0
452
+     */
453
+    public static function freeSpace($dir) {
454
+        return \OC_Helper::freeSpace($dir);
455
+    }
456
+
457
+    /**
458
+     * Calculate PHP upload limit
459
+     *
460
+     * @return int number of bytes representing
461
+     * @since 7.0.0
462
+     */
463
+    public static function uploadLimit() {
464
+        return \OC_Helper::uploadLimit();
465
+    }
466
+
467
+    /**
468
+     * Returns whether the given file name is valid
469
+     * @param string $file file name to check
470
+     * @return bool true if the file name is valid, false otherwise
471
+     * @deprecated 8.1.0 use \OC\Files\View::verifyPath()
472
+     * @since 7.0.0
473
+     * @suppress PhanDeprecatedFunction
474
+     */
475
+    public static function isValidFileName($file) {
476
+        return \OC_Util::isValidFileName($file);
477
+    }
478
+
479
+    /**
480
+     * Compare two strings to provide a natural sort
481
+     * @param string $a first string to compare
482
+     * @param string $b second string to compare
483
+     * @return int -1 if $b comes before $a, 1 if $a comes before $b
484
+     * or 0 if the strings are identical
485
+     * @since 7.0.0
486
+     */
487
+    public static function naturalSortCompare($a, $b) {
488
+        return \OC\NaturalSort::getInstance()->compare($a, $b);
489
+    }
490
+
491
+    /**
492
+     * check if a password is required for each public link
493
+     * @return boolean
494
+     * @since 7.0.0
495
+     */
496
+    public static function isPublicLinkPasswordRequired() {
497
+        return \OC_Util::isPublicLinkPasswordRequired();
498
+    }
499
+
500
+    /**
501
+     * check if share API enforces a default expire date
502
+     * @return boolean
503
+     * @since 8.0.0
504
+     */
505
+    public static function isDefaultExpireDateEnforced() {
506
+        return \OC_Util::isDefaultExpireDateEnforced();
507
+    }
508
+
509
+    protected static $needUpgradeCache = null;
510
+
511
+    /**
512
+     * Checks whether the current version needs upgrade.
513
+     *
514
+     * @return bool true if upgrade is needed, false otherwise
515
+     * @since 7.0.0
516
+     */
517
+    public static function needUpgrade() {
518
+        if (!isset(self::$needUpgradeCache)) {
519
+            self::$needUpgradeCache = \OC_Util::needUpgrade(\OC::$server->getSystemConfig());
520
+        }
521
+        return self::$needUpgradeCache;
522
+    }
523
+
524
+    /**
525
+     * is this Internet explorer ?
526
+     *
527
+     * @return boolean
528
+     * @since 14.0.0
529
+     */
530
+    public static function isIe() {
531
+        return \OC_Util::isIe();
532
+    }
533 533
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/QueryBuilder.php 1 patch
Indentation   +1205 added lines, -1205 removed lines patch added patch discarded remove patch
@@ -53,1209 +53,1209 @@
 block discarded – undo
53 53
 
54 54
 class QueryBuilder implements IQueryBuilder {
55 55
 
56
-	/** @var \OCP\IDBConnection */
57
-	private $connection;
58
-
59
-	/** @var SystemConfig */
60
-	private $systemConfig;
61
-
62
-	/** @var ILogger */
63
-	private $logger;
64
-
65
-	/** @var \Doctrine\DBAL\Query\QueryBuilder */
66
-	private $queryBuilder;
67
-
68
-	/** @var QuoteHelper */
69
-	private $helper;
70
-
71
-	/** @var bool */
72
-	private $automaticTablePrefix = true;
73
-
74
-	/** @var string */
75
-	protected $lastInsertedTable;
76
-
77
-	/**
78
-	 * Initializes a new QueryBuilder.
79
-	 *
80
-	 * @param IDBConnection $connection
81
-	 * @param SystemConfig $systemConfig
82
-	 * @param ILogger $logger
83
-	 */
84
-	public function __construct(IDBConnection $connection, SystemConfig $systemConfig, ILogger $logger) {
85
-		$this->connection = $connection;
86
-		$this->systemConfig = $systemConfig;
87
-		$this->logger = $logger;
88
-		$this->queryBuilder = new \Doctrine\DBAL\Query\QueryBuilder($this->connection);
89
-		$this->helper = new QuoteHelper();
90
-	}
91
-
92
-	/**
93
-	 * Enable/disable automatic prefixing of table names with the oc_ prefix
94
-	 *
95
-	 * @param bool $enabled If set to true table names will be prefixed with the
96
-	 * owncloud database prefix automatically.
97
-	 * @since 8.2.0
98
-	 */
99
-	public function automaticTablePrefix($enabled) {
100
-		$this->automaticTablePrefix = (bool) $enabled;
101
-	}
102
-
103
-	/**
104
-	 * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
105
-	 * This producer method is intended for convenient inline usage. Example:
106
-	 *
107
-	 * <code>
108
-	 *     $qb = $conn->getQueryBuilder()
109
-	 *         ->select('u')
110
-	 *         ->from('users', 'u')
111
-	 *         ->where($qb->expr()->eq('u.id', 1));
112
-	 * </code>
113
-	 *
114
-	 * For more complex expression construction, consider storing the expression
115
-	 * builder object in a local variable.
116
-	 *
117
-	 * @return \OCP\DB\QueryBuilder\IExpressionBuilder
118
-	 */
119
-	public function expr() {
120
-		if ($this->connection instanceof OracleConnection) {
121
-			return new OCIExpressionBuilder($this->connection, $this);
122
-		} elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
123
-			return new PgSqlExpressionBuilder($this->connection, $this);
124
-		} elseif ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
125
-			return new MySqlExpressionBuilder($this->connection, $this);
126
-		} elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
127
-			return new SqliteExpressionBuilder($this->connection, $this);
128
-		} else {
129
-			return new ExpressionBuilder($this->connection, $this);
130
-		}
131
-	}
132
-
133
-	/**
134
-	 * Gets an FunctionBuilder used for object-oriented construction of query functions.
135
-	 * This producer method is intended for convenient inline usage. Example:
136
-	 *
137
-	 * <code>
138
-	 *     $qb = $conn->getQueryBuilder()
139
-	 *         ->select('u')
140
-	 *         ->from('users', 'u')
141
-	 *         ->where($qb->fun()->md5('u.id'));
142
-	 * </code>
143
-	 *
144
-	 * For more complex function construction, consider storing the function
145
-	 * builder object in a local variable.
146
-	 *
147
-	 * @return \OCP\DB\QueryBuilder\IFunctionBuilder
148
-	 */
149
-	public function func() {
150
-		if ($this->connection instanceof OracleConnection) {
151
-			return new OCIFunctionBuilder($this->helper);
152
-		} elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
153
-			return new SqliteFunctionBuilder($this->helper);
154
-		} elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
155
-			return new PgSqlFunctionBuilder($this->helper);
156
-		} else {
157
-			return new FunctionBuilder($this->helper);
158
-		}
159
-	}
160
-
161
-	/**
162
-	 * Gets the type of the currently built query.
163
-	 *
164
-	 * @return integer
165
-	 */
166
-	public function getType() {
167
-		return $this->queryBuilder->getType();
168
-	}
169
-
170
-	/**
171
-	 * Gets the associated DBAL Connection for this query builder.
172
-	 *
173
-	 * @return \OCP\IDBConnection
174
-	 */
175
-	public function getConnection() {
176
-		return $this->connection;
177
-	}
178
-
179
-	/**
180
-	 * Gets the state of this query builder instance.
181
-	 *
182
-	 * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
183
-	 */
184
-	public function getState() {
185
-		return $this->queryBuilder->getState();
186
-	}
187
-
188
-	/**
189
-	 * Executes this query using the bound parameters and their types.
190
-	 *
191
-	 * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
192
-	 * for insert, update and delete statements.
193
-	 *
194
-	 * @return \Doctrine\DBAL\Driver\Statement|int
195
-	 */
196
-	public function execute() {
197
-		if ($this->systemConfig->getValue('log_query', false)) {
198
-			try {
199
-				$params = [];
200
-				foreach ($this->getParameters() as $placeholder => $value) {
201
-					if ($value instanceof \DateTime) {
202
-						$params[] = $placeholder . ' => DateTime:\'' . $value->format('c') . '\'';
203
-					} elseif (is_array($value)) {
204
-						$params[] = $placeholder . ' => (\'' . implode('\', \'', $value) . '\')';
205
-					} else {
206
-						$params[] = $placeholder . ' => \'' . $value . '\'';
207
-					}
208
-				}
209
-				if (empty($params)) {
210
-					$this->logger->debug('DB QueryBuilder: \'{query}\'', [
211
-						'query' => $this->getSQL(),
212
-						'app' => 'core',
213
-					]);
214
-				} else {
215
-					$this->logger->debug('DB QueryBuilder: \'{query}\' with parameters: {params}', [
216
-						'query' => $this->getSQL(),
217
-						'params' => implode(', ', $params),
218
-						'app' => 'core',
219
-					]);
220
-				}
221
-			} catch (\Error $e) {
222
-				// likely an error during conversion of $value to string
223
-				$this->logger->debug('DB QueryBuilder: error trying to log SQL query');
224
-				$this->logger->logException($e);
225
-			}
226
-		}
227
-
228
-		if (!empty($this->getQueryPart('select'))) {
229
-			$select = $this->getQueryPart('select');
230
-			$hasSelectAll = array_filter($select, static function ($s) {
231
-				return $s === '*';
232
-			});
233
-			$hasSelectSpecific = array_filter($select, static function ($s) {
234
-				return $s !== '*';
235
-			});
236
-
237
-			if (empty($hasSelectAll) === empty($hasSelectSpecific)) {
238
-				$exception = new QueryException('Query is selecting * and specific values in the same query. This is not supported in Oracle.');
239
-				$this->logger->logException($exception, [
240
-					'message' => 'Query is selecting * and specific values in the same query. This is not supported in Oracle.',
241
-					'query' => $this->getSQL(),
242
-					'level' => ILogger::ERROR,
243
-					'app' => 'core',
244
-				]);
245
-			}
246
-		}
247
-
248
-		return $this->queryBuilder->execute();
249
-	}
250
-
251
-	/**
252
-	 * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
253
-	 *
254
-	 * <code>
255
-	 *     $qb = $conn->getQueryBuilder()
256
-	 *         ->select('u')
257
-	 *         ->from('User', 'u')
258
-	 *     echo $qb->getSQL(); // SELECT u FROM User u
259
-	 * </code>
260
-	 *
261
-	 * @return string The SQL query string.
262
-	 */
263
-	public function getSQL() {
264
-		return $this->queryBuilder->getSQL();
265
-	}
266
-
267
-	/**
268
-	 * Sets a query parameter for the query being constructed.
269
-	 *
270
-	 * <code>
271
-	 *     $qb = $conn->getQueryBuilder()
272
-	 *         ->select('u')
273
-	 *         ->from('users', 'u')
274
-	 *         ->where('u.id = :user_id')
275
-	 *         ->setParameter(':user_id', 1);
276
-	 * </code>
277
-	 *
278
-	 * @param string|integer $key The parameter position or name.
279
-	 * @param mixed $value The parameter value.
280
-	 * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
281
-	 *
282
-	 * @return $this This QueryBuilder instance.
283
-	 */
284
-	public function setParameter($key, $value, $type = null) {
285
-		$this->queryBuilder->setParameter($key, $value, $type);
286
-
287
-		return $this;
288
-	}
289
-
290
-	/**
291
-	 * Sets a collection of query parameters for the query being constructed.
292
-	 *
293
-	 * <code>
294
-	 *     $qb = $conn->getQueryBuilder()
295
-	 *         ->select('u')
296
-	 *         ->from('users', 'u')
297
-	 *         ->where('u.id = :user_id1 OR u.id = :user_id2')
298
-	 *         ->setParameters(array(
299
-	 *             ':user_id1' => 1,
300
-	 *             ':user_id2' => 2
301
-	 *         ));
302
-	 * </code>
303
-	 *
304
-	 * @param array $params The query parameters to set.
305
-	 * @param array $types The query parameters types to set.
306
-	 *
307
-	 * @return $this This QueryBuilder instance.
308
-	 */
309
-	public function setParameters(array $params, array $types = []) {
310
-		$this->queryBuilder->setParameters($params, $types);
311
-
312
-		return $this;
313
-	}
314
-
315
-	/**
316
-	 * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
317
-	 *
318
-	 * @return array The currently defined query parameters indexed by parameter index or name.
319
-	 */
320
-	public function getParameters() {
321
-		return $this->queryBuilder->getParameters();
322
-	}
323
-
324
-	/**
325
-	 * Gets a (previously set) query parameter of the query being constructed.
326
-	 *
327
-	 * @param mixed $key The key (index or name) of the bound parameter.
328
-	 *
329
-	 * @return mixed The value of the bound parameter.
330
-	 */
331
-	public function getParameter($key) {
332
-		return $this->queryBuilder->getParameter($key);
333
-	}
334
-
335
-	/**
336
-	 * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
337
-	 *
338
-	 * @return array The currently defined query parameter types indexed by parameter index or name.
339
-	 */
340
-	public function getParameterTypes() {
341
-		return $this->queryBuilder->getParameterTypes();
342
-	}
343
-
344
-	/**
345
-	 * Gets a (previously set) query parameter type of the query being constructed.
346
-	 *
347
-	 * @param mixed $key The key (index or name) of the bound parameter type.
348
-	 *
349
-	 * @return mixed The value of the bound parameter type.
350
-	 */
351
-	public function getParameterType($key) {
352
-		return $this->queryBuilder->getParameterType($key);
353
-	}
354
-
355
-	/**
356
-	 * Sets the position of the first result to retrieve (the "offset").
357
-	 *
358
-	 * @param integer $firstResult The first result to return.
359
-	 *
360
-	 * @return $this This QueryBuilder instance.
361
-	 */
362
-	public function setFirstResult($firstResult) {
363
-		$this->queryBuilder->setFirstResult($firstResult);
364
-
365
-		return $this;
366
-	}
367
-
368
-	/**
369
-	 * Gets the position of the first result the query object was set to retrieve (the "offset").
370
-	 * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
371
-	 *
372
-	 * @return integer The position of the first result.
373
-	 */
374
-	public function getFirstResult() {
375
-		return $this->queryBuilder->getFirstResult();
376
-	}
377
-
378
-	/**
379
-	 * Sets the maximum number of results to retrieve (the "limit").
380
-	 *
381
-	 * NOTE: Setting max results to "0" will cause mixed behaviour. While most
382
-	 * of the databases will just return an empty result set, Oracle will return
383
-	 * all entries.
384
-	 *
385
-	 * @param integer $maxResults The maximum number of results to retrieve.
386
-	 *
387
-	 * @return $this This QueryBuilder instance.
388
-	 */
389
-	public function setMaxResults($maxResults) {
390
-		$this->queryBuilder->setMaxResults($maxResults);
391
-
392
-		return $this;
393
-	}
394
-
395
-	/**
396
-	 * Gets the maximum number of results the query object was set to retrieve (the "limit").
397
-	 * Returns NULL if {@link setMaxResults} was not applied to this query builder.
398
-	 *
399
-	 * @return int|null The maximum number of results.
400
-	 */
401
-	public function getMaxResults() {
402
-		return $this->queryBuilder->getMaxResults();
403
-	}
404
-
405
-	/**
406
-	 * Specifies an item that is to be returned in the query result.
407
-	 * Replaces any previously specified selections, if any.
408
-	 *
409
-	 * <code>
410
-	 *     $qb = $conn->getQueryBuilder()
411
-	 *         ->select('u.id', 'p.id')
412
-	 *         ->from('users', 'u')
413
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
414
-	 * </code>
415
-	 *
416
-	 * @param mixed ...$selects The selection expressions.
417
-	 *
418
-	 * '@return $this This QueryBuilder instance.
419
-	 */
420
-	public function select(...$selects) {
421
-		if (count($selects) === 1 && is_array($selects[0])) {
422
-			$selects = $selects[0];
423
-		}
424
-
425
-		$this->queryBuilder->select(
426
-			$this->helper->quoteColumnNames($selects)
427
-		);
428
-
429
-		return $this;
430
-	}
431
-
432
-	/**
433
-	 * Specifies an item that is to be returned with a different name in the query result.
434
-	 *
435
-	 * <code>
436
-	 *     $qb = $conn->getQueryBuilder()
437
-	 *         ->selectAlias('u.id', 'user_id')
438
-	 *         ->from('users', 'u')
439
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
440
-	 * </code>
441
-	 *
442
-	 * @param mixed $select The selection expressions.
443
-	 * @param string $alias The column alias used in the constructed query.
444
-	 *
445
-	 * @return $this This QueryBuilder instance.
446
-	 */
447
-	public function selectAlias($select, $alias) {
448
-		$this->queryBuilder->addSelect(
449
-			$this->helper->quoteColumnName($select) . ' AS ' . $this->helper->quoteColumnName($alias)
450
-		);
451
-
452
-		return $this;
453
-	}
454
-
455
-	/**
456
-	 * Specifies an item that is to be returned uniquely in the query result.
457
-	 *
458
-	 * <code>
459
-	 *     $qb = $conn->getQueryBuilder()
460
-	 *         ->selectDistinct('type')
461
-	 *         ->from('users');
462
-	 * </code>
463
-	 *
464
-	 * @param mixed $select The selection expressions.
465
-	 *
466
-	 * @return $this This QueryBuilder instance.
467
-	 */
468
-	public function selectDistinct($select) {
469
-		if (!is_array($select)) {
470
-			$select = [$select];
471
-		}
472
-
473
-		$quotedSelect = $this->helper->quoteColumnNames($select);
474
-
475
-		$this->queryBuilder->addSelect(
476
-			'DISTINCT ' . implode(', ', $quotedSelect)
477
-		);
478
-
479
-		return $this;
480
-	}
481
-
482
-	/**
483
-	 * Adds an item that is to be returned in the query result.
484
-	 *
485
-	 * <code>
486
-	 *     $qb = $conn->getQueryBuilder()
487
-	 *         ->select('u.id')
488
-	 *         ->addSelect('p.id')
489
-	 *         ->from('users', 'u')
490
-	 *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
491
-	 * </code>
492
-	 *
493
-	 * @param mixed ...$selects The selection expression.
494
-	 *
495
-	 * @return $this This QueryBuilder instance.
496
-	 */
497
-	public function addSelect(...$selects) {
498
-		if (count($selects) === 1 && is_array($selects[0])) {
499
-			$selects = $selects[0];
500
-		}
501
-
502
-		$this->queryBuilder->addSelect(
503
-			$this->helper->quoteColumnNames($selects)
504
-		);
505
-
506
-		return $this;
507
-	}
508
-
509
-	/**
510
-	 * Turns the query being built into a bulk delete query that ranges over
511
-	 * a certain table.
512
-	 *
513
-	 * <code>
514
-	 *     $qb = $conn->getQueryBuilder()
515
-	 *         ->delete('users', 'u')
516
-	 *         ->where('u.id = :user_id');
517
-	 *         ->setParameter(':user_id', 1);
518
-	 * </code>
519
-	 *
520
-	 * @param string $delete The table whose rows are subject to the deletion.
521
-	 * @param string $alias The table alias used in the constructed query.
522
-	 *
523
-	 * @return $this This QueryBuilder instance.
524
-	 */
525
-	public function delete($delete = null, $alias = null) {
526
-		$this->queryBuilder->delete(
527
-			$this->getTableName($delete),
528
-			$alias
529
-		);
530
-
531
-		return $this;
532
-	}
533
-
534
-	/**
535
-	 * Turns the query being built into a bulk update query that ranges over
536
-	 * a certain table
537
-	 *
538
-	 * <code>
539
-	 *     $qb = $conn->getQueryBuilder()
540
-	 *         ->update('users', 'u')
541
-	 *         ->set('u.password', md5('password'))
542
-	 *         ->where('u.id = ?');
543
-	 * </code>
544
-	 *
545
-	 * @param string $update The table whose rows are subject to the update.
546
-	 * @param string $alias The table alias used in the constructed query.
547
-	 *
548
-	 * @return $this This QueryBuilder instance.
549
-	 */
550
-	public function update($update = null, $alias = null) {
551
-		$this->queryBuilder->update(
552
-			$this->getTableName($update),
553
-			$alias
554
-		);
555
-
556
-		return $this;
557
-	}
558
-
559
-	/**
560
-	 * Turns the query being built into an insert query that inserts into
561
-	 * a certain table
562
-	 *
563
-	 * <code>
564
-	 *     $qb = $conn->getQueryBuilder()
565
-	 *         ->insert('users')
566
-	 *         ->values(
567
-	 *             array(
568
-	 *                 'name' => '?',
569
-	 *                 'password' => '?'
570
-	 *             )
571
-	 *         );
572
-	 * </code>
573
-	 *
574
-	 * @param string $insert The table into which the rows should be inserted.
575
-	 *
576
-	 * @return $this This QueryBuilder instance.
577
-	 */
578
-	public function insert($insert = null) {
579
-		$this->queryBuilder->insert(
580
-			$this->getTableName($insert)
581
-		);
582
-
583
-		$this->lastInsertedTable = $insert;
584
-
585
-		return $this;
586
-	}
587
-
588
-	/**
589
-	 * Creates and adds a query root corresponding to the table identified by the
590
-	 * given alias, forming a cartesian product with any existing query roots.
591
-	 *
592
-	 * <code>
593
-	 *     $qb = $conn->getQueryBuilder()
594
-	 *         ->select('u.id')
595
-	 *         ->from('users', 'u')
596
-	 * </code>
597
-	 *
598
-	 * @param string $from The table.
599
-	 * @param string|null $alias The alias of the table.
600
-	 *
601
-	 * @return $this This QueryBuilder instance.
602
-	 */
603
-	public function from($from, $alias = null) {
604
-		$this->queryBuilder->from(
605
-			$this->getTableName($from),
606
-			$this->quoteAlias($alias)
607
-		);
608
-
609
-		return $this;
610
-	}
611
-
612
-	/**
613
-	 * Creates and adds a join to the query.
614
-	 *
615
-	 * <code>
616
-	 *     $qb = $conn->getQueryBuilder()
617
-	 *         ->select('u.name')
618
-	 *         ->from('users', 'u')
619
-	 *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
620
-	 * </code>
621
-	 *
622
-	 * @param string $fromAlias The alias that points to a from clause.
623
-	 * @param string $join The table name to join.
624
-	 * @param string $alias The alias of the join table.
625
-	 * @param string $condition The condition for the join.
626
-	 *
627
-	 * @return $this This QueryBuilder instance.
628
-	 */
629
-	public function join($fromAlias, $join, $alias, $condition = null) {
630
-		$this->queryBuilder->join(
631
-			$this->quoteAlias($fromAlias),
632
-			$this->getTableName($join),
633
-			$this->quoteAlias($alias),
634
-			$condition
635
-		);
636
-
637
-		return $this;
638
-	}
639
-
640
-	/**
641
-	 * Creates and adds a join to the query.
642
-	 *
643
-	 * <code>
644
-	 *     $qb = $conn->getQueryBuilder()
645
-	 *         ->select('u.name')
646
-	 *         ->from('users', 'u')
647
-	 *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
648
-	 * </code>
649
-	 *
650
-	 * @param string $fromAlias The alias that points to a from clause.
651
-	 * @param string $join The table name to join.
652
-	 * @param string $alias The alias of the join table.
653
-	 * @param string $condition The condition for the join.
654
-	 *
655
-	 * @return $this This QueryBuilder instance.
656
-	 */
657
-	public function innerJoin($fromAlias, $join, $alias, $condition = null) {
658
-		$this->queryBuilder->innerJoin(
659
-			$this->quoteAlias($fromAlias),
660
-			$this->getTableName($join),
661
-			$this->quoteAlias($alias),
662
-			$condition
663
-		);
664
-
665
-		return $this;
666
-	}
667
-
668
-	/**
669
-	 * Creates and adds a left join to the query.
670
-	 *
671
-	 * <code>
672
-	 *     $qb = $conn->getQueryBuilder()
673
-	 *         ->select('u.name')
674
-	 *         ->from('users', 'u')
675
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
676
-	 * </code>
677
-	 *
678
-	 * @param string $fromAlias The alias that points to a from clause.
679
-	 * @param string $join The table name to join.
680
-	 * @param string $alias The alias of the join table.
681
-	 * @param string $condition The condition for the join.
682
-	 *
683
-	 * @return $this This QueryBuilder instance.
684
-	 */
685
-	public function leftJoin($fromAlias, $join, $alias, $condition = null) {
686
-		$this->queryBuilder->leftJoin(
687
-			$this->quoteAlias($fromAlias),
688
-			$this->getTableName($join),
689
-			$this->quoteAlias($alias),
690
-			$condition
691
-		);
692
-
693
-		return $this;
694
-	}
695
-
696
-	/**
697
-	 * Creates and adds a right join to the query.
698
-	 *
699
-	 * <code>
700
-	 *     $qb = $conn->getQueryBuilder()
701
-	 *         ->select('u.name')
702
-	 *         ->from('users', 'u')
703
-	 *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
704
-	 * </code>
705
-	 *
706
-	 * @param string $fromAlias The alias that points to a from clause.
707
-	 * @param string $join The table name to join.
708
-	 * @param string $alias The alias of the join table.
709
-	 * @param string $condition The condition for the join.
710
-	 *
711
-	 * @return $this This QueryBuilder instance.
712
-	 */
713
-	public function rightJoin($fromAlias, $join, $alias, $condition = null) {
714
-		$this->queryBuilder->rightJoin(
715
-			$this->quoteAlias($fromAlias),
716
-			$this->getTableName($join),
717
-			$this->quoteAlias($alias),
718
-			$condition
719
-		);
720
-
721
-		return $this;
722
-	}
723
-
724
-	/**
725
-	 * Sets a new value for a column in a bulk update query.
726
-	 *
727
-	 * <code>
728
-	 *     $qb = $conn->getQueryBuilder()
729
-	 *         ->update('users', 'u')
730
-	 *         ->set('u.password', md5('password'))
731
-	 *         ->where('u.id = ?');
732
-	 * </code>
733
-	 *
734
-	 * @param string $key The column to set.
735
-	 * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
736
-	 *
737
-	 * @return $this This QueryBuilder instance.
738
-	 */
739
-	public function set($key, $value) {
740
-		$this->queryBuilder->set(
741
-			$this->helper->quoteColumnName($key),
742
-			$this->helper->quoteColumnName($value)
743
-		);
744
-
745
-		return $this;
746
-	}
747
-
748
-	/**
749
-	 * Specifies one or more restrictions to the query result.
750
-	 * Replaces any previously specified restrictions, if any.
751
-	 *
752
-	 * <code>
753
-	 *     $qb = $conn->getQueryBuilder()
754
-	 *         ->select('u.name')
755
-	 *         ->from('users', 'u')
756
-	 *         ->where('u.id = ?');
757
-	 *
758
-	 *     // You can optionally programatically build and/or expressions
759
-	 *     $qb = $conn->getQueryBuilder();
760
-	 *
761
-	 *     $or = $qb->expr()->orx();
762
-	 *     $or->add($qb->expr()->eq('u.id', 1));
763
-	 *     $or->add($qb->expr()->eq('u.id', 2));
764
-	 *
765
-	 *     $qb->update('users', 'u')
766
-	 *         ->set('u.password', md5('password'))
767
-	 *         ->where($or);
768
-	 * </code>
769
-	 *
770
-	 * @param mixed ...$predicates The restriction predicates.
771
-	 *
772
-	 * @return $this This QueryBuilder instance.
773
-	 */
774
-	public function where(...$predicates) {
775
-		call_user_func_array(
776
-			[$this->queryBuilder, 'where'],
777
-			$predicates
778
-		);
779
-
780
-		return $this;
781
-	}
782
-
783
-	/**
784
-	 * Adds one or more restrictions to the query results, forming a logical
785
-	 * conjunction with any previously specified restrictions.
786
-	 *
787
-	 * <code>
788
-	 *     $qb = $conn->getQueryBuilder()
789
-	 *         ->select('u')
790
-	 *         ->from('users', 'u')
791
-	 *         ->where('u.username LIKE ?')
792
-	 *         ->andWhere('u.is_active = 1');
793
-	 * </code>
794
-	 *
795
-	 * @param mixed ...$where The query restrictions.
796
-	 *
797
-	 * @return $this This QueryBuilder instance.
798
-	 *
799
-	 * @see where()
800
-	 */
801
-	public function andWhere(...$where) {
802
-		call_user_func_array(
803
-			[$this->queryBuilder, 'andWhere'],
804
-			$where
805
-		);
806
-
807
-		return $this;
808
-	}
809
-
810
-	/**
811
-	 * Adds one or more restrictions to the query results, forming a logical
812
-	 * disjunction with any previously specified restrictions.
813
-	 *
814
-	 * <code>
815
-	 *     $qb = $conn->getQueryBuilder()
816
-	 *         ->select('u.name')
817
-	 *         ->from('users', 'u')
818
-	 *         ->where('u.id = 1')
819
-	 *         ->orWhere('u.id = 2');
820
-	 * </code>
821
-	 *
822
-	 * @param mixed ...$where The WHERE statement.
823
-	 *
824
-	 * @return $this This QueryBuilder instance.
825
-	 *
826
-	 * @see where()
827
-	 */
828
-	public function orWhere(...$where) {
829
-		call_user_func_array(
830
-			[$this->queryBuilder, 'orWhere'],
831
-			$where
832
-		);
833
-
834
-		return $this;
835
-	}
836
-
837
-	/**
838
-	 * Specifies a grouping over the results of the query.
839
-	 * Replaces any previously specified groupings, if any.
840
-	 *
841
-	 * <code>
842
-	 *     $qb = $conn->getQueryBuilder()
843
-	 *         ->select('u.name')
844
-	 *         ->from('users', 'u')
845
-	 *         ->groupBy('u.id');
846
-	 * </code>
847
-	 *
848
-	 * @param mixed ...$groupBys The grouping expression.
849
-	 *
850
-	 * @return $this This QueryBuilder instance.
851
-	 */
852
-	public function groupBy(...$groupBys) {
853
-		if (count($groupBys) === 1 && is_array($groupBys[0])) {
854
-			$groupBys = $groupBys[0];
855
-		}
856
-
857
-		call_user_func_array(
858
-			[$this->queryBuilder, 'groupBy'],
859
-			$this->helper->quoteColumnNames($groupBys)
860
-		);
861
-
862
-		return $this;
863
-	}
864
-
865
-	/**
866
-	 * Adds a grouping expression to the query.
867
-	 *
868
-	 * <code>
869
-	 *     $qb = $conn->getQueryBuilder()
870
-	 *         ->select('u.name')
871
-	 *         ->from('users', 'u')
872
-	 *         ->groupBy('u.lastLogin');
873
-	 *         ->addGroupBy('u.createdAt')
874
-	 * </code>
875
-	 *
876
-	 * @param mixed ...$groupBy The grouping expression.
877
-	 *
878
-	 * @return $this This QueryBuilder instance.
879
-	 */
880
-	public function addGroupBy(...$groupBys) {
881
-		if (count($groupBys) === 1 && is_array($groupBys[0])) {
882
-			$$groupBys = $groupBys[0];
883
-		}
884
-
885
-		call_user_func_array(
886
-			[$this->queryBuilder, 'addGroupBy'],
887
-			$this->helper->quoteColumnNames($groupBys)
888
-		);
889
-
890
-		return $this;
891
-	}
892
-
893
-	/**
894
-	 * Sets a value for a column in an insert query.
895
-	 *
896
-	 * <code>
897
-	 *     $qb = $conn->getQueryBuilder()
898
-	 *         ->insert('users')
899
-	 *         ->values(
900
-	 *             array(
901
-	 *                 'name' => '?'
902
-	 *             )
903
-	 *         )
904
-	 *         ->setValue('password', '?');
905
-	 * </code>
906
-	 *
907
-	 * @param string $column The column into which the value should be inserted.
908
-	 * @param IParameter|string $value The value that should be inserted into the column.
909
-	 *
910
-	 * @return $this This QueryBuilder instance.
911
-	 */
912
-	public function setValue($column, $value) {
913
-		$this->queryBuilder->setValue(
914
-			$this->helper->quoteColumnName($column),
915
-			(string) $value
916
-		);
917
-
918
-		return $this;
919
-	}
920
-
921
-	/**
922
-	 * Specifies values for an insert query indexed by column names.
923
-	 * Replaces any previous values, if any.
924
-	 *
925
-	 * <code>
926
-	 *     $qb = $conn->getQueryBuilder()
927
-	 *         ->insert('users')
928
-	 *         ->values(
929
-	 *             array(
930
-	 *                 'name' => '?',
931
-	 *                 'password' => '?'
932
-	 *             )
933
-	 *         );
934
-	 * </code>
935
-	 *
936
-	 * @param array $values The values to specify for the insert query indexed by column names.
937
-	 *
938
-	 * @return $this This QueryBuilder instance.
939
-	 */
940
-	public function values(array $values) {
941
-		$quotedValues = [];
942
-		foreach ($values as $key => $value) {
943
-			$quotedValues[$this->helper->quoteColumnName($key)] = $value;
944
-		}
945
-
946
-		$this->queryBuilder->values($quotedValues);
947
-
948
-		return $this;
949
-	}
950
-
951
-	/**
952
-	 * Specifies a restriction over the groups of the query.
953
-	 * Replaces any previous having restrictions, if any.
954
-	 *
955
-	 * @param mixed ...$having The restriction over the groups.
956
-	 *
957
-	 * @return $this This QueryBuilder instance.
958
-	 */
959
-	public function having(...$having) {
960
-		call_user_func_array(
961
-			[$this->queryBuilder, 'having'],
962
-			$having
963
-		);
964
-
965
-		return $this;
966
-	}
967
-
968
-	/**
969
-	 * Adds a restriction over the groups of the query, forming a logical
970
-	 * conjunction with any existing having restrictions.
971
-	 *
972
-	 * @param mixed ...$having The restriction to append.
973
-	 *
974
-	 * @return $this This QueryBuilder instance.
975
-	 */
976
-	public function andHaving(...$having) {
977
-		call_user_func_array(
978
-			[$this->queryBuilder, 'andHaving'],
979
-			$having
980
-		);
981
-
982
-		return $this;
983
-	}
984
-
985
-	/**
986
-	 * Adds a restriction over the groups of the query, forming a logical
987
-	 * disjunction with any existing having restrictions.
988
-	 *
989
-	 * @param mixed ...$having The restriction to add.
990
-	 *
991
-	 * @return $this This QueryBuilder instance.
992
-	 */
993
-	public function orHaving(...$having) {
994
-		call_user_func_array(
995
-			[$this->queryBuilder, 'orHaving'],
996
-			$having
997
-		);
998
-
999
-		return $this;
1000
-	}
1001
-
1002
-	/**
1003
-	 * Specifies an ordering for the query results.
1004
-	 * Replaces any previously specified orderings, if any.
1005
-	 *
1006
-	 * @param string $sort The ordering expression.
1007
-	 * @param string $order The ordering direction.
1008
-	 *
1009
-	 * @return $this This QueryBuilder instance.
1010
-	 */
1011
-	public function orderBy($sort, $order = null) {
1012
-		$this->queryBuilder->orderBy(
1013
-			$this->helper->quoteColumnName($sort),
1014
-			$order
1015
-		);
1016
-
1017
-		return $this;
1018
-	}
1019
-
1020
-	/**
1021
-	 * Adds an ordering to the query results.
1022
-	 *
1023
-	 * @param string $sort The ordering expression.
1024
-	 * @param string $order The ordering direction.
1025
-	 *
1026
-	 * @return $this This QueryBuilder instance.
1027
-	 */
1028
-	public function addOrderBy($sort, $order = null) {
1029
-		$this->queryBuilder->addOrderBy(
1030
-			$this->helper->quoteColumnName($sort),
1031
-			$order
1032
-		);
1033
-
1034
-		return $this;
1035
-	}
1036
-
1037
-	/**
1038
-	 * Gets a query part by its name.
1039
-	 *
1040
-	 * @param string $queryPartName
1041
-	 *
1042
-	 * @return mixed
1043
-	 */
1044
-	public function getQueryPart($queryPartName) {
1045
-		return $this->queryBuilder->getQueryPart($queryPartName);
1046
-	}
1047
-
1048
-	/**
1049
-	 * Gets all query parts.
1050
-	 *
1051
-	 * @return array
1052
-	 */
1053
-	public function getQueryParts() {
1054
-		return $this->queryBuilder->getQueryParts();
1055
-	}
1056
-
1057
-	/**
1058
-	 * Resets SQL parts.
1059
-	 *
1060
-	 * @param array|null $queryPartNames
1061
-	 *
1062
-	 * @return $this This QueryBuilder instance.
1063
-	 */
1064
-	public function resetQueryParts($queryPartNames = null) {
1065
-		$this->queryBuilder->resetQueryParts($queryPartNames);
1066
-
1067
-		return $this;
1068
-	}
1069
-
1070
-	/**
1071
-	 * Resets a single SQL part.
1072
-	 *
1073
-	 * @param string $queryPartName
1074
-	 *
1075
-	 * @return $this This QueryBuilder instance.
1076
-	 */
1077
-	public function resetQueryPart($queryPartName) {
1078
-		$this->queryBuilder->resetQueryPart($queryPartName);
1079
-
1080
-		return $this;
1081
-	}
1082
-
1083
-	/**
1084
-	 * Creates a new named parameter and bind the value $value to it.
1085
-	 *
1086
-	 * This method provides a shortcut for PDOStatement::bindValue
1087
-	 * when using prepared statements.
1088
-	 *
1089
-	 * The parameter $value specifies the value that you want to bind. If
1090
-	 * $placeholder is not provided bindValue() will automatically create a
1091
-	 * placeholder for you. An automatic placeholder will be of the name
1092
-	 * ':dcValue1', ':dcValue2' etc.
1093
-	 *
1094
-	 * For more information see {@link https://www.php.net/pdostatement-bindparam}
1095
-	 *
1096
-	 * Example:
1097
-	 * <code>
1098
-	 * $value = 2;
1099
-	 * $q->eq( 'id', $q->bindValue( $value ) );
1100
-	 * $stmt = $q->executeQuery(); // executed with 'id = 2'
1101
-	 * </code>
1102
-	 *
1103
-	 * @license New BSD License
1104
-	 * @link http://www.zetacomponents.org
1105
-	 *
1106
-	 * @param mixed $value
1107
-	 * @param mixed $type
1108
-	 * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
1109
-	 *
1110
-	 * @return IParameter the placeholder name used.
1111
-	 */
1112
-	public function createNamedParameter($value, $type = IQueryBuilder::PARAM_STR, $placeHolder = null) {
1113
-		return new Parameter($this->queryBuilder->createNamedParameter($value, $type, $placeHolder));
1114
-	}
1115
-
1116
-	/**
1117
-	 * Creates a new positional parameter and bind the given value to it.
1118
-	 *
1119
-	 * Attention: If you are using positional parameters with the query builder you have
1120
-	 * to be very careful to bind all parameters in the order they appear in the SQL
1121
-	 * statement , otherwise they get bound in the wrong order which can lead to serious
1122
-	 * bugs in your code.
1123
-	 *
1124
-	 * Example:
1125
-	 * <code>
1126
-	 *  $qb = $conn->getQueryBuilder();
1127
-	 *  $qb->select('u.*')
1128
-	 *     ->from('users', 'u')
1129
-	 *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
1130
-	 *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
1131
-	 * </code>
1132
-	 *
1133
-	 * @param mixed $value
1134
-	 * @param integer $type
1135
-	 *
1136
-	 * @return IParameter
1137
-	 */
1138
-	public function createPositionalParameter($value, $type = IQueryBuilder::PARAM_STR) {
1139
-		return new Parameter($this->queryBuilder->createPositionalParameter($value, $type));
1140
-	}
1141
-
1142
-	/**
1143
-	 * Creates a new parameter
1144
-	 *
1145
-	 * Example:
1146
-	 * <code>
1147
-	 *  $qb = $conn->getQueryBuilder();
1148
-	 *  $qb->select('u.*')
1149
-	 *     ->from('users', 'u')
1150
-	 *     ->where('u.username = ' . $qb->createParameter('name'))
1151
-	 *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
1152
-	 * </code>
1153
-	 *
1154
-	 * @param string $name
1155
-	 *
1156
-	 * @return IParameter
1157
-	 */
1158
-	public function createParameter($name) {
1159
-		return new Parameter(':' . $name);
1160
-	}
1161
-
1162
-	/**
1163
-	 * Creates a new function
1164
-	 *
1165
-	 * Attention: Column names inside the call have to be quoted before hand
1166
-	 *
1167
-	 * Example:
1168
-	 * <code>
1169
-	 *  $qb = $conn->getQueryBuilder();
1170
-	 *  $qb->select($qb->createFunction('COUNT(*)'))
1171
-	 *     ->from('users', 'u')
1172
-	 *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
1173
-	 * </code>
1174
-	 * <code>
1175
-	 *  $qb = $conn->getQueryBuilder();
1176
-	 *  $qb->select($qb->createFunction('COUNT(`column`)'))
1177
-	 *     ->from('users', 'u')
1178
-	 *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
1179
-	 * </code>
1180
-	 *
1181
-	 * @param string $call
1182
-	 *
1183
-	 * @return IQueryFunction
1184
-	 */
1185
-	public function createFunction($call) {
1186
-		return new QueryFunction($call);
1187
-	}
1188
-
1189
-	/**
1190
-	 * Used to get the id of the last inserted element
1191
-	 * @return int
1192
-	 * @throws \BadMethodCallException When being called before an insert query has been run.
1193
-	 */
1194
-	public function getLastInsertId() {
1195
-		if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) {
1196
-			// lastInsertId() needs the prefix but no quotes
1197
-			$table = $this->prefixTableName($this->lastInsertedTable);
1198
-			return (int) $this->connection->lastInsertId($table);
1199
-		}
1200
-
1201
-		throw new \BadMethodCallException('Invalid call to getLastInsertId without using insert() before.');
1202
-	}
1203
-
1204
-	/**
1205
-	 * Returns the table name quoted and with database prefix as needed by the implementation
1206
-	 *
1207
-	 * @param string $table
1208
-	 * @return string
1209
-	 */
1210
-	public function getTableName($table) {
1211
-		if ($table instanceof IQueryFunction) {
1212
-			return (string) $table;
1213
-		}
1214
-
1215
-		$table = $this->prefixTableName($table);
1216
-		return $this->helper->quoteColumnName($table);
1217
-	}
1218
-
1219
-	/**
1220
-	 * Returns the table name with database prefix as needed by the implementation
1221
-	 *
1222
-	 * @param string $table
1223
-	 * @return string
1224
-	 */
1225
-	protected function prefixTableName($table) {
1226
-		if ($this->automaticTablePrefix === false || strpos($table, '*PREFIX*') === 0) {
1227
-			return $table;
1228
-		}
1229
-
1230
-		return '*PREFIX*' . $table;
1231
-	}
1232
-
1233
-	/**
1234
-	 * Returns the column name quoted and with table alias prefix as needed by the implementation
1235
-	 *
1236
-	 * @param string $column
1237
-	 * @param string $tableAlias
1238
-	 * @return string
1239
-	 */
1240
-	public function getColumnName($column, $tableAlias = '') {
1241
-		if ($tableAlias !== '') {
1242
-			$tableAlias .= '.';
1243
-		}
1244
-
1245
-		return $this->helper->quoteColumnName($tableAlias . $column);
1246
-	}
1247
-
1248
-	/**
1249
-	 * Returns the column name quoted and with table alias prefix as needed by the implementation
1250
-	 *
1251
-	 * @param string $alias
1252
-	 * @return string
1253
-	 */
1254
-	public function quoteAlias($alias) {
1255
-		if ($alias === '' || $alias === null) {
1256
-			return $alias;
1257
-		}
1258
-
1259
-		return $this->helper->quoteColumnName($alias);
1260
-	}
56
+    /** @var \OCP\IDBConnection */
57
+    private $connection;
58
+
59
+    /** @var SystemConfig */
60
+    private $systemConfig;
61
+
62
+    /** @var ILogger */
63
+    private $logger;
64
+
65
+    /** @var \Doctrine\DBAL\Query\QueryBuilder */
66
+    private $queryBuilder;
67
+
68
+    /** @var QuoteHelper */
69
+    private $helper;
70
+
71
+    /** @var bool */
72
+    private $automaticTablePrefix = true;
73
+
74
+    /** @var string */
75
+    protected $lastInsertedTable;
76
+
77
+    /**
78
+     * Initializes a new QueryBuilder.
79
+     *
80
+     * @param IDBConnection $connection
81
+     * @param SystemConfig $systemConfig
82
+     * @param ILogger $logger
83
+     */
84
+    public function __construct(IDBConnection $connection, SystemConfig $systemConfig, ILogger $logger) {
85
+        $this->connection = $connection;
86
+        $this->systemConfig = $systemConfig;
87
+        $this->logger = $logger;
88
+        $this->queryBuilder = new \Doctrine\DBAL\Query\QueryBuilder($this->connection);
89
+        $this->helper = new QuoteHelper();
90
+    }
91
+
92
+    /**
93
+     * Enable/disable automatic prefixing of table names with the oc_ prefix
94
+     *
95
+     * @param bool $enabled If set to true table names will be prefixed with the
96
+     * owncloud database prefix automatically.
97
+     * @since 8.2.0
98
+     */
99
+    public function automaticTablePrefix($enabled) {
100
+        $this->automaticTablePrefix = (bool) $enabled;
101
+    }
102
+
103
+    /**
104
+     * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
105
+     * This producer method is intended for convenient inline usage. Example:
106
+     *
107
+     * <code>
108
+     *     $qb = $conn->getQueryBuilder()
109
+     *         ->select('u')
110
+     *         ->from('users', 'u')
111
+     *         ->where($qb->expr()->eq('u.id', 1));
112
+     * </code>
113
+     *
114
+     * For more complex expression construction, consider storing the expression
115
+     * builder object in a local variable.
116
+     *
117
+     * @return \OCP\DB\QueryBuilder\IExpressionBuilder
118
+     */
119
+    public function expr() {
120
+        if ($this->connection instanceof OracleConnection) {
121
+            return new OCIExpressionBuilder($this->connection, $this);
122
+        } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
123
+            return new PgSqlExpressionBuilder($this->connection, $this);
124
+        } elseif ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
125
+            return new MySqlExpressionBuilder($this->connection, $this);
126
+        } elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
127
+            return new SqliteExpressionBuilder($this->connection, $this);
128
+        } else {
129
+            return new ExpressionBuilder($this->connection, $this);
130
+        }
131
+    }
132
+
133
+    /**
134
+     * Gets an FunctionBuilder used for object-oriented construction of query functions.
135
+     * This producer method is intended for convenient inline usage. Example:
136
+     *
137
+     * <code>
138
+     *     $qb = $conn->getQueryBuilder()
139
+     *         ->select('u')
140
+     *         ->from('users', 'u')
141
+     *         ->where($qb->fun()->md5('u.id'));
142
+     * </code>
143
+     *
144
+     * For more complex function construction, consider storing the function
145
+     * builder object in a local variable.
146
+     *
147
+     * @return \OCP\DB\QueryBuilder\IFunctionBuilder
148
+     */
149
+    public function func() {
150
+        if ($this->connection instanceof OracleConnection) {
151
+            return new OCIFunctionBuilder($this->helper);
152
+        } elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
153
+            return new SqliteFunctionBuilder($this->helper);
154
+        } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
155
+            return new PgSqlFunctionBuilder($this->helper);
156
+        } else {
157
+            return new FunctionBuilder($this->helper);
158
+        }
159
+    }
160
+
161
+    /**
162
+     * Gets the type of the currently built query.
163
+     *
164
+     * @return integer
165
+     */
166
+    public function getType() {
167
+        return $this->queryBuilder->getType();
168
+    }
169
+
170
+    /**
171
+     * Gets the associated DBAL Connection for this query builder.
172
+     *
173
+     * @return \OCP\IDBConnection
174
+     */
175
+    public function getConnection() {
176
+        return $this->connection;
177
+    }
178
+
179
+    /**
180
+     * Gets the state of this query builder instance.
181
+     *
182
+     * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
183
+     */
184
+    public function getState() {
185
+        return $this->queryBuilder->getState();
186
+    }
187
+
188
+    /**
189
+     * Executes this query using the bound parameters and their types.
190
+     *
191
+     * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
192
+     * for insert, update and delete statements.
193
+     *
194
+     * @return \Doctrine\DBAL\Driver\Statement|int
195
+     */
196
+    public function execute() {
197
+        if ($this->systemConfig->getValue('log_query', false)) {
198
+            try {
199
+                $params = [];
200
+                foreach ($this->getParameters() as $placeholder => $value) {
201
+                    if ($value instanceof \DateTime) {
202
+                        $params[] = $placeholder . ' => DateTime:\'' . $value->format('c') . '\'';
203
+                    } elseif (is_array($value)) {
204
+                        $params[] = $placeholder . ' => (\'' . implode('\', \'', $value) . '\')';
205
+                    } else {
206
+                        $params[] = $placeholder . ' => \'' . $value . '\'';
207
+                    }
208
+                }
209
+                if (empty($params)) {
210
+                    $this->logger->debug('DB QueryBuilder: \'{query}\'', [
211
+                        'query' => $this->getSQL(),
212
+                        'app' => 'core',
213
+                    ]);
214
+                } else {
215
+                    $this->logger->debug('DB QueryBuilder: \'{query}\' with parameters: {params}', [
216
+                        'query' => $this->getSQL(),
217
+                        'params' => implode(', ', $params),
218
+                        'app' => 'core',
219
+                    ]);
220
+                }
221
+            } catch (\Error $e) {
222
+                // likely an error during conversion of $value to string
223
+                $this->logger->debug('DB QueryBuilder: error trying to log SQL query');
224
+                $this->logger->logException($e);
225
+            }
226
+        }
227
+
228
+        if (!empty($this->getQueryPart('select'))) {
229
+            $select = $this->getQueryPart('select');
230
+            $hasSelectAll = array_filter($select, static function ($s) {
231
+                return $s === '*';
232
+            });
233
+            $hasSelectSpecific = array_filter($select, static function ($s) {
234
+                return $s !== '*';
235
+            });
236
+
237
+            if (empty($hasSelectAll) === empty($hasSelectSpecific)) {
238
+                $exception = new QueryException('Query is selecting * and specific values in the same query. This is not supported in Oracle.');
239
+                $this->logger->logException($exception, [
240
+                    'message' => 'Query is selecting * and specific values in the same query. This is not supported in Oracle.',
241
+                    'query' => $this->getSQL(),
242
+                    'level' => ILogger::ERROR,
243
+                    'app' => 'core',
244
+                ]);
245
+            }
246
+        }
247
+
248
+        return $this->queryBuilder->execute();
249
+    }
250
+
251
+    /**
252
+     * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
253
+     *
254
+     * <code>
255
+     *     $qb = $conn->getQueryBuilder()
256
+     *         ->select('u')
257
+     *         ->from('User', 'u')
258
+     *     echo $qb->getSQL(); // SELECT u FROM User u
259
+     * </code>
260
+     *
261
+     * @return string The SQL query string.
262
+     */
263
+    public function getSQL() {
264
+        return $this->queryBuilder->getSQL();
265
+    }
266
+
267
+    /**
268
+     * Sets a query parameter for the query being constructed.
269
+     *
270
+     * <code>
271
+     *     $qb = $conn->getQueryBuilder()
272
+     *         ->select('u')
273
+     *         ->from('users', 'u')
274
+     *         ->where('u.id = :user_id')
275
+     *         ->setParameter(':user_id', 1);
276
+     * </code>
277
+     *
278
+     * @param string|integer $key The parameter position or name.
279
+     * @param mixed $value The parameter value.
280
+     * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
281
+     *
282
+     * @return $this This QueryBuilder instance.
283
+     */
284
+    public function setParameter($key, $value, $type = null) {
285
+        $this->queryBuilder->setParameter($key, $value, $type);
286
+
287
+        return $this;
288
+    }
289
+
290
+    /**
291
+     * Sets a collection of query parameters for the query being constructed.
292
+     *
293
+     * <code>
294
+     *     $qb = $conn->getQueryBuilder()
295
+     *         ->select('u')
296
+     *         ->from('users', 'u')
297
+     *         ->where('u.id = :user_id1 OR u.id = :user_id2')
298
+     *         ->setParameters(array(
299
+     *             ':user_id1' => 1,
300
+     *             ':user_id2' => 2
301
+     *         ));
302
+     * </code>
303
+     *
304
+     * @param array $params The query parameters to set.
305
+     * @param array $types The query parameters types to set.
306
+     *
307
+     * @return $this This QueryBuilder instance.
308
+     */
309
+    public function setParameters(array $params, array $types = []) {
310
+        $this->queryBuilder->setParameters($params, $types);
311
+
312
+        return $this;
313
+    }
314
+
315
+    /**
316
+     * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
317
+     *
318
+     * @return array The currently defined query parameters indexed by parameter index or name.
319
+     */
320
+    public function getParameters() {
321
+        return $this->queryBuilder->getParameters();
322
+    }
323
+
324
+    /**
325
+     * Gets a (previously set) query parameter of the query being constructed.
326
+     *
327
+     * @param mixed $key The key (index or name) of the bound parameter.
328
+     *
329
+     * @return mixed The value of the bound parameter.
330
+     */
331
+    public function getParameter($key) {
332
+        return $this->queryBuilder->getParameter($key);
333
+    }
334
+
335
+    /**
336
+     * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
337
+     *
338
+     * @return array The currently defined query parameter types indexed by parameter index or name.
339
+     */
340
+    public function getParameterTypes() {
341
+        return $this->queryBuilder->getParameterTypes();
342
+    }
343
+
344
+    /**
345
+     * Gets a (previously set) query parameter type of the query being constructed.
346
+     *
347
+     * @param mixed $key The key (index or name) of the bound parameter type.
348
+     *
349
+     * @return mixed The value of the bound parameter type.
350
+     */
351
+    public function getParameterType($key) {
352
+        return $this->queryBuilder->getParameterType($key);
353
+    }
354
+
355
+    /**
356
+     * Sets the position of the first result to retrieve (the "offset").
357
+     *
358
+     * @param integer $firstResult The first result to return.
359
+     *
360
+     * @return $this This QueryBuilder instance.
361
+     */
362
+    public function setFirstResult($firstResult) {
363
+        $this->queryBuilder->setFirstResult($firstResult);
364
+
365
+        return $this;
366
+    }
367
+
368
+    /**
369
+     * Gets the position of the first result the query object was set to retrieve (the "offset").
370
+     * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
371
+     *
372
+     * @return integer The position of the first result.
373
+     */
374
+    public function getFirstResult() {
375
+        return $this->queryBuilder->getFirstResult();
376
+    }
377
+
378
+    /**
379
+     * Sets the maximum number of results to retrieve (the "limit").
380
+     *
381
+     * NOTE: Setting max results to "0" will cause mixed behaviour. While most
382
+     * of the databases will just return an empty result set, Oracle will return
383
+     * all entries.
384
+     *
385
+     * @param integer $maxResults The maximum number of results to retrieve.
386
+     *
387
+     * @return $this This QueryBuilder instance.
388
+     */
389
+    public function setMaxResults($maxResults) {
390
+        $this->queryBuilder->setMaxResults($maxResults);
391
+
392
+        return $this;
393
+    }
394
+
395
+    /**
396
+     * Gets the maximum number of results the query object was set to retrieve (the "limit").
397
+     * Returns NULL if {@link setMaxResults} was not applied to this query builder.
398
+     *
399
+     * @return int|null The maximum number of results.
400
+     */
401
+    public function getMaxResults() {
402
+        return $this->queryBuilder->getMaxResults();
403
+    }
404
+
405
+    /**
406
+     * Specifies an item that is to be returned in the query result.
407
+     * Replaces any previously specified selections, if any.
408
+     *
409
+     * <code>
410
+     *     $qb = $conn->getQueryBuilder()
411
+     *         ->select('u.id', 'p.id')
412
+     *         ->from('users', 'u')
413
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
414
+     * </code>
415
+     *
416
+     * @param mixed ...$selects The selection expressions.
417
+     *
418
+     * '@return $this This QueryBuilder instance.
419
+     */
420
+    public function select(...$selects) {
421
+        if (count($selects) === 1 && is_array($selects[0])) {
422
+            $selects = $selects[0];
423
+        }
424
+
425
+        $this->queryBuilder->select(
426
+            $this->helper->quoteColumnNames($selects)
427
+        );
428
+
429
+        return $this;
430
+    }
431
+
432
+    /**
433
+     * Specifies an item that is to be returned with a different name in the query result.
434
+     *
435
+     * <code>
436
+     *     $qb = $conn->getQueryBuilder()
437
+     *         ->selectAlias('u.id', 'user_id')
438
+     *         ->from('users', 'u')
439
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
440
+     * </code>
441
+     *
442
+     * @param mixed $select The selection expressions.
443
+     * @param string $alias The column alias used in the constructed query.
444
+     *
445
+     * @return $this This QueryBuilder instance.
446
+     */
447
+    public function selectAlias($select, $alias) {
448
+        $this->queryBuilder->addSelect(
449
+            $this->helper->quoteColumnName($select) . ' AS ' . $this->helper->quoteColumnName($alias)
450
+        );
451
+
452
+        return $this;
453
+    }
454
+
455
+    /**
456
+     * Specifies an item that is to be returned uniquely in the query result.
457
+     *
458
+     * <code>
459
+     *     $qb = $conn->getQueryBuilder()
460
+     *         ->selectDistinct('type')
461
+     *         ->from('users');
462
+     * </code>
463
+     *
464
+     * @param mixed $select The selection expressions.
465
+     *
466
+     * @return $this This QueryBuilder instance.
467
+     */
468
+    public function selectDistinct($select) {
469
+        if (!is_array($select)) {
470
+            $select = [$select];
471
+        }
472
+
473
+        $quotedSelect = $this->helper->quoteColumnNames($select);
474
+
475
+        $this->queryBuilder->addSelect(
476
+            'DISTINCT ' . implode(', ', $quotedSelect)
477
+        );
478
+
479
+        return $this;
480
+    }
481
+
482
+    /**
483
+     * Adds an item that is to be returned in the query result.
484
+     *
485
+     * <code>
486
+     *     $qb = $conn->getQueryBuilder()
487
+     *         ->select('u.id')
488
+     *         ->addSelect('p.id')
489
+     *         ->from('users', 'u')
490
+     *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
491
+     * </code>
492
+     *
493
+     * @param mixed ...$selects The selection expression.
494
+     *
495
+     * @return $this This QueryBuilder instance.
496
+     */
497
+    public function addSelect(...$selects) {
498
+        if (count($selects) === 1 && is_array($selects[0])) {
499
+            $selects = $selects[0];
500
+        }
501
+
502
+        $this->queryBuilder->addSelect(
503
+            $this->helper->quoteColumnNames($selects)
504
+        );
505
+
506
+        return $this;
507
+    }
508
+
509
+    /**
510
+     * Turns the query being built into a bulk delete query that ranges over
511
+     * a certain table.
512
+     *
513
+     * <code>
514
+     *     $qb = $conn->getQueryBuilder()
515
+     *         ->delete('users', 'u')
516
+     *         ->where('u.id = :user_id');
517
+     *         ->setParameter(':user_id', 1);
518
+     * </code>
519
+     *
520
+     * @param string $delete The table whose rows are subject to the deletion.
521
+     * @param string $alias The table alias used in the constructed query.
522
+     *
523
+     * @return $this This QueryBuilder instance.
524
+     */
525
+    public function delete($delete = null, $alias = null) {
526
+        $this->queryBuilder->delete(
527
+            $this->getTableName($delete),
528
+            $alias
529
+        );
530
+
531
+        return $this;
532
+    }
533
+
534
+    /**
535
+     * Turns the query being built into a bulk update query that ranges over
536
+     * a certain table
537
+     *
538
+     * <code>
539
+     *     $qb = $conn->getQueryBuilder()
540
+     *         ->update('users', 'u')
541
+     *         ->set('u.password', md5('password'))
542
+     *         ->where('u.id = ?');
543
+     * </code>
544
+     *
545
+     * @param string $update The table whose rows are subject to the update.
546
+     * @param string $alias The table alias used in the constructed query.
547
+     *
548
+     * @return $this This QueryBuilder instance.
549
+     */
550
+    public function update($update = null, $alias = null) {
551
+        $this->queryBuilder->update(
552
+            $this->getTableName($update),
553
+            $alias
554
+        );
555
+
556
+        return $this;
557
+    }
558
+
559
+    /**
560
+     * Turns the query being built into an insert query that inserts into
561
+     * a certain table
562
+     *
563
+     * <code>
564
+     *     $qb = $conn->getQueryBuilder()
565
+     *         ->insert('users')
566
+     *         ->values(
567
+     *             array(
568
+     *                 'name' => '?',
569
+     *                 'password' => '?'
570
+     *             )
571
+     *         );
572
+     * </code>
573
+     *
574
+     * @param string $insert The table into which the rows should be inserted.
575
+     *
576
+     * @return $this This QueryBuilder instance.
577
+     */
578
+    public function insert($insert = null) {
579
+        $this->queryBuilder->insert(
580
+            $this->getTableName($insert)
581
+        );
582
+
583
+        $this->lastInsertedTable = $insert;
584
+
585
+        return $this;
586
+    }
587
+
588
+    /**
589
+     * Creates and adds a query root corresponding to the table identified by the
590
+     * given alias, forming a cartesian product with any existing query roots.
591
+     *
592
+     * <code>
593
+     *     $qb = $conn->getQueryBuilder()
594
+     *         ->select('u.id')
595
+     *         ->from('users', 'u')
596
+     * </code>
597
+     *
598
+     * @param string $from The table.
599
+     * @param string|null $alias The alias of the table.
600
+     *
601
+     * @return $this This QueryBuilder instance.
602
+     */
603
+    public function from($from, $alias = null) {
604
+        $this->queryBuilder->from(
605
+            $this->getTableName($from),
606
+            $this->quoteAlias($alias)
607
+        );
608
+
609
+        return $this;
610
+    }
611
+
612
+    /**
613
+     * Creates and adds a join to the query.
614
+     *
615
+     * <code>
616
+     *     $qb = $conn->getQueryBuilder()
617
+     *         ->select('u.name')
618
+     *         ->from('users', 'u')
619
+     *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
620
+     * </code>
621
+     *
622
+     * @param string $fromAlias The alias that points to a from clause.
623
+     * @param string $join The table name to join.
624
+     * @param string $alias The alias of the join table.
625
+     * @param string $condition The condition for the join.
626
+     *
627
+     * @return $this This QueryBuilder instance.
628
+     */
629
+    public function join($fromAlias, $join, $alias, $condition = null) {
630
+        $this->queryBuilder->join(
631
+            $this->quoteAlias($fromAlias),
632
+            $this->getTableName($join),
633
+            $this->quoteAlias($alias),
634
+            $condition
635
+        );
636
+
637
+        return $this;
638
+    }
639
+
640
+    /**
641
+     * Creates and adds a join to the query.
642
+     *
643
+     * <code>
644
+     *     $qb = $conn->getQueryBuilder()
645
+     *         ->select('u.name')
646
+     *         ->from('users', 'u')
647
+     *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
648
+     * </code>
649
+     *
650
+     * @param string $fromAlias The alias that points to a from clause.
651
+     * @param string $join The table name to join.
652
+     * @param string $alias The alias of the join table.
653
+     * @param string $condition The condition for the join.
654
+     *
655
+     * @return $this This QueryBuilder instance.
656
+     */
657
+    public function innerJoin($fromAlias, $join, $alias, $condition = null) {
658
+        $this->queryBuilder->innerJoin(
659
+            $this->quoteAlias($fromAlias),
660
+            $this->getTableName($join),
661
+            $this->quoteAlias($alias),
662
+            $condition
663
+        );
664
+
665
+        return $this;
666
+    }
667
+
668
+    /**
669
+     * Creates and adds a left join to the query.
670
+     *
671
+     * <code>
672
+     *     $qb = $conn->getQueryBuilder()
673
+     *         ->select('u.name')
674
+     *         ->from('users', 'u')
675
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
676
+     * </code>
677
+     *
678
+     * @param string $fromAlias The alias that points to a from clause.
679
+     * @param string $join The table name to join.
680
+     * @param string $alias The alias of the join table.
681
+     * @param string $condition The condition for the join.
682
+     *
683
+     * @return $this This QueryBuilder instance.
684
+     */
685
+    public function leftJoin($fromAlias, $join, $alias, $condition = null) {
686
+        $this->queryBuilder->leftJoin(
687
+            $this->quoteAlias($fromAlias),
688
+            $this->getTableName($join),
689
+            $this->quoteAlias($alias),
690
+            $condition
691
+        );
692
+
693
+        return $this;
694
+    }
695
+
696
+    /**
697
+     * Creates and adds a right join to the query.
698
+     *
699
+     * <code>
700
+     *     $qb = $conn->getQueryBuilder()
701
+     *         ->select('u.name')
702
+     *         ->from('users', 'u')
703
+     *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
704
+     * </code>
705
+     *
706
+     * @param string $fromAlias The alias that points to a from clause.
707
+     * @param string $join The table name to join.
708
+     * @param string $alias The alias of the join table.
709
+     * @param string $condition The condition for the join.
710
+     *
711
+     * @return $this This QueryBuilder instance.
712
+     */
713
+    public function rightJoin($fromAlias, $join, $alias, $condition = null) {
714
+        $this->queryBuilder->rightJoin(
715
+            $this->quoteAlias($fromAlias),
716
+            $this->getTableName($join),
717
+            $this->quoteAlias($alias),
718
+            $condition
719
+        );
720
+
721
+        return $this;
722
+    }
723
+
724
+    /**
725
+     * Sets a new value for a column in a bulk update query.
726
+     *
727
+     * <code>
728
+     *     $qb = $conn->getQueryBuilder()
729
+     *         ->update('users', 'u')
730
+     *         ->set('u.password', md5('password'))
731
+     *         ->where('u.id = ?');
732
+     * </code>
733
+     *
734
+     * @param string $key The column to set.
735
+     * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
736
+     *
737
+     * @return $this This QueryBuilder instance.
738
+     */
739
+    public function set($key, $value) {
740
+        $this->queryBuilder->set(
741
+            $this->helper->quoteColumnName($key),
742
+            $this->helper->quoteColumnName($value)
743
+        );
744
+
745
+        return $this;
746
+    }
747
+
748
+    /**
749
+     * Specifies one or more restrictions to the query result.
750
+     * Replaces any previously specified restrictions, if any.
751
+     *
752
+     * <code>
753
+     *     $qb = $conn->getQueryBuilder()
754
+     *         ->select('u.name')
755
+     *         ->from('users', 'u')
756
+     *         ->where('u.id = ?');
757
+     *
758
+     *     // You can optionally programatically build and/or expressions
759
+     *     $qb = $conn->getQueryBuilder();
760
+     *
761
+     *     $or = $qb->expr()->orx();
762
+     *     $or->add($qb->expr()->eq('u.id', 1));
763
+     *     $or->add($qb->expr()->eq('u.id', 2));
764
+     *
765
+     *     $qb->update('users', 'u')
766
+     *         ->set('u.password', md5('password'))
767
+     *         ->where($or);
768
+     * </code>
769
+     *
770
+     * @param mixed ...$predicates The restriction predicates.
771
+     *
772
+     * @return $this This QueryBuilder instance.
773
+     */
774
+    public function where(...$predicates) {
775
+        call_user_func_array(
776
+            [$this->queryBuilder, 'where'],
777
+            $predicates
778
+        );
779
+
780
+        return $this;
781
+    }
782
+
783
+    /**
784
+     * Adds one or more restrictions to the query results, forming a logical
785
+     * conjunction with any previously specified restrictions.
786
+     *
787
+     * <code>
788
+     *     $qb = $conn->getQueryBuilder()
789
+     *         ->select('u')
790
+     *         ->from('users', 'u')
791
+     *         ->where('u.username LIKE ?')
792
+     *         ->andWhere('u.is_active = 1');
793
+     * </code>
794
+     *
795
+     * @param mixed ...$where The query restrictions.
796
+     *
797
+     * @return $this This QueryBuilder instance.
798
+     *
799
+     * @see where()
800
+     */
801
+    public function andWhere(...$where) {
802
+        call_user_func_array(
803
+            [$this->queryBuilder, 'andWhere'],
804
+            $where
805
+        );
806
+
807
+        return $this;
808
+    }
809
+
810
+    /**
811
+     * Adds one or more restrictions to the query results, forming a logical
812
+     * disjunction with any previously specified restrictions.
813
+     *
814
+     * <code>
815
+     *     $qb = $conn->getQueryBuilder()
816
+     *         ->select('u.name')
817
+     *         ->from('users', 'u')
818
+     *         ->where('u.id = 1')
819
+     *         ->orWhere('u.id = 2');
820
+     * </code>
821
+     *
822
+     * @param mixed ...$where The WHERE statement.
823
+     *
824
+     * @return $this This QueryBuilder instance.
825
+     *
826
+     * @see where()
827
+     */
828
+    public function orWhere(...$where) {
829
+        call_user_func_array(
830
+            [$this->queryBuilder, 'orWhere'],
831
+            $where
832
+        );
833
+
834
+        return $this;
835
+    }
836
+
837
+    /**
838
+     * Specifies a grouping over the results of the query.
839
+     * Replaces any previously specified groupings, if any.
840
+     *
841
+     * <code>
842
+     *     $qb = $conn->getQueryBuilder()
843
+     *         ->select('u.name')
844
+     *         ->from('users', 'u')
845
+     *         ->groupBy('u.id');
846
+     * </code>
847
+     *
848
+     * @param mixed ...$groupBys The grouping expression.
849
+     *
850
+     * @return $this This QueryBuilder instance.
851
+     */
852
+    public function groupBy(...$groupBys) {
853
+        if (count($groupBys) === 1 && is_array($groupBys[0])) {
854
+            $groupBys = $groupBys[0];
855
+        }
856
+
857
+        call_user_func_array(
858
+            [$this->queryBuilder, 'groupBy'],
859
+            $this->helper->quoteColumnNames($groupBys)
860
+        );
861
+
862
+        return $this;
863
+    }
864
+
865
+    /**
866
+     * Adds a grouping expression to the query.
867
+     *
868
+     * <code>
869
+     *     $qb = $conn->getQueryBuilder()
870
+     *         ->select('u.name')
871
+     *         ->from('users', 'u')
872
+     *         ->groupBy('u.lastLogin');
873
+     *         ->addGroupBy('u.createdAt')
874
+     * </code>
875
+     *
876
+     * @param mixed ...$groupBy The grouping expression.
877
+     *
878
+     * @return $this This QueryBuilder instance.
879
+     */
880
+    public function addGroupBy(...$groupBys) {
881
+        if (count($groupBys) === 1 && is_array($groupBys[0])) {
882
+            $$groupBys = $groupBys[0];
883
+        }
884
+
885
+        call_user_func_array(
886
+            [$this->queryBuilder, 'addGroupBy'],
887
+            $this->helper->quoteColumnNames($groupBys)
888
+        );
889
+
890
+        return $this;
891
+    }
892
+
893
+    /**
894
+     * Sets a value for a column in an insert query.
895
+     *
896
+     * <code>
897
+     *     $qb = $conn->getQueryBuilder()
898
+     *         ->insert('users')
899
+     *         ->values(
900
+     *             array(
901
+     *                 'name' => '?'
902
+     *             )
903
+     *         )
904
+     *         ->setValue('password', '?');
905
+     * </code>
906
+     *
907
+     * @param string $column The column into which the value should be inserted.
908
+     * @param IParameter|string $value The value that should be inserted into the column.
909
+     *
910
+     * @return $this This QueryBuilder instance.
911
+     */
912
+    public function setValue($column, $value) {
913
+        $this->queryBuilder->setValue(
914
+            $this->helper->quoteColumnName($column),
915
+            (string) $value
916
+        );
917
+
918
+        return $this;
919
+    }
920
+
921
+    /**
922
+     * Specifies values for an insert query indexed by column names.
923
+     * Replaces any previous values, if any.
924
+     *
925
+     * <code>
926
+     *     $qb = $conn->getQueryBuilder()
927
+     *         ->insert('users')
928
+     *         ->values(
929
+     *             array(
930
+     *                 'name' => '?',
931
+     *                 'password' => '?'
932
+     *             )
933
+     *         );
934
+     * </code>
935
+     *
936
+     * @param array $values The values to specify for the insert query indexed by column names.
937
+     *
938
+     * @return $this This QueryBuilder instance.
939
+     */
940
+    public function values(array $values) {
941
+        $quotedValues = [];
942
+        foreach ($values as $key => $value) {
943
+            $quotedValues[$this->helper->quoteColumnName($key)] = $value;
944
+        }
945
+
946
+        $this->queryBuilder->values($quotedValues);
947
+
948
+        return $this;
949
+    }
950
+
951
+    /**
952
+     * Specifies a restriction over the groups of the query.
953
+     * Replaces any previous having restrictions, if any.
954
+     *
955
+     * @param mixed ...$having The restriction over the groups.
956
+     *
957
+     * @return $this This QueryBuilder instance.
958
+     */
959
+    public function having(...$having) {
960
+        call_user_func_array(
961
+            [$this->queryBuilder, 'having'],
962
+            $having
963
+        );
964
+
965
+        return $this;
966
+    }
967
+
968
+    /**
969
+     * Adds a restriction over the groups of the query, forming a logical
970
+     * conjunction with any existing having restrictions.
971
+     *
972
+     * @param mixed ...$having The restriction to append.
973
+     *
974
+     * @return $this This QueryBuilder instance.
975
+     */
976
+    public function andHaving(...$having) {
977
+        call_user_func_array(
978
+            [$this->queryBuilder, 'andHaving'],
979
+            $having
980
+        );
981
+
982
+        return $this;
983
+    }
984
+
985
+    /**
986
+     * Adds a restriction over the groups of the query, forming a logical
987
+     * disjunction with any existing having restrictions.
988
+     *
989
+     * @param mixed ...$having The restriction to add.
990
+     *
991
+     * @return $this This QueryBuilder instance.
992
+     */
993
+    public function orHaving(...$having) {
994
+        call_user_func_array(
995
+            [$this->queryBuilder, 'orHaving'],
996
+            $having
997
+        );
998
+
999
+        return $this;
1000
+    }
1001
+
1002
+    /**
1003
+     * Specifies an ordering for the query results.
1004
+     * Replaces any previously specified orderings, if any.
1005
+     *
1006
+     * @param string $sort The ordering expression.
1007
+     * @param string $order The ordering direction.
1008
+     *
1009
+     * @return $this This QueryBuilder instance.
1010
+     */
1011
+    public function orderBy($sort, $order = null) {
1012
+        $this->queryBuilder->orderBy(
1013
+            $this->helper->quoteColumnName($sort),
1014
+            $order
1015
+        );
1016
+
1017
+        return $this;
1018
+    }
1019
+
1020
+    /**
1021
+     * Adds an ordering to the query results.
1022
+     *
1023
+     * @param string $sort The ordering expression.
1024
+     * @param string $order The ordering direction.
1025
+     *
1026
+     * @return $this This QueryBuilder instance.
1027
+     */
1028
+    public function addOrderBy($sort, $order = null) {
1029
+        $this->queryBuilder->addOrderBy(
1030
+            $this->helper->quoteColumnName($sort),
1031
+            $order
1032
+        );
1033
+
1034
+        return $this;
1035
+    }
1036
+
1037
+    /**
1038
+     * Gets a query part by its name.
1039
+     *
1040
+     * @param string $queryPartName
1041
+     *
1042
+     * @return mixed
1043
+     */
1044
+    public function getQueryPart($queryPartName) {
1045
+        return $this->queryBuilder->getQueryPart($queryPartName);
1046
+    }
1047
+
1048
+    /**
1049
+     * Gets all query parts.
1050
+     *
1051
+     * @return array
1052
+     */
1053
+    public function getQueryParts() {
1054
+        return $this->queryBuilder->getQueryParts();
1055
+    }
1056
+
1057
+    /**
1058
+     * Resets SQL parts.
1059
+     *
1060
+     * @param array|null $queryPartNames
1061
+     *
1062
+     * @return $this This QueryBuilder instance.
1063
+     */
1064
+    public function resetQueryParts($queryPartNames = null) {
1065
+        $this->queryBuilder->resetQueryParts($queryPartNames);
1066
+
1067
+        return $this;
1068
+    }
1069
+
1070
+    /**
1071
+     * Resets a single SQL part.
1072
+     *
1073
+     * @param string $queryPartName
1074
+     *
1075
+     * @return $this This QueryBuilder instance.
1076
+     */
1077
+    public function resetQueryPart($queryPartName) {
1078
+        $this->queryBuilder->resetQueryPart($queryPartName);
1079
+
1080
+        return $this;
1081
+    }
1082
+
1083
+    /**
1084
+     * Creates a new named parameter and bind the value $value to it.
1085
+     *
1086
+     * This method provides a shortcut for PDOStatement::bindValue
1087
+     * when using prepared statements.
1088
+     *
1089
+     * The parameter $value specifies the value that you want to bind. If
1090
+     * $placeholder is not provided bindValue() will automatically create a
1091
+     * placeholder for you. An automatic placeholder will be of the name
1092
+     * ':dcValue1', ':dcValue2' etc.
1093
+     *
1094
+     * For more information see {@link https://www.php.net/pdostatement-bindparam}
1095
+     *
1096
+     * Example:
1097
+     * <code>
1098
+     * $value = 2;
1099
+     * $q->eq( 'id', $q->bindValue( $value ) );
1100
+     * $stmt = $q->executeQuery(); // executed with 'id = 2'
1101
+     * </code>
1102
+     *
1103
+     * @license New BSD License
1104
+     * @link http://www.zetacomponents.org
1105
+     *
1106
+     * @param mixed $value
1107
+     * @param mixed $type
1108
+     * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
1109
+     *
1110
+     * @return IParameter the placeholder name used.
1111
+     */
1112
+    public function createNamedParameter($value, $type = IQueryBuilder::PARAM_STR, $placeHolder = null) {
1113
+        return new Parameter($this->queryBuilder->createNamedParameter($value, $type, $placeHolder));
1114
+    }
1115
+
1116
+    /**
1117
+     * Creates a new positional parameter and bind the given value to it.
1118
+     *
1119
+     * Attention: If you are using positional parameters with the query builder you have
1120
+     * to be very careful to bind all parameters in the order they appear in the SQL
1121
+     * statement , otherwise they get bound in the wrong order which can lead to serious
1122
+     * bugs in your code.
1123
+     *
1124
+     * Example:
1125
+     * <code>
1126
+     *  $qb = $conn->getQueryBuilder();
1127
+     *  $qb->select('u.*')
1128
+     *     ->from('users', 'u')
1129
+     *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
1130
+     *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
1131
+     * </code>
1132
+     *
1133
+     * @param mixed $value
1134
+     * @param integer $type
1135
+     *
1136
+     * @return IParameter
1137
+     */
1138
+    public function createPositionalParameter($value, $type = IQueryBuilder::PARAM_STR) {
1139
+        return new Parameter($this->queryBuilder->createPositionalParameter($value, $type));
1140
+    }
1141
+
1142
+    /**
1143
+     * Creates a new parameter
1144
+     *
1145
+     * Example:
1146
+     * <code>
1147
+     *  $qb = $conn->getQueryBuilder();
1148
+     *  $qb->select('u.*')
1149
+     *     ->from('users', 'u')
1150
+     *     ->where('u.username = ' . $qb->createParameter('name'))
1151
+     *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
1152
+     * </code>
1153
+     *
1154
+     * @param string $name
1155
+     *
1156
+     * @return IParameter
1157
+     */
1158
+    public function createParameter($name) {
1159
+        return new Parameter(':' . $name);
1160
+    }
1161
+
1162
+    /**
1163
+     * Creates a new function
1164
+     *
1165
+     * Attention: Column names inside the call have to be quoted before hand
1166
+     *
1167
+     * Example:
1168
+     * <code>
1169
+     *  $qb = $conn->getQueryBuilder();
1170
+     *  $qb->select($qb->createFunction('COUNT(*)'))
1171
+     *     ->from('users', 'u')
1172
+     *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
1173
+     * </code>
1174
+     * <code>
1175
+     *  $qb = $conn->getQueryBuilder();
1176
+     *  $qb->select($qb->createFunction('COUNT(`column`)'))
1177
+     *     ->from('users', 'u')
1178
+     *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
1179
+     * </code>
1180
+     *
1181
+     * @param string $call
1182
+     *
1183
+     * @return IQueryFunction
1184
+     */
1185
+    public function createFunction($call) {
1186
+        return new QueryFunction($call);
1187
+    }
1188
+
1189
+    /**
1190
+     * Used to get the id of the last inserted element
1191
+     * @return int
1192
+     * @throws \BadMethodCallException When being called before an insert query has been run.
1193
+     */
1194
+    public function getLastInsertId() {
1195
+        if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) {
1196
+            // lastInsertId() needs the prefix but no quotes
1197
+            $table = $this->prefixTableName($this->lastInsertedTable);
1198
+            return (int) $this->connection->lastInsertId($table);
1199
+        }
1200
+
1201
+        throw new \BadMethodCallException('Invalid call to getLastInsertId without using insert() before.');
1202
+    }
1203
+
1204
+    /**
1205
+     * Returns the table name quoted and with database prefix as needed by the implementation
1206
+     *
1207
+     * @param string $table
1208
+     * @return string
1209
+     */
1210
+    public function getTableName($table) {
1211
+        if ($table instanceof IQueryFunction) {
1212
+            return (string) $table;
1213
+        }
1214
+
1215
+        $table = $this->prefixTableName($table);
1216
+        return $this->helper->quoteColumnName($table);
1217
+    }
1218
+
1219
+    /**
1220
+     * Returns the table name with database prefix as needed by the implementation
1221
+     *
1222
+     * @param string $table
1223
+     * @return string
1224
+     */
1225
+    protected function prefixTableName($table) {
1226
+        if ($this->automaticTablePrefix === false || strpos($table, '*PREFIX*') === 0) {
1227
+            return $table;
1228
+        }
1229
+
1230
+        return '*PREFIX*' . $table;
1231
+    }
1232
+
1233
+    /**
1234
+     * Returns the column name quoted and with table alias prefix as needed by the implementation
1235
+     *
1236
+     * @param string $column
1237
+     * @param string $tableAlias
1238
+     * @return string
1239
+     */
1240
+    public function getColumnName($column, $tableAlias = '') {
1241
+        if ($tableAlias !== '') {
1242
+            $tableAlias .= '.';
1243
+        }
1244
+
1245
+        return $this->helper->quoteColumnName($tableAlias . $column);
1246
+    }
1247
+
1248
+    /**
1249
+     * Returns the column name quoted and with table alias prefix as needed by the implementation
1250
+     *
1251
+     * @param string $alias
1252
+     * @return string
1253
+     */
1254
+    public function quoteAlias($alias) {
1255
+        if ($alias === '' || $alias === null) {
1256
+            return $alias;
1257
+        }
1258
+
1259
+        return $this->helper->quoteColumnName($alias);
1260
+    }
1261 1261
 }
Please login to merge, or discard this patch.
lib/private/Share/SearchResultSorter.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -29,50 +29,50 @@
 block discarded – undo
29 29
 use OCP\ILogger;
30 30
 
31 31
 class SearchResultSorter {
32
-	private $search;
33
-	private $encoding;
34
-	private $key;
35
-	private $log;
32
+    private $search;
33
+    private $encoding;
34
+    private $key;
35
+    private $log;
36 36
 
37
-	/**
38
-	 * @param string $search the search term as was given by the user
39
-	 * @param string $key the array key containing the value that should be compared
40
-	 * against
41
-	 * @param string $encoding optional, encoding to use, defaults to UTF-8
42
-	 * @param ILogger $log optional
43
-	 */
44
-	public function __construct($search, $key, ILogger $log = null, $encoding = 'UTF-8') {
45
-		$this->encoding = $encoding;
46
-		$this->key = $key;
47
-		$this->log = $log;
48
-		$this->search = mb_strtolower($search, $this->encoding);
49
-	}
37
+    /**
38
+     * @param string $search the search term as was given by the user
39
+     * @param string $key the array key containing the value that should be compared
40
+     * against
41
+     * @param string $encoding optional, encoding to use, defaults to UTF-8
42
+     * @param ILogger $log optional
43
+     */
44
+    public function __construct($search, $key, ILogger $log = null, $encoding = 'UTF-8') {
45
+        $this->encoding = $encoding;
46
+        $this->key = $key;
47
+        $this->log = $log;
48
+        $this->search = mb_strtolower($search, $this->encoding);
49
+    }
50 50
 
51
-	/**
52
-	 * User and Group names matching the search term at the beginning shall appear
53
-	 * on top of the share dialog. Following entries in alphabetical order.
54
-	 * Callback function for usort. https://www.php.net/usort
55
-	 */
56
-	public function sort($a, $b) {
57
-		if (!isset($a[$this->key]) || !isset($b[$this->key])) {
58
-			if (!is_null($this->log)) {
59
-				$this->log->error('Sharing dialogue: cannot sort due to ' .
60
-								  'missing array key', ['app' => 'core']);
61
-			}
62
-			return 0;
63
-		}
64
-		$nameA = mb_strtolower($a[$this->key], $this->encoding);
65
-		$nameB = mb_strtolower($b[$this->key], $this->encoding);
66
-		$i = mb_strpos($nameA, $this->search, 0, $this->encoding);
67
-		$j = mb_strpos($nameB, $this->search, 0, $this->encoding);
51
+    /**
52
+     * User and Group names matching the search term at the beginning shall appear
53
+     * on top of the share dialog. Following entries in alphabetical order.
54
+     * Callback function for usort. https://www.php.net/usort
55
+     */
56
+    public function sort($a, $b) {
57
+        if (!isset($a[$this->key]) || !isset($b[$this->key])) {
58
+            if (!is_null($this->log)) {
59
+                $this->log->error('Sharing dialogue: cannot sort due to ' .
60
+                                    'missing array key', ['app' => 'core']);
61
+            }
62
+            return 0;
63
+        }
64
+        $nameA = mb_strtolower($a[$this->key], $this->encoding);
65
+        $nameB = mb_strtolower($b[$this->key], $this->encoding);
66
+        $i = mb_strpos($nameA, $this->search, 0, $this->encoding);
67
+        $j = mb_strpos($nameB, $this->search, 0, $this->encoding);
68 68
 
69
-		if ($i === $j || $i > 0 && $j > 0) {
70
-			return strcmp(mb_strtolower($nameA, $this->encoding),
71
-						  mb_strtolower($nameB, $this->encoding));
72
-		} elseif ($i === 0) {
73
-			return -1;
74
-		} else {
75
-			return 1;
76
-		}
77
-	}
69
+        if ($i === $j || $i > 0 && $j > 0) {
70
+            return strcmp(mb_strtolower($nameA, $this->encoding),
71
+                            mb_strtolower($nameB, $this->encoding));
72
+        } elseif ($i === 0) {
73
+            return -1;
74
+        } else {
75
+            return 1;
76
+        }
77
+    }
78 78
 }
Please login to merge, or discard this patch.