1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Adds all members, who have bought something, to the customer group. |
5
|
|
|
* |
6
|
|
|
* @authors: Nicolaas [at] Sunny Side Up .co.nz |
7
|
|
|
* @package: ecommerce |
8
|
|
|
* @sub-package: tasks |
9
|
|
|
* @inspiration: Silverstripe Ltd, Jeremy |
10
|
|
|
**/ |
11
|
|
|
class EcommerceTaskDashboardReset extends BuildTask |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
protected $title = 'Reset all dashboard settings'; |
14
|
|
|
|
15
|
|
|
protected $description = 'Resets all data set for the dashboard customisation. There is NO undo!'; |
16
|
|
|
|
17
|
|
|
protected $tables = array( |
18
|
|
|
"DashboardBlogEntryPanel", |
19
|
|
|
"DashboardGoogleAnalyticsPanel", |
20
|
|
|
"DashboardGridFieldPanel", |
21
|
|
|
"DashboardModelAdminPanel", |
22
|
|
|
"DashboardPanel", |
23
|
|
|
"DashboardPanelDataObject", |
24
|
|
|
"DashboardQuickLink", |
25
|
|
|
"DashboardRecentEditsPanel", |
26
|
|
|
"DashboardRecentFilesPanel", |
27
|
|
|
"DashboardRSSFeedPanel", |
28
|
|
|
"DashboardSectionEditorPanel", |
29
|
|
|
"DashboardWeatherPanel", |
30
|
|
|
"EcommerceDashboardPanel", |
31
|
|
|
"EcommerceDashboardPanel_FavouriteProducts", |
32
|
|
|
"EcommerceDashboardPanel_LatestOrders", |
33
|
|
|
"EcommerceDashboardPanel_OrderCount", |
34
|
|
|
"EcommerceDashboardPanel_SearchHistory" |
35
|
|
|
); |
36
|
|
|
|
37
|
|
|
public function run($request) |
38
|
|
|
{ |
39
|
|
|
foreach ($this->tables as $table) { |
40
|
|
|
DB::alteration_message('deleting '.$table, "deleted"); |
41
|
|
|
DB::query('DELETE FROM '.$table.';'); |
42
|
|
|
} |
43
|
|
|
DB::alteration_message('------------------ END ------------------'); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.