Move "OPTIMIZE TABLE" to own Database function

This commit is contained in:
Philipp Holzer 2023-05-13 21:05:22 +02:00
parent 32f322a4c1
commit db5078d51c
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
2 changed files with 14 additions and 1 deletions

View file

@ -1758,6 +1758,19 @@ class Database
return (['list' => $statelist, 'amount' => $processes]);
}
/**
* Optimizes tables
*
* @param string $table a given table
*
* @return bool True, if successfully optimized, otherwise false
* @throws \Exception
*/
public function optimizeTable(string $table): bool
{
return $this->e("OPTIMIZE TABLE " . DBA::buildTableString([$table])) !== false;
}
/**
* Fetch a database variable
*

View file

@ -108,6 +108,6 @@ final class DeliveryQueueItem extends \Friendica\BaseRepository
public function optimizeStorage(): bool
{
return $this->db->e("OPTIMIZE TABLE " . DBA::buildTableString([self::$table_name]));
return $this->db->optimizeTable(self::$table_name);
}
}