Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
195c577c
Commit
195c577c
authored
10 years ago
by
Joas Schilling
Browse files
Options
Downloads
Patches
Plain Diff
Add a repair step to delete old tables
parent
4009f152
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/repair.php
+2
-0
2 additions, 0 deletions
lib/private/repair.php
lib/repair/dropoldtables.php
+83
-0
83 additions, 0 deletions
lib/repair/dropoldtables.php
with
85 additions
and
0 deletions
lib/private/repair.php
+
2
−
0
View file @
195c577c
...
...
@@ -13,6 +13,7 @@ use OC\Hooks\Emitter;
use
OC\Repair\AssetCache
;
use
OC\Repair\CleanTags
;
use
OC\Repair\Collation
;
use
OC\Repair\DropOldTables
;
use
OC\Repair\FillETags
;
use
OC\Repair\InnoDB
;
use
OC\Repair\RepairConfig
;
...
...
@@ -84,6 +85,7 @@ class Repair extends BasicEmitter {
new
AssetCache
(),
new
FillETags
(
\OC_DB
::
getConnection
()),
new
CleanTags
(
\OC_DB
::
getConnection
()),
new
DropOldTables
(
\OC_DB
::
getConnection
()),
);
}
...
...
This diff is collapsed.
Click to expand it.
lib/repair/dropoldtables.php
0 → 100644
+
83
−
0
View file @
195c577c
<?php
/**
* ownCloud
*
* @author Joas Schilling
* @copyright 2015 Joas Schilling nickvergessen@owncloud.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace
OC\Repair
;
use
OC\DB\Connection
;
use
OC\Hooks\BasicEmitter
;
use
OC\RepairStep
;
class
DropOldTables
extends
BasicEmitter
implements
RepairStep
{
/** @var Connection */
protected
$connection
;
/**
* @param Connection $connection
*/
public
function
__construct
(
Connection
$connection
)
{
$this
->
connection
=
$connection
;
}
/**
* Returns the step's name
*
* @return string
*/
public
function
getName
()
{
return
'Drop old database tables'
;
}
/**
* Run repair step.
* Must throw exception on error.
*
* @throws \Exception in case of failure
*/
public
function
run
()
{
foreach
(
$this
->
oldDatabaseTables
()
as
$tableName
)
{
if
(
$this
->
connection
->
tableExists
(
$tableName
)){
$this
->
emit
(
'\OC\Repair'
,
'info'
,
[
sprintf
(
'Table %s has been deleted'
,
$tableName
)
]);
$this
->
connection
->
dropTable
(
$tableName
);
}
}
}
/**
* Returns a list of outdated tables which are not used anymore
* @return array
*/
protected
function
oldDatabaseTables
()
{
return
[
'calendar_calendars'
,
'calendar_objects'
,
'calendar_share_calendar'
,
'calendar_share_event'
,
'foldersize'
,
'fscache'
,
'locks'
,
'log'
,
'media_albums'
,
'media_artists'
,
'media_sessions'
,
'media_songs'
,
'media_users'
,
'permissions'
,
'pictures_images_cache'
,
'queuedtasks'
,
'sharing'
,
];
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment