Move "OPTIMIZE TABLE" to own Database function
This commit is contained in:
parent
32f322a4c1
commit
db5078d51c
2 changed files with 14 additions and 1 deletions
|
@ -1758,6 +1758,19 @@ class Database
|
||||||
return (['list' => $statelist, 'amount' => $processes]);
|
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
|
* Fetch a database variable
|
||||||
*
|
*
|
||||||
|
|
|
@ -108,6 +108,6 @@ final class DeliveryQueueItem extends \Friendica\BaseRepository
|
||||||
|
|
||||||
public function optimizeStorage(): bool
|
public function optimizeStorage(): bool
|
||||||
{
|
{
|
||||||
return $this->db->e("OPTIMIZE TABLE " . DBA::buildTableString([self::$table_name]));
|
return $this->db->optimizeTable(self::$table_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue