Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/dav/lib/DAV/FileCustomPropertiesBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected function updateProperties($path, INode $node, $changedProperties) {
// If it was null, we need to delete the property
if ($propertyValue === null) {
if ($propertyExists) {
$this->connection->executeUpdate(
$this->connection->executeStatement(
self::DELETE_BY_ID_AND_NAME_STMT,
[
$fileId,
Expand All @@ -183,7 +183,7 @@ protected function updateProperties($path, INode $node, $changedProperties) {
} else {
$propertyData = $this->encodeValue($propertyValue);
if (!$propertyExists) {
$this->connection->executeUpdate(
$this->connection->executeStatement(
self::INSERT_BY_ID_STMT,
[
$fileId,
Expand All @@ -193,7 +193,7 @@ protected function updateProperties($path, INode $node, $changedProperties) {
]
);
} else {
$this->connection->executeUpdate(
$this->connection->executeStatement(
self::UPDATE_BY_ID_AND_NAME_STMT,
[
$propertyData['value'],
Expand Down
6 changes: 3 additions & 3 deletions apps/dav/lib/DAV/MiscCustomPropertiesBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected function updateProperties($path, INode $node, $changedProperties) {
// If it was null, we need to delete the property
if ($propertyValue === null) {
if ($propertyExists) {
$this->connection->executeUpdate(
$this->connection->executeStatement(
self::DELETE_BY_PATH_AND_NAME_STMT,
[
$path,
Expand All @@ -127,7 +127,7 @@ protected function updateProperties($path, INode $node, $changedProperties) {
} else {
$propertyData = $this->encodeValue($propertyValue);
if (!$propertyExists) {
$this->connection->executeUpdate(
$this->connection->executeStatement(
self::INSERT_BY_PATH_STMT,
[
$path,
Expand All @@ -137,7 +137,7 @@ protected function updateProperties($path, INode $node, $changedProperties) {
]
);
} else {
$this->connection->executeUpdate(
$this->connection->executeStatement(
self::UPDATE_BY_PATH_AND_NAME_STMT,
[
$propertyData['value'],
Expand Down
2 changes: 1 addition & 1 deletion apps/files/tests/Command/DeleteOrphanedFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function testClearFiles() {

$this->assertCount(1, $this->getFile($fileInfo->getId()), 'Asserts that file is still available');

$deletedRows = $this->connection->executeUpdate('DELETE FROM `*PREFIX*storages` WHERE `id` = ?', [$storageId]);
$deletedRows = $this->connection->executeStatement('DELETE FROM `*PREFIX*storages` WHERE `id` = ?', [$storageId]);
$this->assertNotNull($deletedRows, 'Asserts that storage got deleted');
$this->assertSame(1, $deletedRows, 'Asserts that storage got deleted');

Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/DeleteOrphanedSharesJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function run($argument) {
'WHERE `item_type` in (\'file\', \'folder\') ' .
'AND NOT EXISTS (SELECT `fileid` FROM `*PREFIX*filecache` WHERE `file_source` = `fileid`)';

$deletedEntries = $connection->executeUpdate($sql);
$deletedEntries = $connection->executeStatement($sql);
$logger->debug("$deletedEntries orphaned share(s) deleted", ['app' => 'DeleteOrphanedSharesJob']);
}
}
4 changes: 2 additions & 2 deletions apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function setUp(): void {

$this->connection = \OC::$server->getDatabaseConnection();
// clear occasional leftover shares from other tests
$this->connection->executeUpdate('DELETE FROM `*PREFIX*share`');
$this->connection->executeStatement('DELETE FROM `*PREFIX*share`');

$this->user1 = self::getUniqueID('user1_');
$this->user2 = self::getUniqueID('user2_');
Expand All @@ -93,7 +93,7 @@ protected function setUp(): void {
}

protected function tearDown(): void {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*share`');
$this->connection->executeStatement('DELETE FROM `*PREFIX*share`');

$userManager = \OC::$server->getUserManager();
$user1 = $userManager->get($this->user1);
Expand Down
4 changes: 2 additions & 2 deletions apps/files_sharing/tests/ExpireSharesJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function setUp(): void {
$this->shareManager = \OC::$server->getShareManager();
$this->connection = \OC::$server->getDatabaseConnection();
// clear occasional leftover shares from other tests
$this->connection->executeUpdate('DELETE FROM `*PREFIX*share`');
$this->connection->executeStatement('DELETE FROM `*PREFIX*share`');
$this->defaultShareProvider = $this->createMock(DefaultShareProvider::class);
$this->activityManager = $this->createMock(\OCP\Activity\IManager::class);

Expand All @@ -100,7 +100,7 @@ protected function setUp(): void {
}

protected function tearDown(): void {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*share`');
$this->connection->executeStatement('DELETE FROM `*PREFIX*share`');

$userManager = \OC::$server->getUserManager();
$user1 = $userManager->get($this->user1);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function tearDown(): void {

// clear trash table
$connection = \OC::$server->getDatabaseConnection();
$connection->executeUpdate('DELETE FROM `*PREFIX*files_trash`');
$connection->executeStatement('DELETE FROM `*PREFIX*files_trash`');

parent::tearDown();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
exit(1);
}

if (PHP_VERSION_ID >= 80000) {
echo 'This version of ownCloud is not compatible with PHP 8.0' . $eol;
if (PHP_VERSION_ID >= 80400) {
echo 'This version of ownCloud is not compatible with PHP 8.4' . $eol;
echo 'You are currently running PHP ' . PHP_VERSION . '.' . $eol;
exit(1);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/private/AllConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function deleteUserValue($userId, $appName, $key) {

$sql = 'DELETE FROM `*PREFIX*preferences` '.
'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?';
$this->connection->executeUpdate($sql, [$userId, $appName, $key]);
$this->connection->executeStatement($sql, [$userId, $appName, $key]);

if (isset($this->userCache[$userId], $this->userCache[$userId][$appName])) {
unset($this->userCache[$userId][$appName][$key]);
Expand Down Expand Up @@ -346,7 +346,7 @@ public function deleteAllUserValues($userId) {

$sql = 'DELETE FROM `*PREFIX*preferences` '.
'WHERE `userid` = ?';
$this->connection->executeUpdate($sql, [$userId]);
$this->connection->executeStatement($sql, [$userId]);

unset($this->userCache[$userId]);

Expand Down Expand Up @@ -376,7 +376,7 @@ public function deleteAppFromAllUsers($appName) {

$sql = 'DELETE FROM `*PREFIX*preferences` '.
'WHERE `appid` = ?';
$this->connection->executeUpdate($sql, [$appName]);
$this->connection->executeStatement($sql, [$appName]);

foreach ($this->userCache as &$userCache) {
unset($userCache[$appName]);
Expand Down
4 changes: 2 additions & 2 deletions lib/private/AppFramework/Db/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @deprecated use IDBConnection directly, will be removed in ownCloud 10
* Small Facade for being able to inject the database connection for tests
*/
class Db implements IDb {

Check failure on line 39 in lib/private/AppFramework/Db/Db.php

View workflow job for this annotation

GitHub Actions / PHP Code Style (7.4)

Non-abstract class OC\AppFramework\Db\Db contains abstract method executeUpdate() from interface OCP\IDBConnection.
/**
* @var IDBConnection
*/
Expand Down Expand Up @@ -87,14 +87,14 @@
/**
* @inheritdoc
*/
public function executeUpdate($query, array $params = [], array $types = []) {
return $this->connection->executeUpdate($query, $params, $types);
public function executeStatement($query, array $params = [], array $types = []) {

Check failure on line 90 in lib/private/AppFramework/Db/Db.php

View workflow job for this annotation

GitHub Actions / PHP Code Style (7.4)

Return type mixed of method OC\AppFramework\Db\Db::executeStatement() is not covariant with return type int of method OCP\IDBConnection::executeStatement().
return $this->connection->executeStatement($query, $params, $types);
}

/**
* @inheritdoc
*/
public function executeStatement($query, array $params = [], array $types = []) {

Check failure on line 97 in lib/private/AppFramework/Db/Db.php

View workflow job for this annotation

GitHub Actions / PHP Code Style (7.4)

Return type mixed of method OC\AppFramework\Db\Db::executeStatement() is not covariant with return type int of method OCP\IDBConnection::executeStatement().

Check failure on line 97 in lib/private/AppFramework/Db/Db.php

View workflow job for this annotation

GitHub Actions / PHP Code Style (7.4)

Cannot redeclare method OC\AppFramework\Db\Db::executeStatement().
return $this->connection->executeStatement($query, $params, $types);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/private/Comments/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function updateChildrenInformation($id, \DateTime $cDateTime) {
->setParameter('id', $id);

$resultStatement = $query->execute();
$data = $resultStatement->fetch(\PDO::FETCH_NUM);
$data = $resultStatement->fetchNumeric();
$resultStatement->free();
$children = \intval($data[0]);

Expand Down Expand Up @@ -443,7 +443,7 @@ public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $
}

$resultStatement = $query->execute();
$data = $resultStatement->fetch(\PDO::FETCH_NUM);
$data = $resultStatement->fetchNumeric();
$resultStatement->free();
return \intval($data[0]);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/private/DB/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function fixupStatement($statement) {
*/
public function lockTable($tableName) {
$this->conn->beginTransaction();
$this->conn->executeUpdate('LOCK TABLE `' .$tableName . '` IN EXCLUSIVE MODE');
$this->conn->executeStatement('LOCK TABLE `' .$tableName . '` IN EXCLUSIVE MODE');
}

/**
Expand Down Expand Up @@ -113,7 +113,7 @@ public function insertIfNotExist($table, $input, array $compare = null) {
}
$query = \substr($query, 0, \strlen($query) - 5);
$query .= ' HAVING COUNT(*) = 0';
return $this->conn->executeUpdate($query, $inserts);
return $this->conn->executeStatement($query, $inserts);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/private/DB/AdapterMySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class AdapterMySQL extends Adapter {
* @param string $tableName
*/
public function lockTable($tableName) {
$this->conn->executeUpdate('LOCK TABLES `' .$tableName . '` WRITE');
$this->conn->executeStatement('LOCK TABLES `' .$tableName . '` WRITE');
}

public function unlockTable() {
$this->conn->executeUpdate('UNLOCK TABLES');
$this->conn->executeStatement('UNLOCK TABLES');
}

public function fixupStatement($statement) {
Expand Down
6 changes: 3 additions & 3 deletions lib/private/DB/AdapterSqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class AdapterSqlite extends Adapter {
* @param string $tableName
*/
public function lockTable($tableName) {
$this->conn->executeUpdate('BEGIN EXCLUSIVE TRANSACTION');
$this->conn->executeStatement('BEGIN EXCLUSIVE TRANSACTION');
}

public function unlockTable() {
$this->conn->executeUpdate('COMMIT TRANSACTION');
$this->conn->executeStatement('COMMIT TRANSACTION');
}

public function fixupStatement($statement) {
Expand Down Expand Up @@ -80,6 +80,6 @@ public function insertIfNotExist($table, $input, array $compare = null) {
$query = \substr($query, 0, \strlen($query) - 5);
$query .= ')';

return $this->conn->executeUpdate($query, $inserts);
return $this->conn->executeStatement($query, $inserts);
}
}
12 changes: 5 additions & 7 deletions lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function prepare($statement, $limit=null, $offset=null) : \Doctrine\DBAL\
* @param array $types The types the previous parameters are in.
* @param \Doctrine\DBAL\Cache\QueryCacheProfile|null $qcp The query cache profile, optional.
*
* @return \Doctrine\DBAL\Driver\Statement The executed statement.
* @return Result The executed statement.
*
* @throws \Doctrine\DBAL\Exception
*/
Expand Down Expand Up @@ -212,9 +212,7 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache
* @deprecated since 10.8.0
*/
public function executeUpdate($query, array $params = [], array $types = []) : int {
$query = $this->replaceTablePrefix($query);
$query = $this->adapter->fixupStatement($query);
return parent::executeUpdate($query, $params, $types);
return $this->executeStatement($query, $params, $types);
}

/**
Expand All @@ -233,7 +231,7 @@ public function executeUpdate($query, array $params = [], array $types = []) : i
*
* @since 10.8.0
*/
public function executeStatement($query, array $params = [], array $types = []) {
public function executeStatement($query, array $params = [], array $types = []): int {
$query = $this->replaceTablePrefix($query);
$query = $this->adapter->fixupStatement($query);
return parent::executeStatement($query, $params, $types);
Expand Down Expand Up @@ -397,7 +395,7 @@ public function getError() {
*/
public function dropTable($table) {
$table = $this->tablePrefix . \trim($table);
$schema = $this->getSchemaManager();
$schema = $this->createSchemaManager();
if ($schema->tablesExist([$table])) {
$schema->dropTable($table);
}
Expand All @@ -411,7 +409,7 @@ public function dropTable($table) {
*/
public function tableExists($table) {
$table = $this->tablePrefix . \trim($table);
$schema = $this->getSchemaManager();
$schema = $this->createSchemaManager();
return $schema->tablesExist([$table]);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/private/DB/MDB2SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getDbStructure($file) {
*/
public function createDbFromStructure($file) {
$schemaReader = new MDB2SchemaReader(\OC::$server->getConfig(), $this->conn->getDatabasePlatform());
$toSchema = new Schema([], [], $this->conn->getSchemaManager()->createSchemaConfig());
$toSchema = new Schema([], [], $this->conn->createSchemaManager()->createSchemaConfig());
$toSchema = $schemaReader->loadSchemaFromFile($file, $toSchema);
return $this->executeSchemaChange($toSchema);
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public function getMigrator() {
private function readSchemaFromFile($file) {
$platform = $this->conn->getDatabasePlatform();
$schemaReader = new MDB2SchemaReader(\OC::$server->getConfig(), $platform);
$toSchema = new Schema([], [], $this->conn->getSchemaManager()->createSchemaConfig());
$toSchema = new Schema([], [], $this->conn->createSchemaManager()->createSchemaConfig());
return $schemaReader->loadSchemaFromFile($file, $toSchema);
}

Expand Down Expand Up @@ -139,7 +139,7 @@ public function generateChangeScript($schema) {
*/
public function removeDBStructure($file) {
$schemaReader = new MDB2SchemaReader(\OC::$server->getConfig(), $this->conn->getDatabasePlatform());
$toSchema = new Schema([], [], $this->conn->getSchemaManager()->createSchemaConfig());
$toSchema = new Schema([], [], $this->conn->createSchemaManager()->createSchemaConfig());
$fromSchema = $schemaReader->loadSchemaFromFile($file, $toSchema);
$toSchema = clone $fromSchema;
/** @var $table \Doctrine\DBAL\Schema\Table */
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DB/MDB2SchemaWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function saveSchemaToFile($file, \OC\DB\Connection $conn) {
return str_starts_with($asset, $prefix);
});

foreach ($conn->getSchemaManager()->listTables() as $table) {
foreach ($conn->createSchemaManager()->listTables() as $table) {
self::saveTable($table, $xml->addChild('table'));
}
\file_put_contents($file, $xml->asXML());
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DB/MigrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private function createMigrationTable() {
$table->setPrimaryKey([
$this->connection->getDatabasePlatform()->quoteIdentifier('app'),
$this->connection->getDatabasePlatform()->quoteIdentifier('version')]);
$this->connection->getSchemaManager()->createTable($table);
$this->connection->createSchemaManager()->createTable($table);

$this->migrationTableCreated = true;

Expand Down
4 changes: 2 additions & 2 deletions lib/private/DB/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function createSchema() {
}
return str_starts_with($asset, $prefix);
});
return $this->connection->getSchemaManager()->createSchema();
return $this->connection->createSchemaManager()->createSchema();
}

/**
Expand Down Expand Up @@ -142,7 +142,7 @@ protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $conn
}
return str_starts_with($asset, $prefix);
});
$sourceSchema = $connection->getSchemaManager()->createSchema();
$sourceSchema = $connection->createSchemaManager()->createSchema();

// remove tables we don't know about
/** @var $table \Doctrine\DBAL\Schema\Table */
Expand Down
4 changes: 2 additions & 2 deletions lib/private/DB/OracleConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function delete($tableExpression, array $identifier, array $types = []) {
public function dropTable($table) {
$table = $this->tablePrefix . \trim($table);
$table = $this->quoteIdentifier($table);
$schema = $this->getSchemaManager();
$schema = $this->createSchemaManager();
if ($schema->tablesExist([$table])) {
$schema->dropTable($table);
}
Expand All @@ -99,7 +99,7 @@ public function dropTable($table) {
public function tableExists($table) {
$table = $this->tablePrefix . \trim($table);
$table = $this->quoteIdentifier($table);
$schema = $this->getSchemaManager();
$schema = $this->createSchemaManager();
return $schema->tablesExist([$table]);
}
}
Loading
Loading