-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontroller.php
75 lines (63 loc) · 2.26 KB
/
controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* @project: Community Badges
*
* @copyright (C) 2021 Portland Labs (https://www.portlandlabs.com)
* @author Fabian Bitter ([email protected])
*/
namespace Concrete\Package\CommunityBadges;
use Concrete\Core\Application\UserInterface\Dashboard\Navigation\NavigationCache;
use Concrete\Core\Database\EntityManager\Provider\ProviderAggregateInterface;
use Concrete\Core\Database\EntityManager\Provider\StandardPackageProvider;
use Concrete\Core\Package\Package;
use PortlandLabs\CommunityBadges\Console\Command\ProcessAutomatedRules;
use PortlandLabs\CommunityBadges\Provider\ServiceProvider;
class Controller extends Package implements ProviderAggregateInterface
{
protected $pkgHandle = 'community_badges';
protected $appVersionRequired = '9.0';
protected $pkgVersion = '0.0.7';
protected $pkgAutoloaderRegistries = [
'src/PortlandLabs/CommunityBadges' => 'PortlandLabs\CommunityBadges',
];
public function getPackageDescription()
{
return t("Integrate the community awards feature awards into your site.");
}
public function getPackageName()
{
return t("Community Badges");
}
public function getEntityManagerProvider()
{
return new StandardPackageProvider($this->app, $this, [
'src/PortlandLabs/CommunityBadges/Entity' => 'PortlandLabs\CommunityBadges\Entity'
]);
}
public function on_start()
{
/** @var ServiceProvider $serviceProvider */
$serviceProvider = $this->app->make(ServiceProvider::class);
$serviceProvider->register();
if ($this->app->isRunThroughCommandLineInterface()) {
$console = $this->app->make('console');
$console->add(new ProcessAutomatedRules());
}
}
public function install()
{
$pkg = parent::install();
$this->installContentFile("data.xml");
/** @var NavigationCache $navigationCache */
$navigationCache = $this->app->make(NavigationCache::class);
$navigationCache->clear();
return $pkg;
}
public function upgrade()
{
parent::upgrade();
$this->installContentFile("data.xml");
$navigationCache = $this->app->make(NavigationCache::class);
$navigationCache->clear();
}
}